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:
parent
0a3099663e
commit
9d5a5beb59
2 changed files with 6 additions and 3 deletions
|
@ -5,8 +5,7 @@ module Devise
|
||||||
extend ActiveSupport::Concern
|
extend ActiveSupport::Concern
|
||||||
|
|
||||||
included do
|
included do
|
||||||
helper_method :warden, :signed_in?, :devise_controller?, :anybody_signed_in?,
|
helper_method :warden, :signed_in?, :devise_controller?, :anybody_signed_in?
|
||||||
*Devise.mappings.keys.map { |m| [:"current_#{m}", :"#{m}_signed_in?", :"#{m}_session"] }.flatten
|
|
||||||
end
|
end
|
||||||
|
|
||||||
# Define authentication filters and accessor helpers based on mappings.
|
# Define authentication filters and accessor helpers based on mappings.
|
||||||
|
@ -53,6 +52,10 @@ module Devise
|
||||||
current_#{mapping} && warden.session(:#{mapping})
|
current_#{mapping} && warden.session(:#{mapping})
|
||||||
end
|
end
|
||||||
METHODS
|
METHODS
|
||||||
|
|
||||||
|
ActiveSupport.on_load(:action_controller) do
|
||||||
|
helper_method "current_#{mapping}", "#{mapping}_signed_in?", "#{mapping}_session"
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# The main accessor for the warden proxy instance
|
# The main accessor for the warden proxy instance
|
||||||
|
|
|
@ -9,7 +9,7 @@ module Devise
|
||||||
end
|
end
|
||||||
|
|
||||||
included do
|
included do
|
||||||
helpers = %w(oauth_config)
|
helpers = %w(oauth_config oauth_callback)
|
||||||
hide_action *helpers
|
hide_action *helpers
|
||||||
helper_method *helpers
|
helper_method *helpers
|
||||||
before_filter :valid_oauth_callback?, :oauth_error_happened?
|
before_filter :valid_oauth_callback?, :oauth_error_happened?
|
||||||
|
|
Loading…
Add table
Reference in a new issue