Sha256: 13a4b22a6be61fa06f69db4640fde41b63261e63df30e776fc12b931409553b7

Contents?: true

Size: 670 Bytes

Versions: 2

Compression:

Stored size: 670 Bytes

Contents

module TypeStation
  class ApplicationController < ActionController::Base
    rescue_from TypeStation::PageNotFoundError, :with => :page_not_found

    private

    def type_station_current_user
      instance_eval &TypeStation.config.current_user
    end

    def page_not_found
      render file: "#{Rails.root}/public/404.html", layout: false, status: 404 and return
    end

    def present(object, klass = nil)
      if object.present?
        object_class = object.class.to_s.gsub(/TypeStation::/, '')
        klass ||= "TypeStation::#{object_class}Presenter".constantize
        klass.new(object, view_context)
      else
        nil
      end
    end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
type_station-0.1.3 app/controllers/type_station/application_controller.rb
type_station-0.1.1 app/controllers/type_station/application_controller.rb