Sha256: 768ea1f67ca023a09a0479220ad7896cc7fe0b13c2d604605f4d2980d02d9edc
Contents?: true
Size: 1.17 KB
Versions: 34
Compression:
Stored size: 1.17 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('pageflow.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('pageflow.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
34 entries across 34 versions & 1 rubygems