Displaying 1 result from an estimated 1 matches for "relationshiptopic".
2009 Oct 15
2
Model.Save causing nil object error
...nce_of :name
validates_length_of :name, :minimum => 3
has_many :relationship_topics
has_many :relationships, :through => :relationship_topics
end
class Relationship < ActiveRecord::Base
has_many :relationship_topics
has_many :topics, :through => :relationship_topic
end
class RelationshipTopic < ActiveRecord::Base
validates_uniqueness_of :topic, :scope => :relationship
belongs_to :relationship
belongs_to :topic
end
Now, here is example code of me trying to create a new
RelationshipTopic:
@rel = RelationshipTopic.new(:relationship_id => 1, :topic_id => 1)
=> #<...