Class: Stormpath::Rails::RegistrationForm
- Inherits:
-
Object
- Object
- Stormpath::Rails::RegistrationForm
- Includes:
- ActiveModel::Model
- Defined in:
- app/forms/stormpath/rails/registration_form.rb
Defined Under Namespace
Classes: ArbitraryDataSubmitted, FormError
Instance Attribute Summary collapse
-
#account ⇒ Object
Returns the value of attribute account.
-
#organization_name_key ⇒ Object
Returns the value of attribute organization_name_key.
Instance Method Summary collapse
-
#initialize(params = {}) ⇒ RegistrationForm
constructor
A new instance of RegistrationForm.
- #save ⇒ Object
- #save! ⇒ Object
Constructor Details
#initialize(params = {}) ⇒ RegistrationForm
Returns a new instance of RegistrationForm.
20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'app/forms/stormpath/rails/registration_form.rb', line 20 def initialize(params = {}) custom_data_params = params[:customData] || {} params = params.except(:customData).merge(custom_data_params) params = params.stringify_keys.transform_keys(&:underscore).symbolize_keys arbitrary_param_names = params.keys - RegistrationFormFields.enabled_field_names.push(:organization_name_key) if arbitrary_param_names.any? raise ArbitraryDataSubmitted, "Can't submit arbitrary data: #{arbitrary_param_names.join(', ')}" end super(params) end |
Instance Attribute Details
#account ⇒ Object
Returns the value of attribute account.
6 7 8 |
# File 'app/forms/stormpath/rails/registration_form.rb', line 6 def account @account end |
#organization_name_key ⇒ Object
Returns the value of attribute organization_name_key.
6 7 8 |
# File 'app/forms/stormpath/rails/registration_form.rb', line 6 def organization_name_key @organization_name_key end |
Instance Method Details
#save ⇒ Object
34 35 36 37 38 39 40 41 42 |
# File 'app/forms/stormpath/rails/registration_form.rb', line 34 def save return false if invalid? begin self.account = account_resource rescue Stormpath::Error => error errors.add(:base, error.) && false end end |
#save! ⇒ Object
44 45 46 47 |
# File 'app/forms/stormpath/rails/registration_form.rb', line 44 def save! return true if save raise(FormError, errors..first) end |