Sha256: bb9345ea30f161200fc4c8b6d26e2d4268fc1a25a62012705d10629bde6409ad

Contents?: true

Size: 574 Bytes

Versions: 4

Compression:

Stored size: 574 Bytes

Contents

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

    private

    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

4 entries across 4 versions & 1 rubygems

Version Path
type_station-0.0.3 app/controllers/type_station/application_controller.rb
type_station-0.0.2 app/controllers/type_station/application_controller.rb
type_station-0.0.1 app/controllers/type_station/application_controller.rb
type_station-0.0.1.pre app/controllers/type_station/application_controller.rb