A problem w/ association testing?

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!

DanielFischer.com wrote:

Parked at Loopia

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