features = Product.featuresSo it returns:
[id: 1, name: 'Colour', value: 'Blue']
[id: 2, name: 'Size', value: 'M']
[id: 3, name: 'Shape', value: 'Round']| class Feature < ActiveRecord::Base | |
| has_many :product_features | |
| has_many :products, :through => :product_features | |
| attr_accessible :name | |
| end |
| class Product < ActiveRecord::Base | |
| belongs_to :company | |
| has_many :product_features | |
| has_many :features, :through => :product_features | |
| attr_accessible :description, :name, :company | |
| validates :company, :presence => true | |
| end |
| class ProductFeature < ActiveRecord::Base | |
| belongs_to :product | |
| belongs_to :feature | |
| attr_accessible :value | |
| end |