> I run those code in terminal user_instance = User.find(1) => it shows me all 
the data in the User table and then i run  Picture.where(:album_id 
=> :album, :culture_id => user_instance.culture_id).first
> =>nil

As others have said, you are not providing enough information to diagnoise the 
problem.  Let's break it down.

Find the first user. Does it have a culture_id field?  What is it's value?

user = User.first

Find all the pictures associated with this user.  Are there any?  Do any have 
the same culture_id as the user?

Picture.where(:user => user)

I am guessing you have a particular album in mind, which collates various 
pictures (why are you using a symbol here?).  Does this album contain the 
picture with the "correct" culture_id?

Album.where(:user=> user, :album => album).pictures

If the answer to all these questions is "yes", then your code should work.  If 
not, it will tell you excactly where you have gone wrong.

-- 
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 [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to