app/controllers/flyboy/application_controller.rb in flyboy-1.0.7 vs app/controllers/flyboy/application_controller.rb in flyboy-1.1.0
- old
+ new
@@ -1,11 +1,26 @@
module Flyboy
class ApplicationController < ::ApplicationController
- def current_ability
- ::Flyboy::Ability.new
- end
-
layout "application"
helper Dorsale::AllHelpers
+
+ # Cross-engine polymorphic_path
+ # TODO : Export to Dorsale ?
+ 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
+
+ helper_method :engine_polymorphic_path
end
end