Skip to content

Commit

Permalink
Adding callbacks to prevent updating or deleting a locked event.
Browse files Browse the repository at this point in the history
  • Loading branch information
aeschright committed Feb 8, 2015
1 parent 46bf550 commit 4c6a6d2
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions app/models/event.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ class Event < ActiveRecord::Base

validates :title, :description, :url, blacklist: true

before_update :verify_lock_status
before_destroy :verify_lock_status

# Duplicates
include DuplicateChecking
duplicate_checking_ignores_attributes :source_id, :version, :venue_id
Expand Down Expand Up @@ -220,4 +223,8 @@ def end_time_later_than_start_time
errors.add(:end_time, "cannot be before start")
end
end

def verify_lock_status
return false if locked
end
end

0 comments on commit 4c6a6d2

Please sign in to comment.