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

Register helper_methods on demand.

This commit is contained in:
José Valim 2010-07-27 15:33:18 +02:00
parent 0a3099663e
commit 9d5a5beb59
2 changed files with 6 additions and 3 deletions

View file

@ -5,8 +5,7 @@ module Devise
extend ActiveSupport::Concern
included do
helper_method :warden, :signed_in?, :devise_controller?, :anybody_signed_in?,
*Devise.mappings.keys.map { |m| [:"current_#{m}", :"#{m}_signed_in?", :"#{m}_session"] }.flatten
helper_method :warden, :signed_in?, :devise_controller?, :anybody_signed_in?
end
# Define authentication filters and accessor helpers based on mappings.
@ -53,6 +52,10 @@ module Devise
current_#{mapping} && warden.session(:#{mapping})
end
METHODS
ActiveSupport.on_load(:action_controller) do
helper_method "current_#{mapping}", "#{mapping}_signed_in?", "#{mapping}_session"
end
end
# The main accessor for the warden proxy instance

View file

@ -9,7 +9,7 @@ module Devise
end
included do
helpers = %w(oauth_config)
helpers = %w(oauth_config oauth_callback)
hide_action *helpers
helper_method *helpers
before_filter :valid_oauth_callback?, :oauth_error_happened?