ability to track resources used in conference
This commit is contained in:
parent
945b4aac60
commit
3065766da9
17 changed files with 281 additions and 2 deletions
10
app/models/resource.rb
Normal file
10
app/models/resource.rb
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
class Resource < ActiveRecord::Base
|
||||
belongs_to :conference
|
||||
validate :used_less_than_quantity
|
||||
|
||||
private
|
||||
|
||||
def used_less_than_quantity
|
||||
errors.add(:used, 'can not be higher than total quantity') unless used <= quantity
|
||||
end
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue