Sha256: c4347c3cc0c8df24ad99aa6706e4a5d6242d8655a9081c2104940c831ace7277

Contents?: true

Size: 610 Bytes

Versions: 1

Compression:

Stored size: 610 Bytes

Contents

module Flyboy
  class ApplicationController < ::ApplicationController
    layout "application"

    helper Dorsale::AllHelpers

    # Cross-engine polymorphic_path
    # TODO : Export to Dorsale ?
    def engine_polymorphic_path(obj)
      if obj.class.parent == Object
        routes = main_app
      else
        routes = obj.class.parent::Engine.routes
      end

      routes.url_for(
        :controller => obj.class.model_name.collection,
        :action     => :show,
        :id         => obj.to_param,
        :only_path  => true
      )
    end

    helper_method :engine_polymorphic_path
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
flyboy-1.1.0 app/controllers/flyboy/application_controller.rb