I kept having that problem, too. I solved it (hacked my way to
something that works, actually) by ensuring that the *children
:model_name* line was in the same model that had the *has_many
:model_name line.*
I don't know why this worked, and I could swear that I started with that
configuration at the beginning and got the dreaded
"undefinedmethod`class_name' fornil:NilClass"
message.
There might be a chicken vs. egg problem here. I think you might want
to try commenting out the *children* line, run the migration, then
uncomment the *children* line. I've had that fix other things in Hobo
in the past, but I don't remember if that helped in this case. It's
worth a try.
Here is the applicable code from a working app:
class NewAgent < ActiveRecord::Base
snip...
has_many :phone_numbers
has_many :new_agent_documents
children :new_agent_documents, :phone_numbers
snip...
end
class PhoneNumber < ActiveRecord::Base
hobo_model # Don't put anything above this
fields do
number :string, :required
timestamps
end
belongs_to :new_agent
snip...
end
Don Ziesig
On 1/19/2011 4:29 PM, Bilal Ahmed wrote:
I am running into the same issue. Any help would be greatly
appreciated!
On Jan 18, 2:07 am, Vadim Lazuko<[email protected]> wrote:
I'm going through rapid-rails-3-with-hobo-2011-01-10-draft-up-to-
tutorial-21.pdf creating similar project with some small changes.
After creation Recipe connected to Ingredients with one-to-many
relation through ingredient_assignments table I was trying to extend
the Ingredient model with "children :recipes" line.
This resulted in "undefinedmethod`class_name' fornil:NilClass"
error which later prevent all tasks (rails server, hobo g migrate)
from execution.
If I comment "children :recipes" out - I'm able to start server, but I
don't have required functionality.
Where do you recommend to check for an error to fix this?
--
You received this message because you are subscribed to the Google Groups "Hobo
Users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/hobousers?hl=en.