Class: Flyboy::ApplicationController

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controllers/flyboy/application_controller.rb

Instance Method Summary collapse

Instance Method Details

#engine_polymorphic_path(obj) ⇒ Object

Cross-engine polymorphic_path TODO : Export to Dorsale ?



9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'app/controllers/flyboy/application_controller.rb', line 9

def engine_polymorphic_path(obj)
  if obj.class.parent == Object
    routes = main_app
  else
    routes = obj.class.parent::Engine.routes
  end

  routes.url_for(
    :controller => obj.class.model_name.collection,
    :action     => :show,
    :id         => obj.to_param,
    :only_path  => true
  )
end