mirror of
https://github.com/ENSL/ensl.org.git
synced 2024-11-15 17:31:27 +00:00
22 lines
459 B
Ruby
22 lines
459 B
Ruby
class LocksController < ApplicationController
|
|
def create
|
|
@lock = Lock.new params[:lock]
|
|
raise AccessError unless @lock.can_create? cuser
|
|
|
|
if @lock.save
|
|
flash[:notice] = t(:topics_locked)
|
|
else
|
|
flash[:error] = @lock.errors.full_messages.to_s
|
|
end
|
|
|
|
redirect_to_back
|
|
end
|
|
|
|
def destroy
|
|
@lock = Lock.find params[:id]
|
|
raise AccessError unless @lock.can_destroy? cuser
|
|
|
|
@lock.destroy
|
|
redirect_to_back
|
|
end
|
|
end
|