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.2.2 app/helpers/agilibox/routes_helper.rb
agilibox-1.2.1 app/helpers/agilibox/routes_helper.rb
agilibox-1.2.0 app/helpers/agilibox/routes_helper.rb
agilibox-1.1.0 app/helpers/agilibox/routes_helper.rb
agilibox-1.0.15 app/helpers/agilibox/routes_helper.rb
agilibox-1.0.14 app/helpers/agilibox/routes_helper.rb
agilibox-1.0.13 app/helpers/agilibox/routes_helper.rb
agilibox-1.0.12 app/helpers/agilibox/routes_helper.rb
agilibox-1.0.11 app/helpers/agilibox/routes_helper.rb
agilibox-1.0.10 app/helpers/agilibox/routes_helper.rb