Sha256: b9a7d95e2df920810d46e293490fc793be174f3a2a004aad4882e0a5148b6898

Contents?: true

Size: 419 Bytes

Versions: 50

Compression:

Stored size: 419 Bytes

Contents

module Agilibox::RoutesHelper
  def engine_polymorphic_path(obj, opts = {})
    engine = obj.class.parents[-2]

    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

50 entries across 50 versions & 1 rubygems

Version Path
agilibox-1.5.6 app/helpers/agilibox/routes_helper.rb
agilibox-1.5.5 app/helpers/agilibox/routes_helper.rb
agilibox-1.5.4 app/helpers/agilibox/routes_helper.rb
agilibox-1.5.3 app/helpers/agilibox/routes_helper.rb
agilibox-1.5.2 app/helpers/agilibox/routes_helper.rb
agilibox-1.5.1 app/helpers/agilibox/routes_helper.rb
agilibox-1.5.0 app/helpers/agilibox/routes_helper.rb
agilibox-1.4.4 app/helpers/agilibox/routes_helper.rb
agilibox-1.4.3 app/helpers/agilibox/routes_helper.rb
agilibox-1.4.2 app/helpers/agilibox/routes_helper.rb
agilibox-1.4.1 app/helpers/agilibox/routes_helper.rb
agilibox-1.4.0 app/helpers/agilibox/routes_helper.rb
agilibox-1.3.6 app/helpers/agilibox/routes_helper.rb
agilibox-1.3.5 app/helpers/agilibox/routes_helper.rb
agilibox-1.3.4 app/helpers/agilibox/routes_helper.rb
agilibox-1.3.3 app/helpers/agilibox/routes_helper.rb
agilibox-1.3.2 app/helpers/agilibox/routes_helper.rb
agilibox-1.3.1 app/helpers/agilibox/routes_helper.rb
agilibox-1.3.0 app/helpers/agilibox/routes_helper.rb
agilibox-1.2.3 app/helpers/agilibox/routes_helper.rb