Sha256: e58e5697ec2ccd6dbd0b3fc9e18a9945b12f0141f2d510174594cd9532bd33b9

Contents?: true

Size: 418 Bytes

Versions: 10

Compression:

Stored size: 418 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

10 entries across 10 versions & 1 rubygems

Version Path
agilibox-1.0.9 app/helpers/agilibox/routes_helper.rb
agilibox-1.0.8 app/helpers/agilibox/routes_helper.rb
agilibox-1.0.7 app/helpers/agilibox/routes_helper.rb
agilibox-1.0.6 app/helpers/agilibox/routes_helper.rb
agilibox-1.0.5 app/helpers/agilibox/routes_helper.rb
agilibox-1.0.4 app/helpers/agilibox/routes_helper.rb
agilibox-1.0.3 app/helpers/agilibox/routes_helper.rb
agilibox-1.0.2 app/helpers/agilibox/routes_helper.rb
agilibox-1.0.1 app/helpers/agilibox/routes_helper.rb
agilibox-1.0.0 app/helpers/agilibox/routes_helper.rb