Sha256: 9cdc4a93a8f341911d9646b45783a90baa24c59b4ce1a457ce82c6f0990fa32e

Contents?: true

Size: 705 Bytes

Versions: 9

Compression:

Stored size: 705 Bytes

Contents

class ApplicationController < ActionController::Base
  protect_from_forgery

  rescue_from CanCan::AccessDenied, :with => :render_403

  private
  def render_403
    return if performed?
    if user_signed_in?
      respond_to do |format|
        format.html {render :template => 'page/403', :status => 403}
        format.xml {render :template => 'page/403', :status => 403}
        format.json { render :text => '{"error": "forbidden"}' }
      end
    else
      respond_to do |format|
        format.html {redirect_to new_user_session_url}
        format.xml {render :template => 'page/403', :status => 403}
        format.json { render :text => '{"error": "forbidden"}' }
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
enju_export-0.1.1.pre4 spec/dummy/app/controllers/application_controller.rb
enju_export-0.1.1.pre3 spec/dummy/app/controllers/application_controller.rb
enju_export-0.1.1.pre2 spec/dummy/app/controllers/application_controller.rb
enju_export-0.1.1.pre spec/dummy/app/controllers/application_controller.rb
enju_export-0.1.0.pre spec/dummy/app/controllers/application_controller.rb
enju_export-0.1.0 spec/dummy/app/controllers/application_controller.rb
enju_export-0.0.3 spec/dummy/app/controllers/application_controller.rb
enju_export-0.0.2 spec/dummy/app/controllers/application_controller.rb
enju_export-0.0.1 spec/dummy/app/controllers/application_controller.rb