DanielFischer.com wrote:> http://pastie.caboo.se/67535
>
> I have a problem w/ my associations, you can look at it on my pastie
> up above.
>
> Please help me out, thanks!
SQLite tells you:
no such column: messages.user_id
As far as I can tell you only have author_id and recipient_id in the
messages table. So what you need to do is to change your User model from
has_many :messages to has_many :incoming_messages and has_many
:outgoing_messages or whatever and hook it up with the corresponding
foreign keys and classes just like you do in the Message model.
If you want to find all messages you could:
class User
def messages
incoming_messages + outgoing_messages
end
end
--
Cheers,
- Jacob Atzen
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---