Sha256: 0b8e7abb46b25ac879c663a0eb1eee86b019518f9015bda2b000d42e24624421

Contents?: true

Size: 1.46 KB

Versions: 35

Compression:

Stored size: 1.46 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 :template => 'page/403', :status => 403}
        format.mobile {render :template => 'page/403', :status => 403}
        format.xml {render :template => 'page/403', :status => 403}
        format.json
      end
    else
      respond_to do |format|
        format.html {redirect_to new_user_session_url}
        format.mobile {redirect_to new_user_session_url}
        format.xml {render :template => 'page/403', :status => 403}
        format.json
      end
    end
  end

  def render_404
    return if performed?
    respond_to do |format|
      format.html {render :template => 'page/404', :status => 404}
      format.mobile {render :template => 'page/404', :status => 404}
      format.xml {render :template => 'page/404', :status => 404}
      format.json
    end
  end

  def get_user
    @user = User.where(:username => params[:user_id]).first if params[:user_id]
  end

  def solr_commit
    Sunspot.commit
  end

  def move_position(resource, direction)
    if ['higher', 'lower'].include?(direction)
      resource.send("move_#{direction}")
      redirect_to url_for(:controller => resource.class.to_s.pluralize.underscore)
      return
    end
  end
end

Version data entries

35 entries across 35 versions & 2 rubygems

Version Path
enju_message-0.1.14.pre8 spec/dummy/app/controllers/application_controller.rb
enju_message-0.1.14.pre7 spec/dummy/app/controllers/application_controller.rb
enju_message-0.1.14.pre6 spec/dummy/app/controllers/application_controller.rb
enju_message-0.1.14.pre5 spec/dummy/app/controllers/application_controller.rb
enju_message-0.1.14.pre4 spec/dummy/app/controllers/application_controller.rb
enju_trunk_message-0.1.14.pre3 spec/dummy/app/controllers/application_controller.rb
enju_message-0.1.14.pre3 spec/dummy/app/controllers/application_controller.rb
enju_message-0.1.14.pre2 spec/dummy/app/controllers/application_controller.rb
enju_message-0.1.14.pre spec/dummy/app/controllers/application_controller.rb
enju_message-0.1.13 spec/dummy/app/controllers/application_controller.rb
enju_message-0.1.12 spec/dummy/app/controllers/application_controller.rb
enju_message-0.1.11 spec/dummy/app/controllers/application_controller.rb
enju_message-0.0.25 spec/dummy/app/controllers/application_controller.rb
enju_message-0.1.9 spec/dummy/app/controllers/application_controller.rb
enju_message-0.0.24 spec/dummy/app/controllers/application_controller.rb
enju_message-0.1.8 spec/dummy/app/controllers/application_controller.rb
enju_message-0.0.23 spec/dummy/app/controllers/application_controller.rb
enju_message-0.1.7 spec/dummy/app/controllers/application_controller.rb
enju_message-0.0.22 spec/dummy/app/controllers/application_controller.rb
enju_message-0.1.6 spec/dummy/app/controllers/application_controller.rb