1
0
Fork 0
mirror of https://github.com/heartcombo/devise.git synced 2022-11-09 12:18:31 -05:00

Add #3732 helper logic to devise controller: #3864

This commit is contained in:
djsegal 2015-12-18 04:05:30 -05:00
parent 1ac4bdd090
commit 2006f87b58
2 changed files with 10 additions and 5 deletions

View file

@ -2,11 +2,15 @@
class DeviseController < Devise.parent_controller.constantize class DeviseController < Devise.parent_controller.constantize
include Devise::Controllers::ScopedViews include Devise::Controllers::ScopedViews
helper DeviseHelper if respond_to?(:helper)
helper DeviseHelper
end
helpers = %w(resource scope_name resource_name signed_in_resource if respond_to?(:helper_method)
resource_class resource_params devise_mapping) helpers = %w(resource scope_name resource_name signed_in_resource
helper_method(*helpers) resource_class resource_params devise_mapping)
helper_method(*helpers)
end
prepend_before_action :assert_is_devise_resource! prepend_before_action :assert_is_devise_resource!
respond_to :html if mimes_for_respond_to.empty? respond_to :html if mimes_for_respond_to.empty?

View file

@ -11,7 +11,8 @@ class HelperMethodsTest < Devise::ControllerTestCase
assert_includes @controller.class.ancestors, Devise::Controllers::Helpers assert_includes @controller.class.ancestors, Devise::Controllers::Helpers
end 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 refute_respond_to @controller.class, :helper_method
end end