Newbie to rails here and I am having a bit of an issue. I have the
class Topic < ActiveRecord::Base
validates_length_of :name, :minimum => 3
has_many :relationships, :through => :relationship_topics
class Relationship < ActiveRecord::Base
has_many :topics, :through => :relationship_topic
class RelationshipTopic < ActiveRecord::Base
validates_uniqueness_of :topic, :scope => :relationship
Now, here is example code of me trying to create a new
@rel = RelationshipTopic.new(:relationship_id => 1, :topic_id => 1)
=> #<RelationshipTopic id: nil, relationship_id: 1, topic_id: 1,
primary: nil, created_at: nil, updated_at: nil>
NoMethodError: You have a nil object when you didn’t expect it!
The error occurred while evaluating nil.text?
Why am I unable to use the .save method when creating
RelationshipTopics? Creating relationships and topics by itself works,
but I can’t get the join table to cooperate.