Require that a Rate be unlocked before saving it. #1919
This commit is contained in:
@@ -6,6 +6,8 @@ class Rate < ActiveRecord::Base
|
||||
validates_presence_of :user_id
|
||||
validates_presence_of :date_in_effect
|
||||
|
||||
before_save :unlocked?
|
||||
|
||||
named_scope :history_for_user, lambda { |user|
|
||||
{
|
||||
:conditions => { :user_id => user.id },
|
||||
@@ -16,4 +18,8 @@ class Rate < ActiveRecord::Base
|
||||
def locked?
|
||||
return self.time_entries.length > 0
|
||||
end
|
||||
|
||||
def unlocked?
|
||||
return !self.locked?
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user