Module: Authlogic::ActsAsAuthentic::Email::Config
- Defined in:
- lib/authlogic/acts_as_authentic/email.rb
Overview
Configuration to modify how Authlogic handles the email field.
Instance Method Summary collapse
-
#email_field(value = nil) ⇒ Object
(also: #email_field=)
The name of the field that stores email addresses.
-
#validate_email_field(value = nil) ⇒ Object
(also: #validate_email_field=)
Toggles validating the email field or not.
-
#validates_format_of_email_field_options(value = nil) ⇒ Object
(also: #validates_format_of_email_field_options=)
A hash of options for the validates_format_of call for the email field.
-
#validates_length_of_email_field_options(value = nil) ⇒ Object
(also: #validates_length_of_email_field_options=)
A hash of options for the validates_length_of call for the email field.
-
#validates_uniqueness_of_email_field_options(value = nil) ⇒ Object
(also: #validates_uniqueness_of_email_field_options=)
A hash of options for the validates_uniqueness_of call for the email field.
Instance Method Details
#email_field(value = nil) ⇒ Object Also known as: email_field=
The name of the field that stores email addresses.
-
Default:
:email, if it exists -
Accepts:
Symbol
21 22 23 |
# File 'lib/authlogic/acts_as_authentic/email.rb', line 21 def email_field(value = nil) config(:email_field, value, first_column_to_exist(nil, :email, :email_address)) end |
#validate_email_field(value = nil) ⇒ Object Also known as: validate_email_field=
Toggles validating the email field or not.
-
Default:
true -
Accepts:
Boolean
30 31 32 |
# File 'lib/authlogic/acts_as_authentic/email.rb', line 30 def validate_email_field(value = nil) config(:validate_email_field, value, true) end |
#validates_format_of_email_field_options(value = nil) ⇒ Object Also known as: validates_format_of_email_field_options=
A hash of options for the validates_format_of call for the email field. Allows you to change this however you want.
-
Default:
=> email_regex, :message => I18n.t(‘error_messages.email_invalid’, :default => “should look like an email address.”) -
Accepts:
Hash of options accepted by validates_format_of
48 49 50 |
# File 'lib/authlogic/acts_as_authentic/email.rb', line 48 def (value = nil) config(:validates_format_of_email_field_options, value, {:with => email_regex, :message => I18n.t('error_messages.email_invalid', :default => "should look like an email address.")}) end |
#validates_length_of_email_field_options(value = nil) ⇒ Object Also known as: validates_length_of_email_field_options=
A hash of options for the validates_length_of call for the email field. Allows you to change this however you want.
-
Default:
=> 6..100 -
Accepts:
Hash of options accepted by validates_length_of
39 40 41 |
# File 'lib/authlogic/acts_as_authentic/email.rb', line 39 def (value = nil) config(:validates_length_of_email_field_options, value, {:within => 6..100}) end |
#validates_uniqueness_of_email_field_options(value = nil) ⇒ Object Also known as: validates_uniqueness_of_email_field_options=
A hash of options for the validates_uniqueness_of call for the email field. Allows you to change this however you want.
-
Default:
=> false, :scope => validations_scope, :if => “#{email_field_changed?”.to_sym} -
Accepts:
Hash of options accepted by validates_uniqueness_of
57 58 59 |
# File 'lib/authlogic/acts_as_authentic/email.rb', line 57 def (value = nil) config(:validates_uniqueness_of_email_field_options, value, {:case_sensitive => false, :scope => validations_scope, :if => "#{email_field}_changed?".to_sym}) end |