Skip to content

Instantly share code, notes, and snippets.

@MhdSyrwan
Created May 5, 2015 07:09
Show Gist options
  • Save MhdSyrwan/33c0d4e5ee89a083ad43 to your computer and use it in GitHub Desktop.
Save MhdSyrwan/33c0d4e5ee89a083ad43 to your computer and use it in GitHub Desktop.
Many-2-Many
class LoanProcess < ActiveRecord::Base
  has_many :loan_process_item_types
  has_many :item_type, through: :loan_process_item_types
end
 
class LoanProcessItemType < ActiveRecord::Base
  belongs_to :assembly
  belongs_to :part
end
 
class ItemType < ActiveRecord::Base
  has_many :loan_process_item_types
  has_many :loan_processes, through: :loan_process_item_types
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment