Skip to content

Commit

Permalink
Removing before_update hook on events to check lock status, because i…
Browse files Browse the repository at this point in the history
…t appears to conflict with version tracking.
  • Loading branch information
aeschright committed Feb 15, 2015
1 parent 9c88ca7 commit f935f20
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
4 changes: 2 additions & 2 deletions app/controllers/admin_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ def events

def lock_event
@event = Event.find(params[:event_id])
if @event.locked
if @event.locked?
@event.unlock_editing!
flash[:success] = "Unlocked event #{@event.title} (#{@event.id})"
flash[:success] = "Unlocked event #{@event.title} (#{@event.id})"
else
@event.lock_editing!
flash[:success] = "Locked event #{@event.title} (#{@event.id})"
Expand Down
3 changes: 1 addition & 2 deletions app/models/event.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ class Event < ActiveRecord::Base

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

before_update :verify_lock_status
before_destroy :verify_lock_status

# Duplicates
Expand Down Expand Up @@ -225,6 +224,6 @@ def end_time_later_than_start_time
end

def verify_lock_status
return false if locked
return !locked
end
end
2 changes: 1 addition & 1 deletion db/migrate/20150207231355_add_locked_status_to_events.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
class AddLockedStatusToEvents < ActiveRecord::Migration
def change
add_column :events, :locked, :boolean
add_column :events, :locked, :boolean, :default => false
end
end

0 comments on commit f935f20

Please sign in to comment.