I have 3 models: Question, Option, Rule
Question has_many options; Option needs a foreign key for question_id
Rule table consists of 3 foreign_keys:
You can set a foreign key in your model like this:
class Leaf < ActiveRecord::Base belongs_to :tree, :foreign_key => "leaf_code" end
You do not need to specify this in a migration, rails will pull the foreign key from the model class definition.