Displaying 1 result from an estimated 1 matches for "find_by_email_address".
2006 Feb 21
1
Custom forms and fieldWithErrors tags
...e forms, and some checks:
Model (part of it):
attr_accessor :local_part
attr_accessor :domain_part
validates_presence_of :local_part, :on => :create
validates_format_of :local_part, :with =>
/^[_\.-abcdef..(cut)...890]+$/, :on => :create
def validate_on_create
em = Mail.find_by_email_address(email_address)
errors.add :local_part, ''Email already taken'' if !em.nil?
end
... and then compose the real email address in the controller on the submit
action, like:
Controller:
@email = Mail.new
@email.attributes= @params[''email'']
@email.email_...