Sha256: cca0a969161d4b8c402bb865d018337d46d1cfb90834cecee0a080a58f7282e6
Contents?: true
Size: 1.16 KB
Versions: 12
Compression:
Stored size: 1.16 KB
Contents
module Pageflow module EditLocking extend ActiveSupport::Concern included do rescue_from EditLock::NotHeldError, EditLock::HeldByOtherSessionError do |exception| respond_to do |format| format.html { redirect_to :back, :alert => t('edit_locks.required') } format.json do render(:status => :conflict, :json => { :error_message => exception.message, :error => exception.code }) end end end rescue_from EditLock::HeldByOtherUserError do |exception| respond_to do |format| format.html { redirect_to :back, :alert => t('edit_locks.required_but_held_by_other_user') } format.json do render(:status => :conflict, :json => { :error_message => exception.message, :error => exception.code, :held_by => exception.user.full_name }) end end end end protected def verify_edit_lock!(entry) entry.edit_lock.verify!(current_user, :id => request.headers['X-Edit-Lock']) end end end
Version data entries
12 entries across 12 versions & 1 rubygems