Created
April 26, 2012 06:05
-
-
Save releu/2496437 to your computer and use it in GitHub Desktop.
Inverse of doesn't work.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Communication::Message < ActiveRecord::Base | |
belongs_to :conversation_for_proposal, { | |
:class_name => 'Communication::Conversation::ForProposal', | |
:foreign_key => :conversation_id, | |
:inverse_of => :messages_for_proposal | |
} | |
end | |
class Communication::Conversation::ForProposal < ActiveRecord::Base | |
has_many :messages_for_proposal, { | |
:class_name => 'Communication::Message', | |
:foreign_key => :conversation_id, | |
:inverse_of => :conversation_for_proposal | |
} | |
end | |
Communication::Message.new.build_conversation_for_proposal | |
.messages_for_proposal == [] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment