Skip to content

Instantly share code, notes, and snippets.

@m4tthumphrey
Created January 20, 2013 11:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save m4tthumphrey/4577958 to your computer and use it in GitHub Desktop.
Save m4tthumphrey/4577958 to your computer and use it in GitHub Desktop.
class Product < ActiveRecord::Base
belongs_to :company
has_many :features,
:class_name => 'ProductFeature',
:source => :product_feature,
:include => :feature
attr_accessible :description,
:name,
:company
validates :company,
:presence => true
end
class ProductFeature < ActiveRecord::Base
belongs_to :product
belongs_to :feature
delegate :name,
:to => :feature
attr_accessible :value
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment