module DeviseG5Authenticatable::Helpers
Utility helper methods to mixin to controllers
Public Instance Methods
clear_blank_param(scope, param_name)
click to toggle source
# 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()
click to toggle source
# 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)
click to toggle source
# File lib/devise_g5_authenticatable/controllers/helpers.rb, line 24 def handle_resource_error(error) resource.errors[:base] << error.message respond_with(resource) end
password_params(scope)
click to toggle source
# File lib/devise_g5_authenticatable/controllers/helpers.rb, line 16 def password_params(scope) params[scope].keys.select { |k| k =~ /password/ } end