Skip to content

Instantly share code, notes, and snippets.

@superlou
Created July 16, 2011 20:29
Show Gist options
  • Save superlou/1086741 to your computer and use it in GitHub Desktop.
Save superlou/1086741 to your computer and use it in GitHub Desktop.
Automatic join model not created
== Activity Model ==
has_many :rule_assignments, :dependent => :destroy # RuleAssignment has activity_id, and rule_type, rule_id
has_many :be_located_in_rules, :through => :rule_assignments, :source => :rule, :source_type => 'BeLocatedInRule'
== BeLocatedInRules Controller ==
def create
@rule = @activity.be_located_in_rules.build(params[:be_located_in_rule])
...
@rule.save # successfully create the BeLocatedInRule, but no join model (RuleAssignment)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment