Sha256: 1787541ea7e5f21513a91ea05883158e2b954f2b3ea3aca2820c03a11bd4da73
Contents?: true
Size: 612 Bytes
Versions: 2
Compression:
Stored size: 612 Bytes
Contents
require 'database_helper' require 'active_record/acts_as' class Product < ActiveRecord::Base actable belongs_to :store validates_presence_of :name, :price def present "#{name} - $#{price}" end end class Pen < ActiveRecord::Base acts_as :product validates_presence_of :color end class Store < ActiveRecord::Base has_many :products end initialize_database do create_table :pens do |t| t.string :color end create_table :products do |t| t.string :name t.float :price t.integer :store_id t.actable end create_table :stores do |t| t.string :name end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
active_record-acts_as-1.0.0.rc | spec/models.rb |
active_record-acts_as-1.0.0.pre | spec/models.rb |