On Tue, Oct 21, 2008 at 11:06 AM, sukury47
<sukury47-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> <% for reserve in @plan.reserves %>
>
> This line make error like this ''uninitialized constant
Plan::Reserf''
>
> I already have plan and reserve model
> and I define their relationship.
>
> plan
> has_many :reserves
>
> reserve
> belongs_to :plan
>
> why does this error happen?
First, check that your models are defined correctly.
* a Plan class defined in app/models/plan.rb
class Plan < ActiveRecord::Base
has_many :reserves
end
* a Reserve class defined in app/models/reserve.rb
class Reserve < ActiveRecord::Base
belongs_to :plan
end
Second, check the spelling: Reserf should be Reserve. Third, make sure that
you do NOT define Reserve with a Plan namespace
class Plan::Reserve < ActiveRecord::Base
belongs_to :plan
end
If you''ve defined Reserve like this, change it to the one shown above.
Those are some ideas for why you might be receiving that error. Please let
us know if any of them help.
Regards,
Craig
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---