Displaying 5 results from an estimated 5 matches for "email_regex".
2010 Nov 28
2
Dynamic find_by method returning nil in a class method
...ith a class method that I am using to do some
authentication
basically something like this
class User < ActiveRecord::Base
attr_accessor :password
attr_accessible :first_name, :last_name,
:email, :birth_date, :sex,
:password, :password_confirmation
email_regex = /\A[\w+\-.]+@[a-z\d\-.]+\.[a-z]+\z/i
validates :first_name, :presence => true,
:length => { :maximum => 50 }
validates :last_name, :presence => true,
:length => {:maximum => 50 }
validates :email...
2009 Sep 19
1
validations on a field
hi, i have a model with 2 validations on a field
example:
validates_presence_of :email
validates_length_of :email, :within => 6..100 #r@a.wk
validates_uniqueness_of :email
validates_format_of :email, :with =>
Authentication.email_regex
if i do the submit of form for a new object of the model with a blank
mail
i receive 4 errors.
In this case i want receive only the errore for:
validates_presence_of :email
is possible?
thanks
--
Posted via http://www.ruby-forum.com/.
2011 Jul 19
0
Ruby on Rails Tutorial Chapter 8 Signup Success
...# ./spec/controllers/users_controller_spec.rb:107:in `block (4
levels) in <top (required)>''
Here''s the user model code:
class User < ActiveRecord::Base
attr_accessor :password
attr_accessible :name, :email, :password, :password_confirmation
email_regex = /\A[\w+\-.]+@[a-z\d\-.]+\.[a-z]+\z/i
validates :name, :presence => true,
:length => {:maximum => 50}
validates :email, :presence => true,
:format => {:with => email_regex},
:uniqueness => {:ca...
2011 Mar 17
7
Beta Invitation in Rails 3, little problem
...;users#new''
TO HAVE MORE INFORMATION TAKE A LOOK IN THE FOLLOW SCRIPT
#app/models/invitation.rb #how generate the token
class Invitation < ActiveRecord::Base
belongs_to :sender, :class_name => ''User''
has_one :recipient, :class_name => ''User''
email_regex = /\A[\w+\-.]+@[a-z\d\-.]+\.[a-z]+\z/i
validates :recipient_email, :presence => true,
:format => { :with => email_regex }
before_create :generate_token
private
def generate_token
self.token = Digest::SHA1.hexdigest([Time.now, rand].join)
end
end
#/mailers/invitation.t...
2005 Dec 29
7
belongs_to causing NoMethodError exceptions ... ?
..._uniqueness_of :email_address
validates_confirmation_of :password
# password must be at least 8 characters long
validates_format_of :password, :with => %r{^.{8,}$}, :message =>
"must be at least 8 characters"
validates_format_of :email_address, :with => MiscUtils::EMAIL_REGEX
# user can only supply these params
attr_accessible :password, :password_confirmation, :email_address
# class variable -- see koz''s post http://www.koziarski.net/
archives/2005/07/16/environment
cattr_accessor :current_user
# non-db variables
attr_accessor :password...