From 902447a1baf7e9d8385c269a601361c8c3f2f14b Mon Sep 17 00:00:00 2001 From: Peter Kozak Date: Tue, 12 Feb 2013 13:07:05 +0000 Subject: parking_stall added --- app/models/parking_stall.rb | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 app/models/parking_stall.rb (limited to 'app/models/parking_stall.rb') diff --git a/app/models/parking_stall.rb b/app/models/parking_stall.rb new file mode 100644 index 0000000..52223a8 --- /dev/null +++ b/app/models/parking_stall.rb @@ -0,0 +1,3 @@ +class ParkingStall < ActiveRecord::Base + attr_accessible :name, :lot, :parking_stallable_id, :parking_stallable_type, :comment +end -- cgit v1.2.3 From 36d1a38594361dcd021c23ae9c5040a37d0918df Mon Sep 17 00:00:00 2001 From: spag Date: Tue, 12 Feb 2013 15:53:49 +0100 Subject: make parking stall child of user/tenant --- app/models/parking_stall.rb | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'app/models/parking_stall.rb') diff --git a/app/models/parking_stall.rb b/app/models/parking_stall.rb index 52223a8..6af1fcd 100644 --- a/app/models/parking_stall.rb +++ b/app/models/parking_stall.rb @@ -1,3 +1,17 @@ class ParkingStall < ActiveRecord::Base attr_accessible :name, :lot, :parking_stallable_id, :parking_stallable_type, :comment + + belongs_to :parking_stallable, :polymorphic => true, :touch => true + + validates :name, + :presence => true, + :uniqueness => true + + validates :lot, + :presence => true + + def to_s + name.to_s + end + end -- cgit v1.2.3