Rails3 newbie - Question regarding multiple joins and finder methods

Hello all

I’ve encountered a weird difficulty…I wonder what am I doing wrong…

I have three models:
The User has many assignments and each assignments belongs to Idea.
I have also defined has many through relations on User (ideas) and on
Idea (users) – through assignments…

The database is populated with the needed data…

I am using this to query the models…
@out = User.joins(:ideas,:assignments =>
[:user,:idea]).includes(:ideas,:assignments => [:user,:idea]).find(1)

The result contains a User object with ideas array (has_many) with one
Idea object but its empty (all attributes are nil)… It also
contains an assignments array (has_many) with one Assignment object
but the reference to the Idea (belongs_to) is null… (user_id,idea_id
do exist and have correct value)
It is like the join is not performed…

BTW- The console shows that the JOIN is performed.

What is wrong?

Thanks in advance

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs