search for: guestmessage

Displaying 1 result from an estimated 1 matches for "guestmessage".

Did you mean: getmessage
2008 Feb 11
1
STI question
...In my application, a message may be written by a user or by a guest. Thus a writer of a message is virtually associated either to a user or a guest. class Message < ActiveRecord::Base end class UserMessage < Message belongs_to :writer, :class_name => ''User'' end class GuestMessage < Message belongs_to :writer, :class_name => ''Guest'' end When I retrieve a list of messages, I want to include writer association for performance. messages = Message.find :all, :include => [:writer] # This doesn''t work. How can I make the above code work? If...