Sha256: dd5a92be2b1fd1b631452f1de213ef75ce4b44b3d1b91b71d77048f4ef816e5b

Contents?: true

Size: 523 Bytes

Versions: 22

Compression:

Stored size: 523 Bytes

Contents

module Agilibox::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

22 entries across 22 versions & 1 rubygems

Version Path
agilibox-2.0.0 app/helpers/agilibox/routes_helper.rb
agilibox-1.11.0 app/helpers/agilibox/routes_helper.rb
agilibox-1.10.5 app/helpers/agilibox/routes_helper.rb
agilibox-1.10.2 app/helpers/agilibox/routes_helper.rb
agilibox-1.10.1 app/helpers/agilibox/routes_helper.rb
agilibox-1.10.0 app/helpers/agilibox/routes_helper.rb
agilibox-1.9.20 app/helpers/agilibox/routes_helper.rb
agilibox-1.9.19 app/helpers/agilibox/routes_helper.rb
agilibox-1.9.18 app/helpers/agilibox/routes_helper.rb
agilibox-1.9.17 app/helpers/agilibox/routes_helper.rb
agilibox-1.9.16 app/helpers/agilibox/routes_helper.rb
agilibox-1.9.15 app/helpers/agilibox/routes_helper.rb
agilibox-1.9.14 app/helpers/agilibox/routes_helper.rb
agilibox-1.9.13 app/helpers/agilibox/routes_helper.rb
agilibox-1.9.12 app/helpers/agilibox/routes_helper.rb
agilibox-1.9.11 app/helpers/agilibox/routes_helper.rb
agilibox-1.9.10 app/helpers/agilibox/routes_helper.rb
agilibox-1.9.9 app/helpers/agilibox/routes_helper.rb
agilibox-1.9.8 app/helpers/agilibox/routes_helper.rb
agilibox-1.9.7 app/helpers/agilibox/routes_helper.rb