JohnSalzarulo
JohnSalzarulo

Reputation: 1126

Rails new Method works in console, fails in controller and browser

I am attempting to invoke a .new on the following model:

class Callback < ActiveRecord::Base
    belongs_to :customer
    has_one :servicetime 
end

I can call this method with no issue from my console, however within a separate controller for my customers it is telling me that I have the "Wrong number of arguments" and errors out.

Does anyone have any suggestions on how one might go about researching what would cause something to behave so differently in the console than the controller / browser?

Any suggestions appreciated.

Upvotes: 1

Views: 181

Answers (2)

Ben
Ben

Reputation: 118

Just a guess, but you might have a name collision with "Callback" since the very same word is used as a ruby/rails callback. Try to rename the model to "MyCallback" or similar.

=> Just experienced something similar with a model by the name of "Case". Also very strange behaviour.

Upvotes: 1

Don Lee
Don Lee

Reputation: 463

As you said, I don't see anything wrong here. Should check controller on your customers for sure all thing are correct.

Upvotes: 2

Related Questions