Related Models in Rails 3
Posted
by Jack
on Stack Overflow
See other posts from Stack Overflow
or by Jack
Published on 2010-06-12T15:47:31Z
Indexed on
2010/06/12
15:52 UTC
Read the original article
Hit count: 141
ruby-on-rails
Hi,
I am just starting my first Rails 3 project and am having some difficulties. I have two related models, projects
and clients
. I have set up the relationships as has_many and belongs_to. However in my projects
views I can only access the client_id
of the project
. I would like to access the client's name and other parameters.
I am sure that previously in rails, I could just use project.client.name
, but this is not working. Is there a new feature of Rails 3 that I have missed?
Cheers
© Stack Overflow or respective owner