Module: DeviseG5Authenticatable::Helpers
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/devise_g5_authenticatable/controllers/helpers.rb
Overview
Utility helper methods to mixin to controllers
Defined Under Namespace
Modules: ClassMethods
Instance Method Summary collapse
- #clear_blank_param(scope, param_name) ⇒ Object
- #clear_blank_passwords ⇒ Object
- #handle_resource_error(error) ⇒ Object
- #password_params(scope) ⇒ Object
Instance Method Details
#clear_blank_param(scope, param_name) ⇒ Object
20 21 22 |
# File 'lib/devise_g5_authenticatable/controllers/helpers.rb', line 20 def clear_blank_param(scope, param_name) params[scope].delete(param_name) if params[scope][param_name].blank? end |
#clear_blank_passwords ⇒ Object
8 9 10 11 12 13 14 |
# File 'lib/devise_g5_authenticatable/controllers/helpers.rb', line 8 def clear_blank_passwords Devise.mappings.keys.each do |scope| if params[scope].present? password_params(scope).each { |p| clear_blank_param(scope, p) } end end end |
#handle_resource_error(error) ⇒ Object
24 25 26 27 |
# File 'lib/devise_g5_authenticatable/controllers/helpers.rb', line 24 def handle_resource_error(error) resource.errors[:base] << error. respond_with(resource) end |
#password_params(scope) ⇒ Object
16 17 18 |
# File 'lib/devise_g5_authenticatable/controllers/helpers.rb', line 16 def password_params(scope) params[scope].keys.select { |k| k =~ /password/ } end |