Class: Pageflow::EditLocksController

Inherits:
ApplicationController show all
Defined in:
app/controllers/pageflow/edit_locks_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject


7
8
9
10
11
12
13
# File 'app/controllers/pageflow/edit_locks_controller.rb', line 7

def create
  entry = Entry.find(params[:entry_id])
  authorize!(:edit, entry)
  entry.edit_lock.aquire(current_user, edit_lock_params)
  entry.snapshot(:creator => current_user)
  respond_with(entry.reload.edit_lock, :location => entry_edit_lock_url(entry))
end

#destroyObject


22
23
24
25
26
# File 'app/controllers/pageflow/edit_locks_controller.rb', line 22

def destroy
  entry = Entry.find(params[:entry_id])
  entry.edit_lock.release(current_user)
  head :no_content
end

#updateObject


15
16
17
18
19
20
# File 'app/controllers/pageflow/edit_locks_controller.rb', line 15

def update
  entry = Entry.find(params[:entry_id])
  authorize!(:edit, entry)
  entry.edit_lock.aquire(current_user, edit_lock_params)
  head :no_content
end