ensl.org/app/controllers/locks_controller.rb
Ari Timonen e59e8ac8e7 Lots of rails 4 updates
- Add .params to models and update controllers
- Add afk time to gather
- Reannotate models
- Fix rspec problem by using latest rspec plugins from github
2020-03-18 05:38:17 +02:00

22 lines
473 B
Ruby

class LocksController < ApplicationController
def create
@lock = Lock.new(Lock.params(params, cuser))
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