module Authlogic::ActsAsAuthentic::Email::Config

Configuration to modify how Authlogic handles the email field.

Public Instance Methods

email_field(value = nil) click to toggle source

The name of the field that stores email addresses.

  • Default: :email, if it exists

  • Accepts: Symbol

# File lib/authlogic/acts_as_authentic/email.rb, line 21
def email_field(value = nil)
  rw_config(:email_field, value, first_column_to_exist(nil, :email, :email_address))
end
Also aliased as: email_field=
email_field=(value = nil)
Alias for: email_field
merge_validates_format_of_email_field_options(options = {}) click to toggle source

See merge_validates_length_of_email_field_options. The same thing except for validates_format_of_email_field_options.

# File lib/authlogic/acts_as_authentic/email.rb, line 73
def merge_validates_format_of_email_field_options(options = {})
  self.validates_format_of_email_field_options = validates_format_of_email_field_options.merge(options)
end
merge_validates_length_of_email_field_options(options = {}) click to toggle source

A convenience function to merge options into the validates_length_of_email_field_options. So intead of:

self.validates_length_of_email_field_options = validates_length_of_email_field_options.merge(:my_option => my_value)

You can do this:

merge_validates_length_of_email_field_options :my_option => my_value
# File lib/authlogic/acts_as_authentic/email.rb, line 55
def merge_validates_length_of_email_field_options(options = {})
  self.validates_length_of_email_field_options = validates_length_of_email_field_options.merge(options)
end
merge_validates_uniqueness_of_email_field_options(options = {}) click to toggle source

See merge_validates_length_of_email_field_options. The same thing except for validates_uniqueness_of_email_field_options.

# File lib/authlogic/acts_as_authentic/email.rb, line 91
def merge_validates_uniqueness_of_email_field_options(options = {})
  self.validates_uniqueness_of_email_field_options = validates_uniqueness_of_email_field_options.merge(options)
end
validate_email_field(value = nil) click to toggle source

Toggles validating the email field or not.

  • Default: true

  • Accepts: Boolean

# File lib/authlogic/acts_as_authentic/email.rb, line 30
def validate_email_field(value = nil)
  rw_config(:validate_email_field, value, true)
end
Also aliased as: validate_email_field=
validate_email_field=(value = nil)
validates_format_of_email_field_options(value = nil) click to toggle source

A hash of options for the validates_format_of call for the email field. Allows you to change this however you want.

Keep in mind this is ruby. I wanted to keep this as flexible as possible, so you can completely replace the hash or merge options into it. Checkout the convenience function #merge_validates_format_of_email_field_options to merge options.

  • Default: {:with => Authlogic::Regex.email, :message => Proc.new {I18n.t('error_messages.email_invalid', :default => “should look like an email address.”)}}

  • Accepts: Hash of options accepted by validates_format_of

# File lib/authlogic/acts_as_authentic/email.rb, line 67
def validates_format_of_email_field_options(value = nil)
  rw_config(:validates_format_of_email_field_options, value, {:with => Authlogic::Regex.email, :message => Proc.new{I18n.t('error_messages.email_invalid', :default => "should look like an email address.")}})
end
validates_format_of_email_field_options=(value = nil)
validates_length_of_email_field_options(value = nil) click to toggle source

A hash of options for the validates_length_of call for the email field. Allows you to change this however you want.

Keep in mind this is ruby. I wanted to keep this as flexible as possible, so you can completely replace the hash or merge options into it. Checkout the convenience function #merge_validates_length_of_email_field_options to merge options.

  • Default: {:maximum => 100}

  • Accepts: Hash of options accepted by validates_length_of

# File lib/authlogic/acts_as_authentic/email.rb, line 43
def validates_length_of_email_field_options(value = nil)
  rw_config(:validates_length_of_email_field_options, value, {:maximum => 100})
end
validates_length_of_email_field_options=(value = nil)
validates_uniqueness_of_email_field_options(value = nil) click to toggle source

A hash of options for the validates_uniqueness_of call for the email field. Allows you to change this however you want.

Keep in mind this is ruby. I wanted to keep this as flexible as possible, so you can completely replace the hash or merge options into it. Checkout the convenience function #merge_validates_uniqueness_of_email_field_options to merge options.

  • Default: {:case_sensitive => false, :scope => validations_scope, :if => “#{email_field}_changed?”.to_sym}

  • Accepts: Hash of options accepted by validates_uniqueness_of

# File lib/authlogic/acts_as_authentic/email.rb, line 85
def validates_uniqueness_of_email_field_options(value = nil)
  rw_config(:validates_uniqueness_of_email_field_options, value, {:case_sensitive => false, :scope => validations_scope, :if => "#{email_field}_changed?".to_sym})
end
validates_uniqueness_of_email_field_options=(value = nil)