diff options
author | spag <spag@golwen.net> | 2013-02-12 15:53:49 +0100 |
---|---|---|
committer | spag <spag@golwen.net> | 2013-02-12 15:53:49 +0100 |
commit | 36d1a38594361dcd021c23ae9c5040a37d0918df (patch) | |
tree | 15ebad678743935103e441bc54609ef9c58801a4 /app/models/parking_stall.rb | |
parent | fbdb5dca9b3979010b87b16fcb3bf9410c453e91 (diff) |
make parking stall child of user/tenant
Diffstat (limited to 'app/models/parking_stall.rb')
-rw-r--r-- | app/models/parking_stall.rb | 14 |
1 files changed, 14 insertions, 0 deletions
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 |