Sha256: d413f7da8c1a0c1d5bffad0d8d6ca68a1033d0b5a9412a975352297f1377baa3

Contents?: true

Size: 450 Bytes

Versions: 1

Compression:

Stored size: 450 Bytes

Contents

module Dorsale
  module RoutesHelper
    def engine_polymorphic_path(obj, opts = {})
      if obj.class.parent == Object
        routes = main_app
      else
        routes = obj.class.parent::Engine.routes
      end

      opts = {
        :controller => obj.class.model_name.collection,
        :action     => :show,
        :id         => obj.to_param,
        :only_path  => true
      }.merge(opts)

      routes.url_for(opts)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
dorsale-1.2.6 app/helpers/dorsale/routes_helper.rb