Model Initialization - Passing parameters - Rails 5How can I “pretty” format my JSON output in Ruby on Rails?How to pass command line arguments to a rake taskA concise explanation of nil v. empty v. blank in Ruby on RailsUnderstanding the Rails Authenticity TokenUndo scaffolding in RailsPassing parameters in rails redirect_toHow can I rename a database column in a Ruby on Rails migration?How do I get the current absolute URL in Ruby on Rails?How to redirect to a 404 in Rails?How to drop columns using Rails migration

Does "he squandered his car on drink" sound natural?

Is it allowed to activate the ability of multiple planeswalkers in a single turn?

Has any country ever had 2 former presidents in jail simultaneously?

How to get directions in deep space?

Does an advisor owe his/her student anything? Will an advisor keep a PhD student only out of pity?

Why does the Sun have different day lengths, but not the gas giants?

Which was the first story featuring espers?

I found an audio circuit and I built it just fine, but I find it a bit too quiet. How do I amplify the output so that it is a bit louder?

Which Article Helped Get Rid of Technobabble in RPGs?

Can I say "fingers" when referring to toes?

Do we have to expect a queue for the shuttle from Watford Junction to Harry Potter Studio?

Review your own paper in Mathematics

What is the difference between lands and mana?

Is there a nicer/politer/more positive alternative for "negates"?

How can I write humor as character trait?

What's the name of the logical fallacy where a debater extends a statement far beyond the original statement to make it true?

Is there a RAID 0 Equivalent for RAM?

Can I cause damage to electrical appliances by unplugging them when they are turned on?

Creating two special characters

What is the highest possible scrabble score for placing a single tile

Giving feedback to someone without sounding prejudiced

Taxes on Dividends in a Roth IRA

Why can't the Brexit deadlock in the UK parliament be solved with a plurality vote?

How to explain what's wrong with this application of the chain rule?



Model Initialization - Passing parameters - Rails 5


How can I “pretty” format my JSON output in Ruby on Rails?How to pass command line arguments to a rake taskA concise explanation of nil v. empty v. blank in Ruby on RailsUnderstanding the Rails Authenticity TokenUndo scaffolding in RailsPassing parameters in rails redirect_toHow can I rename a database column in a Ruby on Rails migration?How do I get the current absolute URL in Ruby on Rails?How to redirect to a 404 in Rails?How to drop columns using Rails migration













0















I am having trouble initializing my model.



I am trying to build a model which takes a url_address string on initialization, utilizes DocRaptor to build a PDF, then uses pdf-reader to read data from that PDF, and finally remove the stored PDF.



When I have a blank model, I can save using Rails 5 forms, as per the introductory Rails 5 guide, here: https://guides.rubyonrails.org/getting_started.html



I built a new project from scratch using a postgresql database, and set about with the Guide. I was able to save models just fine with a blank UrlDataModel definition. However, when I edited my model to contain functionality necessary to retrieve the PDF and read it, I get a



NoMethodError - undefined method '[]' for nil:Class


I do know this error means that my model is empty, so I'm trying to troubleshoot how that happens.



The controller fails on



@url_data_model.save


My repo is here: https://github.com/blueMesaEngineering/Minotaur-hoof



Model follows here:




class UrlDataModel < ApplicationRecord
attr_accessor :url_address, :pdf_version, :producer, :title, :metadata, :page_count

def initialize(attributes = )
@url_address = attributes[:url_address]
@pdf_version = attributes[:pdf_version]
@producer = attributes[:producer]
@title = attributes[:title]
@metadata = attributes[:metadata]
@page_count = attributes[:page_count]
end

def after_initialize
buildModelFromURLViaPDF
end

def buildModelFromURLViaPDF
convertURLToPDF
readPDFData
deletePDF
end

def convertURLToPDF
require 'bundler/setup'
Bundler.require

DocRaptor.configure do |dr|
dr.username = 'YOUR_API_KEY_HERE' # this key works for test documents
# dr.debugging = true
end

$docraptor = DocRaptor::DocApi.new

begin
logPathName = './storage/Logs/standardOutput/output.txt'
errorLogPathName = './storage/Logs/Error/'
pathName = './storage/PDFs/'
# url = "http://docraptor.com/examples/invoice.html"
url = 'http://www.docraptor.com'
@url_address = url

fileNamePDF = 'docraptor-ruby.pdf'

create_response = $docraptor.create_async_doc(
test: true, # test documents are free but watermarked
document_url: url, # or use a url
name: fileNamePDF, # help you find a document later
document_type: 'pdf' # pdf or xls or xlsx
)

loop do
status_response = $docraptor.get_async_doc_status(create_response.status_id)

# puts "doc status: #status_response.status"

case status_response.status

when 'completed'
doc_response = $docraptor.get_async_doc(status_response.download_id)
File.open('./storage/PDFs/docraptor-ruby.pdf', 'wb') do |file|
file.write(doc_response)
end
# puts "Wrote PDF to " + pathName + fileNamePDF

break

when 'failed'

# puts "FAILED"
# puts status_response
break

else

sleep 1

end
end
rescue DocRaptor::ApiError => error
# puts "#error.class: #error.message"
# puts error.code # HTTP response code
# puts error.response_body # HTTP response body
# puts error.backtrace[0..3].join("n")
end
end

def readPDFData
require 'rubygems'
require 'pdf/reader'

fileName = './storage/PDFs/docraptor-ruby.pdf'

PDF::Reader.open(fileName) do |reader|
@pdf_version = reader.pdf_version
# @producer = reader.producer
# @title = reader.title
@metadata = reader.metadata
@page_count = reader.page_count
end
end

def deletePDF
require 'fileutils'

FileUtils.rm_rf('./storage/PDFs/docraptor-ruby.pdf')
end
end


Penny for your thoughts? I'm on here for the rest of the evening, so I will be able to respond directly. Thank you for taking a look!



Cheers.



Controller: https://pastebin.com/QVaHCMep



Stack Trace: https://pastebin.com/uQbXgiaH










share|improve this question
























  • A couple (or four) things. First, you should probably put the whole stack trace in your question (it's often easier to get a sense of the error and where it might be coming from). Second, IMO you are significantly overloading the responsibility of that model. Third, it seems strange to have those require statements sprinkled throughout (and configure statements, too). Fourth, and finally, it looks like a global variable in there ($docraptor) which might not be a big deal but I personally never use.

    – jvillian
    Mar 8 at 0:29












  • Where is the code where you are actually initializing the model and saving it? Post it here please. And you should probably remove the comments in your code here, doesn't really help us to solve your problem.

    – Antarr Byrd
    Mar 8 at 0:51











  • Hello - Thanks for the response. I am self-taught with respect to Ruby and Rails, so I am always learning. Some of the apparent globals ($docraptor) were in some of the documentation, but I will take it under advisement. Some things seemed to break when I left requires in the higher level of the class, but I will double check. Should some of this be in the controller? I was building this under the guidelines of a "thin controller" model. I'm not sure if that's best though. Comments have been removed accordingly. Thank you for your help!

    – ND Guthrie
    Mar 8 at 1:57











  • Heroku app: murmuring-chamber-54696.herokuapp.com

    – ND Guthrie
    Mar 8 at 2:00











  • I would advise opening rails console and trying to save a record with the same attributes you'd get from the controller. If there's an error look at the stack trace to determine what line it originated from. I'm afraid without this info this question is impossible to answer. I'm assuming that since you can call @url_data_model.save you have already initialized the record without error. None of the other model code actually gets run with the code you've shown

    – max pleaner
    Mar 8 at 9:53















0















I am having trouble initializing my model.



I am trying to build a model which takes a url_address string on initialization, utilizes DocRaptor to build a PDF, then uses pdf-reader to read data from that PDF, and finally remove the stored PDF.



When I have a blank model, I can save using Rails 5 forms, as per the introductory Rails 5 guide, here: https://guides.rubyonrails.org/getting_started.html



I built a new project from scratch using a postgresql database, and set about with the Guide. I was able to save models just fine with a blank UrlDataModel definition. However, when I edited my model to contain functionality necessary to retrieve the PDF and read it, I get a



NoMethodError - undefined method '[]' for nil:Class


I do know this error means that my model is empty, so I'm trying to troubleshoot how that happens.



The controller fails on



@url_data_model.save


My repo is here: https://github.com/blueMesaEngineering/Minotaur-hoof



Model follows here:




class UrlDataModel < ApplicationRecord
attr_accessor :url_address, :pdf_version, :producer, :title, :metadata, :page_count

def initialize(attributes = )
@url_address = attributes[:url_address]
@pdf_version = attributes[:pdf_version]
@producer = attributes[:producer]
@title = attributes[:title]
@metadata = attributes[:metadata]
@page_count = attributes[:page_count]
end

def after_initialize
buildModelFromURLViaPDF
end

def buildModelFromURLViaPDF
convertURLToPDF
readPDFData
deletePDF
end

def convertURLToPDF
require 'bundler/setup'
Bundler.require

DocRaptor.configure do |dr|
dr.username = 'YOUR_API_KEY_HERE' # this key works for test documents
# dr.debugging = true
end

$docraptor = DocRaptor::DocApi.new

begin
logPathName = './storage/Logs/standardOutput/output.txt'
errorLogPathName = './storage/Logs/Error/'
pathName = './storage/PDFs/'
# url = "http://docraptor.com/examples/invoice.html"
url = 'http://www.docraptor.com'
@url_address = url

fileNamePDF = 'docraptor-ruby.pdf'

create_response = $docraptor.create_async_doc(
test: true, # test documents are free but watermarked
document_url: url, # or use a url
name: fileNamePDF, # help you find a document later
document_type: 'pdf' # pdf or xls or xlsx
)

loop do
status_response = $docraptor.get_async_doc_status(create_response.status_id)

# puts "doc status: #status_response.status"

case status_response.status

when 'completed'
doc_response = $docraptor.get_async_doc(status_response.download_id)
File.open('./storage/PDFs/docraptor-ruby.pdf', 'wb') do |file|
file.write(doc_response)
end
# puts "Wrote PDF to " + pathName + fileNamePDF

break

when 'failed'

# puts "FAILED"
# puts status_response
break

else

sleep 1

end
end
rescue DocRaptor::ApiError => error
# puts "#error.class: #error.message"
# puts error.code # HTTP response code
# puts error.response_body # HTTP response body
# puts error.backtrace[0..3].join("n")
end
end

def readPDFData
require 'rubygems'
require 'pdf/reader'

fileName = './storage/PDFs/docraptor-ruby.pdf'

PDF::Reader.open(fileName) do |reader|
@pdf_version = reader.pdf_version
# @producer = reader.producer
# @title = reader.title
@metadata = reader.metadata
@page_count = reader.page_count
end
end

def deletePDF
require 'fileutils'

FileUtils.rm_rf('./storage/PDFs/docraptor-ruby.pdf')
end
end


Penny for your thoughts? I'm on here for the rest of the evening, so I will be able to respond directly. Thank you for taking a look!



Cheers.



Controller: https://pastebin.com/QVaHCMep



Stack Trace: https://pastebin.com/uQbXgiaH










share|improve this question
























  • A couple (or four) things. First, you should probably put the whole stack trace in your question (it's often easier to get a sense of the error and where it might be coming from). Second, IMO you are significantly overloading the responsibility of that model. Third, it seems strange to have those require statements sprinkled throughout (and configure statements, too). Fourth, and finally, it looks like a global variable in there ($docraptor) which might not be a big deal but I personally never use.

    – jvillian
    Mar 8 at 0:29












  • Where is the code where you are actually initializing the model and saving it? Post it here please. And you should probably remove the comments in your code here, doesn't really help us to solve your problem.

    – Antarr Byrd
    Mar 8 at 0:51











  • Hello - Thanks for the response. I am self-taught with respect to Ruby and Rails, so I am always learning. Some of the apparent globals ($docraptor) were in some of the documentation, but I will take it under advisement. Some things seemed to break when I left requires in the higher level of the class, but I will double check. Should some of this be in the controller? I was building this under the guidelines of a "thin controller" model. I'm not sure if that's best though. Comments have been removed accordingly. Thank you for your help!

    – ND Guthrie
    Mar 8 at 1:57











  • Heroku app: murmuring-chamber-54696.herokuapp.com

    – ND Guthrie
    Mar 8 at 2:00











  • I would advise opening rails console and trying to save a record with the same attributes you'd get from the controller. If there's an error look at the stack trace to determine what line it originated from. I'm afraid without this info this question is impossible to answer. I'm assuming that since you can call @url_data_model.save you have already initialized the record without error. None of the other model code actually gets run with the code you've shown

    – max pleaner
    Mar 8 at 9:53













0












0








0








I am having trouble initializing my model.



I am trying to build a model which takes a url_address string on initialization, utilizes DocRaptor to build a PDF, then uses pdf-reader to read data from that PDF, and finally remove the stored PDF.



When I have a blank model, I can save using Rails 5 forms, as per the introductory Rails 5 guide, here: https://guides.rubyonrails.org/getting_started.html



I built a new project from scratch using a postgresql database, and set about with the Guide. I was able to save models just fine with a blank UrlDataModel definition. However, when I edited my model to contain functionality necessary to retrieve the PDF and read it, I get a



NoMethodError - undefined method '[]' for nil:Class


I do know this error means that my model is empty, so I'm trying to troubleshoot how that happens.



The controller fails on



@url_data_model.save


My repo is here: https://github.com/blueMesaEngineering/Minotaur-hoof



Model follows here:




class UrlDataModel < ApplicationRecord
attr_accessor :url_address, :pdf_version, :producer, :title, :metadata, :page_count

def initialize(attributes = )
@url_address = attributes[:url_address]
@pdf_version = attributes[:pdf_version]
@producer = attributes[:producer]
@title = attributes[:title]
@metadata = attributes[:metadata]
@page_count = attributes[:page_count]
end

def after_initialize
buildModelFromURLViaPDF
end

def buildModelFromURLViaPDF
convertURLToPDF
readPDFData
deletePDF
end

def convertURLToPDF
require 'bundler/setup'
Bundler.require

DocRaptor.configure do |dr|
dr.username = 'YOUR_API_KEY_HERE' # this key works for test documents
# dr.debugging = true
end

$docraptor = DocRaptor::DocApi.new

begin
logPathName = './storage/Logs/standardOutput/output.txt'
errorLogPathName = './storage/Logs/Error/'
pathName = './storage/PDFs/'
# url = "http://docraptor.com/examples/invoice.html"
url = 'http://www.docraptor.com'
@url_address = url

fileNamePDF = 'docraptor-ruby.pdf'

create_response = $docraptor.create_async_doc(
test: true, # test documents are free but watermarked
document_url: url, # or use a url
name: fileNamePDF, # help you find a document later
document_type: 'pdf' # pdf or xls or xlsx
)

loop do
status_response = $docraptor.get_async_doc_status(create_response.status_id)

# puts "doc status: #status_response.status"

case status_response.status

when 'completed'
doc_response = $docraptor.get_async_doc(status_response.download_id)
File.open('./storage/PDFs/docraptor-ruby.pdf', 'wb') do |file|
file.write(doc_response)
end
# puts "Wrote PDF to " + pathName + fileNamePDF

break

when 'failed'

# puts "FAILED"
# puts status_response
break

else

sleep 1

end
end
rescue DocRaptor::ApiError => error
# puts "#error.class: #error.message"
# puts error.code # HTTP response code
# puts error.response_body # HTTP response body
# puts error.backtrace[0..3].join("n")
end
end

def readPDFData
require 'rubygems'
require 'pdf/reader'

fileName = './storage/PDFs/docraptor-ruby.pdf'

PDF::Reader.open(fileName) do |reader|
@pdf_version = reader.pdf_version
# @producer = reader.producer
# @title = reader.title
@metadata = reader.metadata
@page_count = reader.page_count
end
end

def deletePDF
require 'fileutils'

FileUtils.rm_rf('./storage/PDFs/docraptor-ruby.pdf')
end
end


Penny for your thoughts? I'm on here for the rest of the evening, so I will be able to respond directly. Thank you for taking a look!



Cheers.



Controller: https://pastebin.com/QVaHCMep



Stack Trace: https://pastebin.com/uQbXgiaH










share|improve this question
















I am having trouble initializing my model.



I am trying to build a model which takes a url_address string on initialization, utilizes DocRaptor to build a PDF, then uses pdf-reader to read data from that PDF, and finally remove the stored PDF.



When I have a blank model, I can save using Rails 5 forms, as per the introductory Rails 5 guide, here: https://guides.rubyonrails.org/getting_started.html



I built a new project from scratch using a postgresql database, and set about with the Guide. I was able to save models just fine with a blank UrlDataModel definition. However, when I edited my model to contain functionality necessary to retrieve the PDF and read it, I get a



NoMethodError - undefined method '[]' for nil:Class


I do know this error means that my model is empty, so I'm trying to troubleshoot how that happens.



The controller fails on



@url_data_model.save


My repo is here: https://github.com/blueMesaEngineering/Minotaur-hoof



Model follows here:




class UrlDataModel < ApplicationRecord
attr_accessor :url_address, :pdf_version, :producer, :title, :metadata, :page_count

def initialize(attributes = )
@url_address = attributes[:url_address]
@pdf_version = attributes[:pdf_version]
@producer = attributes[:producer]
@title = attributes[:title]
@metadata = attributes[:metadata]
@page_count = attributes[:page_count]
end

def after_initialize
buildModelFromURLViaPDF
end

def buildModelFromURLViaPDF
convertURLToPDF
readPDFData
deletePDF
end

def convertURLToPDF
require 'bundler/setup'
Bundler.require

DocRaptor.configure do |dr|
dr.username = 'YOUR_API_KEY_HERE' # this key works for test documents
# dr.debugging = true
end

$docraptor = DocRaptor::DocApi.new

begin
logPathName = './storage/Logs/standardOutput/output.txt'
errorLogPathName = './storage/Logs/Error/'
pathName = './storage/PDFs/'
# url = "http://docraptor.com/examples/invoice.html"
url = 'http://www.docraptor.com'
@url_address = url

fileNamePDF = 'docraptor-ruby.pdf'

create_response = $docraptor.create_async_doc(
test: true, # test documents are free but watermarked
document_url: url, # or use a url
name: fileNamePDF, # help you find a document later
document_type: 'pdf' # pdf or xls or xlsx
)

loop do
status_response = $docraptor.get_async_doc_status(create_response.status_id)

# puts "doc status: #status_response.status"

case status_response.status

when 'completed'
doc_response = $docraptor.get_async_doc(status_response.download_id)
File.open('./storage/PDFs/docraptor-ruby.pdf', 'wb') do |file|
file.write(doc_response)
end
# puts "Wrote PDF to " + pathName + fileNamePDF

break

when 'failed'

# puts "FAILED"
# puts status_response
break

else

sleep 1

end
end
rescue DocRaptor::ApiError => error
# puts "#error.class: #error.message"
# puts error.code # HTTP response code
# puts error.response_body # HTTP response body
# puts error.backtrace[0..3].join("n")
end
end

def readPDFData
require 'rubygems'
require 'pdf/reader'

fileName = './storage/PDFs/docraptor-ruby.pdf'

PDF::Reader.open(fileName) do |reader|
@pdf_version = reader.pdf_version
# @producer = reader.producer
# @title = reader.title
@metadata = reader.metadata
@page_count = reader.page_count
end
end

def deletePDF
require 'fileutils'

FileUtils.rm_rf('./storage/PDFs/docraptor-ruby.pdf')
end
end


Penny for your thoughts? I'm on here for the rest of the evening, so I will be able to respond directly. Thank you for taking a look!



Cheers.



Controller: https://pastebin.com/QVaHCMep



Stack Trace: https://pastebin.com/uQbXgiaH







ruby-on-rails ruby model






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 8 at 2:50









Antarr Byrd

9,9672372126




9,9672372126










asked Mar 8 at 0:05









ND GuthrieND Guthrie

11




11












  • A couple (or four) things. First, you should probably put the whole stack trace in your question (it's often easier to get a sense of the error and where it might be coming from). Second, IMO you are significantly overloading the responsibility of that model. Third, it seems strange to have those require statements sprinkled throughout (and configure statements, too). Fourth, and finally, it looks like a global variable in there ($docraptor) which might not be a big deal but I personally never use.

    – jvillian
    Mar 8 at 0:29












  • Where is the code where you are actually initializing the model and saving it? Post it here please. And you should probably remove the comments in your code here, doesn't really help us to solve your problem.

    – Antarr Byrd
    Mar 8 at 0:51











  • Hello - Thanks for the response. I am self-taught with respect to Ruby and Rails, so I am always learning. Some of the apparent globals ($docraptor) were in some of the documentation, but I will take it under advisement. Some things seemed to break when I left requires in the higher level of the class, but I will double check. Should some of this be in the controller? I was building this under the guidelines of a "thin controller" model. I'm not sure if that's best though. Comments have been removed accordingly. Thank you for your help!

    – ND Guthrie
    Mar 8 at 1:57











  • Heroku app: murmuring-chamber-54696.herokuapp.com

    – ND Guthrie
    Mar 8 at 2:00











  • I would advise opening rails console and trying to save a record with the same attributes you'd get from the controller. If there's an error look at the stack trace to determine what line it originated from. I'm afraid without this info this question is impossible to answer. I'm assuming that since you can call @url_data_model.save you have already initialized the record without error. None of the other model code actually gets run with the code you've shown

    – max pleaner
    Mar 8 at 9:53

















  • A couple (or four) things. First, you should probably put the whole stack trace in your question (it's often easier to get a sense of the error and where it might be coming from). Second, IMO you are significantly overloading the responsibility of that model. Third, it seems strange to have those require statements sprinkled throughout (and configure statements, too). Fourth, and finally, it looks like a global variable in there ($docraptor) which might not be a big deal but I personally never use.

    – jvillian
    Mar 8 at 0:29












  • Where is the code where you are actually initializing the model and saving it? Post it here please. And you should probably remove the comments in your code here, doesn't really help us to solve your problem.

    – Antarr Byrd
    Mar 8 at 0:51











  • Hello - Thanks for the response. I am self-taught with respect to Ruby and Rails, so I am always learning. Some of the apparent globals ($docraptor) were in some of the documentation, but I will take it under advisement. Some things seemed to break when I left requires in the higher level of the class, but I will double check. Should some of this be in the controller? I was building this under the guidelines of a "thin controller" model. I'm not sure if that's best though. Comments have been removed accordingly. Thank you for your help!

    – ND Guthrie
    Mar 8 at 1:57











  • Heroku app: murmuring-chamber-54696.herokuapp.com

    – ND Guthrie
    Mar 8 at 2:00











  • I would advise opening rails console and trying to save a record with the same attributes you'd get from the controller. If there's an error look at the stack trace to determine what line it originated from. I'm afraid without this info this question is impossible to answer. I'm assuming that since you can call @url_data_model.save you have already initialized the record without error. None of the other model code actually gets run with the code you've shown

    – max pleaner
    Mar 8 at 9:53
















A couple (or four) things. First, you should probably put the whole stack trace in your question (it's often easier to get a sense of the error and where it might be coming from). Second, IMO you are significantly overloading the responsibility of that model. Third, it seems strange to have those require statements sprinkled throughout (and configure statements, too). Fourth, and finally, it looks like a global variable in there ($docraptor) which might not be a big deal but I personally never use.

– jvillian
Mar 8 at 0:29






A couple (or four) things. First, you should probably put the whole stack trace in your question (it's often easier to get a sense of the error and where it might be coming from). Second, IMO you are significantly overloading the responsibility of that model. Third, it seems strange to have those require statements sprinkled throughout (and configure statements, too). Fourth, and finally, it looks like a global variable in there ($docraptor) which might not be a big deal but I personally never use.

– jvillian
Mar 8 at 0:29














Where is the code where you are actually initializing the model and saving it? Post it here please. And you should probably remove the comments in your code here, doesn't really help us to solve your problem.

– Antarr Byrd
Mar 8 at 0:51





Where is the code where you are actually initializing the model and saving it? Post it here please. And you should probably remove the comments in your code here, doesn't really help us to solve your problem.

– Antarr Byrd
Mar 8 at 0:51













Hello - Thanks for the response. I am self-taught with respect to Ruby and Rails, so I am always learning. Some of the apparent globals ($docraptor) were in some of the documentation, but I will take it under advisement. Some things seemed to break when I left requires in the higher level of the class, but I will double check. Should some of this be in the controller? I was building this under the guidelines of a "thin controller" model. I'm not sure if that's best though. Comments have been removed accordingly. Thank you for your help!

– ND Guthrie
Mar 8 at 1:57





Hello - Thanks for the response. I am self-taught with respect to Ruby and Rails, so I am always learning. Some of the apparent globals ($docraptor) were in some of the documentation, but I will take it under advisement. Some things seemed to break when I left requires in the higher level of the class, but I will double check. Should some of this be in the controller? I was building this under the guidelines of a "thin controller" model. I'm not sure if that's best though. Comments have been removed accordingly. Thank you for your help!

– ND Guthrie
Mar 8 at 1:57













Heroku app: murmuring-chamber-54696.herokuapp.com

– ND Guthrie
Mar 8 at 2:00





Heroku app: murmuring-chamber-54696.herokuapp.com

– ND Guthrie
Mar 8 at 2:00













I would advise opening rails console and trying to save a record with the same attributes you'd get from the controller. If there's an error look at the stack trace to determine what line it originated from. I'm afraid without this info this question is impossible to answer. I'm assuming that since you can call @url_data_model.save you have already initialized the record without error. None of the other model code actually gets run with the code you've shown

– max pleaner
Mar 8 at 9:53





I would advise opening rails console and trying to save a record with the same attributes you'd get from the controller. If there's an error look at the stack trace to determine what line it originated from. I'm afraid without this info this question is impossible to answer. I'm assuming that since you can call @url_data_model.save you have already initialized the record without error. None of the other model code actually gets run with the code you've shown

– max pleaner
Mar 8 at 9:53












0






active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55054793%2fmodel-initialization-passing-parameters-rails-5%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55054793%2fmodel-initialization-passing-parameters-rails-5%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Can't initialize raids on a new ASUS Prime B360M-A motherboard2019 Community Moderator ElectionSimilar to RAID config yet more like mirroring solution?Can't get motherboard serial numberWhy does the BIOS entry point start with a WBINVD instruction?UEFI performance Asus Maximus V Extreme

Identity Server 4 is not redirecting to Angular app after login2019 Community Moderator ElectionIdentity Server 4 and dockerIdentityserver implicit flow unauthorized_clientIdentityServer Hybrid Flow - Access Token is null after user successful loginIdentity Server to MVC client : Page Redirect After loginLogin with Steam OpenId(oidc-client-js)Identity Server 4+.NET Core 2.0 + IdentityIdentityServer4 post-login redirect not working in Edge browserCall to IdentityServer4 generates System.NullReferenceException: Object reference not set to an instance of an objectIdentityServer4 without HTTPS not workingHow to get Authorization code from identity server without login form

2005 Ahvaz unrest Contents Background Causes Casualties Aftermath See also References Navigation menue"At Least 10 Are Killed by Bombs in Iran""Iran"Archived"Arab-Iranians in Iran to make April 15 'Day of Fury'"State of Mind, State of Order: Reactions to Ethnic Unrest in the Islamic Republic of Iran.10.1111/j.1754-9469.2008.00028.x"Iran hangs Arab separatists"Iran Overview from ArchivedConstitution of the Islamic Republic of Iran"Tehran puzzled by forged 'riots' letter""Iran and its minorities: Down in the second class""Iran: Handling Of Ahvaz Unrest Could End With Televised Confessions""Bombings Rock Iran Ahead of Election""Five die in Iran ethnic clashes""Iran: Need for restraint as anniversary of unrest in Khuzestan approaches"Archived"Iranian Sunni protesters killed in clashes with security forces"Archived