Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fix to be totally agnostic.

  • Loading branch information...
commit c35fb0279c0d9bc79afdf24046ee1816c2985a75 1 parent d03bcda
@nmerouze nmerouze authored
Showing with 11 additions and 8 deletions.
  1. +11 −8 rails/init.rb
View
19 rails/init.rb
@@ -1,12 +1,15 @@
File.join(File.dirname(__FILE__), "../lib/agnostic_presenters")
-AgnosticPresenters::Base.send :include, ActionView::Helpers if defined?(Rails)
-class << ActionController::Base
- def add_template_helper_with_presenters(helper_module, *args, &block)
- # Hijacking any helper added to controllers so that our presenters can acces 'em.
- AgnosticPresenters::Base.instance_eval { include helper_module }
- add_template_helper_without_presenters(helper_module, *args, &block)
- end
+if defined?(Rails)
+ AgnosticPresenters::Base.send :include, ActionView::Helpers
+
+ class << ActionController::Base
+ def add_template_helper_with_presenters(helper_module, *args, &block)
+ # Hijacking any helper added to controllers so that our presenters can acces 'em.
+ AgnosticPresenters::Base.instance_eval { include helper_module }
+ add_template_helper_without_presenters(helper_module, *args, &block)
+ end
- alias_method_chain :add_template_helper, :presenters
+ alias_method_chain :add_template_helper, :presenters
+ end
end
Please sign in to comment.
Something went wrong with that request. Please try again.