Sha256: f65a66cf576043f368c68996093c6c6bc50697b21a0b69f87e9dcd5e1848d8f4

Contents?: true

Size: 518 Bytes

Versions: 20

Compression:

Stored size: 518 Bytes

Contents

module BMC::RoutesHelper
  def engine_polymorphic_path(obj, opts = {})
    if Rails::VERSION::STRING >= "6.0.0"
      engine = obj.class.module_parents[-2]
    else
      engine = obj.class.parents[-2]
    end

    if engine.nil?
      routes = main_app
    else
      routes = engine::Engine.routes
    end

    opts = {
      :controller => "/#{obj.class.to_s.tableize}",
      :action     => :show,
      :id         => obj.to_param,
      :only_path  => true,
    }.merge(opts)

    routes.url_for(opts)
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
bmc-1.6.2 app/helpers/bmc/routes_helper.rb
bmc-1.6.1 app/helpers/bmc/routes_helper.rb
bmc-1.6.0 app/helpers/bmc/routes_helper.rb
bmc-1.5.1 app/helpers/bmc/routes_helper.rb
bmc-1.5.0 app/helpers/bmc/routes_helper.rb
bmc-1.4.3 app/helpers/bmc/routes_helper.rb
bmc-1.4.2 app/helpers/bmc/routes_helper.rb
bmc-1.4.1 app/helpers/bmc/routes_helper.rb
bmc-1.4.0 app/helpers/bmc/routes_helper.rb
bmc-1.3.5 app/helpers/bmc/routes_helper.rb
bmc-1.3.4 app/helpers/bmc/routes_helper.rb
bmc-1.3.3 app/helpers/bmc/routes_helper.rb
bmc-1.3.2 app/helpers/bmc/routes_helper.rb
bmc-1.3.1 app/helpers/bmc/routes_helper.rb
bmc-1.3.0 app/helpers/bmc/routes_helper.rb
bmc-1.2.1 app/helpers/bmc/routes_helper.rb
bmc-1.2.0 app/helpers/bmc/routes_helper.rb
bmc-1.1.0 app/helpers/bmc/routes_helper.rb
bmc-1.0.1 app/helpers/bmc/routes_helper.rb
bmc-1.0.0 app/helpers/bmc/routes_helper.rb