Sha256: cd0ac42fb88712e2a1d988c17626bb903a2978a0c99fca61c109e2e964aaa98c

Contents?: true

Size: 1.35 KB

Versions: 3

Compression:

Stored size: 1.35 KB

Contents

class ApplicationController < ActionController::Base
  protect_from_forgery
  rescue_from CanCan::AccessDenied, :with => :render_403
  rescue_from ActiveRecord::RecordNotFound, :with => :render_404

  private
  def render_403
    return if performed?
    if user_signed_in?
      respond_to do |format|
        format.html {render :file => "#{Rails.root}/public/404.html", :status => 403}
        format.xml
        format.json
      end
    else
      respond_to do |format|
        format.html {redirect_to new_user_session_url}
        format.xml  {render :status => 403}
        format.json
      end
    end
  end

  def render_404
    return if performed?
    respond_to do |format|
      format.html {render :file => "#{Rails.root}/public/404.html", :status => 404}
      format.xml
      format.json
    end
  end

  def get_work
    @work = Manifestation.find(params[:work_id]) if params[:work_id]
    authorize! :show, @work if @work
  end

  def get_subject_heading_type
    @subject_heading_type = SubjectHeadingType.find(params[:subject_heading_type_id]) if params[:subject_heading_type_id]
  end

  def get_subject
    @subject = Subject.find(params[:subject_id]) if params[:subject_id]
  end

  def get_classification
    @classification = Classification.find(params[:classification_id]) if params[:classification_id]
  end

  def solr_commit
    Sunspot.commit
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
enju_subject-0.0.6 spec/dummy/app/controllers/application_controller.rb
enju_subject-0.0.5 spec/dummy/app/controllers/application_controller.rb
enju_subject-0.0.4 spec/dummy/app/controllers/application_controller.rb