Guest User

Untitled

a guest
May 22nd, 2018
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. class MaterialFeature < ActiveRecord::Base
  2. has_many :materials
  3. has_many :material_names, :through=>:materials
  4. end
  5.  
  6.  
  7. class MaterialName < ActiveRecord::Base
  8. has_many :materials
  9. has_many :material_features, :through=>:materials
  10. end
  11.  
  12.  
  13.  
  14. #essa tabela Material é o resultado do relacionamento N<>N entre as tabelas MaterialFeature e MaterialName
  15. class Material < ActiveRecord::Base
  16. belongs_to :material_name
  17. belongs_to :material_feature
  18. end
Add Comment
Please, Sign In to add comment