Skip to content

Commit

Permalink
Add #3732 helper logic to devise controller: #3864
Browse files Browse the repository at this point in the history
  • Loading branch information
djsegal committed Dec 18, 2015
1 parent 1ac4bdd commit 2006f87
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
12 changes: 8 additions & 4 deletions app/controllers/devise_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,15 @@
class DeviseController < Devise.parent_controller.constantize
include Devise::Controllers::ScopedViews

helper DeviseHelper
if respond_to?(:helper)
helper DeviseHelper
end

helpers = %w(resource scope_name resource_name signed_in_resource
resource_class resource_params devise_mapping)
helper_method(*helpers)
if respond_to?(:helper_method)
helpers = %w(resource scope_name resource_name signed_in_resource
resource_class resource_params devise_mapping)
helper_method(*helpers)
end

prepend_before_action :assert_is_devise_resource!
respond_to :html if mimes_for_respond_to.empty?
Expand Down
3 changes: 2 additions & 1 deletion test/controllers/helper_methods_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ class HelperMethodsTest < Devise::ControllerTestCase
assert_includes @controller.class.ancestors, Devise::Controllers::Helpers
end

test 'does not respond_to helper_method' do
test 'does not respond_to helper or helper_method' do
refute_respond_to @controller.class, :helper
refute_respond_to @controller.class, :helper_method
end

Expand Down

0 comments on commit 2006f87

Please sign in to comment.