Module: DeviseG5Authenticatable::Helpers
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/devise_g5_authenticatable/controllers/helpers.rb
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
17 18 19 |
# File 'lib/devise_g5_authenticatable/controllers/helpers.rb', line 17 def clear_blank_param(scope, param_name) params[scope].delete(param_name) if params[scope][param_name].blank? end |
#clear_blank_passwords ⇒ Object
5 6 7 8 9 10 11 |
# File 'lib/devise_g5_authenticatable/controllers/helpers.rb', line 5 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
21 22 23 24 |
# File 'lib/devise_g5_authenticatable/controllers/helpers.rb', line 21 def handle_resource_error(error) resource.errors[:base] << error. respond_with(resource) end |
#password_params(scope) ⇒ Object
13 14 15 |
# File 'lib/devise_g5_authenticatable/controllers/helpers.rb', line 13 def password_params(scope) params[scope].keys.select { |k| k =~ /password/ } end |