I your User model, this line should be present for polymorphic relationships class User has_many :messages has_many :mentions, :as => :mentionable end And try this: user_id = 10 @messages = Message. Find(:all, :joins => :mentions, :conditions => 'messages. User_id =?', user_id).
I your User model, this line should be present for polymorphic relationships. Class User has_many :messages has_many :mentions, :as => :mentionable end And try this: user_id = 10 @messages = Message. Find(:all, :joins => :mentions, :conditions => 'messages.
User_id =? ', user_id).
Or if you're using rails3 go with Message. Joins(:mentions). Where(:user_id => user_id), haven't played around with that much so you might have to change the where clause to .
Where("messages. User_id =? ", user_id) if you get an ambiguous column name error from your database.
Not 100% sure how rails handles the hash syntax in . Where – nzifnab Mar 11 at 5:09 That's exactly what I needed. Thanks much.
– Adam Rubin Mar 12 at 21:45.
I'm not sure if I'm using it correctly, but I used the polymorphic relationship in Mention because mentionable_type could be 'User' or 'Group'. I've left the Group stuff out of this post as it's not related to this question. When a user creates a Message, their user_id is stored in the messages table.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.