I can''t think of any reason for that to not work other than that you
have
mistakenly used a bad field name... ie cms_page.name is not a valid
reference. If you can reference menu.cms_page at all, then it should be
returning a full AR model, and you should be able to use it like any other
model.
If you could include the class definitions and maybe table definitions,
might be able to help more.
On 3/9/07, claudio
<rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>
wrote:>
>
> I have two tables cms_pages and cms_menus
> cms_menus has a foreign key to cms_pages.id so when i create a new link
> i can
> releate to a page.
> Insert is fine, but when i do a list of cms_menus and i want to know the
> page name
> i just put menu.cms_page.name but i get an error that cms_page is nil,
> now
> what is driving me crazy is the fact that if i do an
> menu.cms_page.inspect i have all the information of that page. I tried
> with
> menu.cms_page[:name]
> menu.cms_page[''name'']
> menu.cms_page.name
>
> NOTHING, all the ohters models releation works fine why i have this
> here!!!!1
> Thanks
> claudio
>
> --
> Posted via http://www.ruby-forum.com/.
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---