Displaying 2 results from an estimated 2 matches for "valid_email_regex".
2013 May 02
1
trouble-with-capybara-and-rspec-on-a-new-model-spec
...< ActiveRecord::Base
attr_accessible :company_name, :contact_name, :address, :telephone, :email, :description
before_save { |mailer| mailer.email = mailer.email.downcase }
validates :company_name, length: { maximum: 50 }
validates :contact_name, presence: true, length: { maximum: 40 }
VALID_EMAIL_REGEX = /\A[\w+\-.]+@[a-z\d\-.]+\.[a-z]+\z/i
validates :email, presence: true, format: { with: VALID_EMAIL_REGEX }end
Controller:
class MailersController < ApplicationController
def new
@mailer = Mailer.new
end
def create
@mailer = Mailer.new(params[:mailer])
if @mailer.save...
2012 May 24
0
Ruby on Rails Tutorial Chapter 6 RSpec tests failing
...r Model:
class User < ActiveRecord::Base
attr_accessible :name, :email, :password, :password_confirmation
attr_accessor :password, :password_confirmation
has_secure_password
before_save { |user| user.email = email.downcase }
validates :name, presence: true, length: { maximum: 50 }
VALID_EMAIL_REGEX = /\A[\w+\-.]+@[a-z\d\-.]+\.[a-z]+\z/i
validates :email, presence: true, format: { with:
VALID_EMAIL_REGEX },uniqueness: { case_sensitive: false }
validates :password, presence: true, length: { minimum: 6 }
validates :password_confirmation, presence: true
------------------------------------...