Class: UserRegistration::UsingPassword
- Includes:
- Notifications, SubscribeVoucherReward
- Defined in:
- app/my_lib/user_registration/using_password.rb
Instance Attribute Summary collapse
-
#user ⇒ Object
Returns the value of attribute user.
Instance Method Summary collapse
- #full_error_message ⇒ Object
-
#initialize(attrs = {}) ⇒ UsingPassword
constructor
A new instance of UsingPassword.
- #save! ⇒ Object
Methods included from SubscribeVoucherReward
Methods included from Notifications
#send_registration_email, #send_registration_sms
Methods inherited from Base
Constructor Details
#initialize(attrs = {}) ⇒ UsingPassword
Returns a new instance of UsingPassword.
13 14 15 |
# File 'app/my_lib/user_registration/using_password.rb', line 13 def initialize(attrs = {}) @user = User.new attrs end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class UserRegistration::Base
Instance Attribute Details
#user ⇒ Object
Returns the value of attribute user.
11 12 13 |
# File 'app/my_lib/user_registration/using_password.rb', line 11 def user @user end |
Instance Method Details
#full_error_message ⇒ Object
34 35 36 |
# File 'app/my_lib/user_registration/using_password.rb', line 34 def user.errors&.&.uniq&.to_sentence end |
#save! ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'app/my_lib/user_registration/using_password.rb', line 17 def save! raise RegistrationError, user.errors..to_sentence unless user.valid? raise RegistrationError, user.errors..to_sentence unless user.save ActiveRecord::Base.transaction do send_registration_email voucher_reward_subscription end true rescue ActiveRecord::ActiveRecordError => error APMErrorHandler.report(error) user.errors.add(:base, 'Sorry, something went wrong') false end |