Skip to content

Commit

Permalink
add namespaced models
Browse files Browse the repository at this point in the history
  • Loading branch information
Rob Jacoby committed Jul 31, 2014
1 parent 2886f91 commit 7bbca78
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions spec/models.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,24 @@ class Store < ActiveRecord::Base
has_many :products
end

module Inventory
end

class Inventory::ProductFeature < ActiveRecord::Base
actable
validates_presence_of :name, :price

def present
"#{name} - $#{price}"
end
end

class Inventory::PenLid < ActiveRecord::Base
acts_as :product_feature

validates_presence_of :color
end

initialize_database do
create_table :pens do |t|
t.string :color
Expand All @@ -36,4 +54,14 @@ class Store < ActiveRecord::Base
create_table :stores do |t|
t.string :name
end

create_table :inventory_pen_lids do |t|
t.string :color
end

create_table :inventory_product_features do |t|
t.string :name
t.float :price
t.actable
end
end

0 comments on commit 7bbca78

Please sign in to comment.