Class: DeviseIosRails::ChangePasswordService
- Inherits:
-
Object
- Object
- DeviseIosRails::ChangePasswordService
- Defined in:
- app/services/devise_ios_rails/change_password_service.rb
Instance Attribute Summary collapse
-
#current_user ⇒ Object
readonly
Returns the value of attribute current_user.
-
#params ⇒ Object
readonly
Returns the value of attribute params.
Instance Method Summary collapse
- #call! ⇒ Object
-
#initialize(current_user, params) ⇒ ChangePasswordService
constructor
A new instance of ChangePasswordService.
Constructor Details
#initialize(current_user, params) ⇒ ChangePasswordService
Returns a new instance of ChangePasswordService.
4 5 6 7 |
# File 'app/services/devise_ios_rails/change_password_service.rb', line 4 def initialize(current_user, params) @params = Hash(params) @current_user = current_user end |
Instance Attribute Details
#current_user ⇒ Object (readonly)
Returns the value of attribute current_user.
3 4 5 |
# File 'app/services/devise_ios_rails/change_password_service.rb', line 3 def current_user @current_user end |
#params ⇒ Object (readonly)
Returns the value of attribute params.
3 4 5 |
# File 'app/services/devise_ios_rails/change_password_service.rb', line 3 def params @params end |
Instance Method Details
#call! ⇒ Object
9 10 11 12 13 14 15 |
# File 'app/services/devise_ios_rails/change_password_service.rb', line 9 def call! return if current_user.nil? current_user.password = snake_case_params[:password] current_user.password_confirmation = snake_case_params[:password_confirmation] current_user.save current_user end |