Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@edgarjs
Created June 13, 2013 14:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save edgarjs/5774177 to your computer and use it in GitHub Desktop.
Save edgarjs/5774177 to your computer and use it in GitHub Desktop.
How to bypass validations
class User < ActiveRecord::Base
validates_presence_of :email
validates_uniqueness_of :email
end
User.create(email: 'foo@bar.com')
@user = User.new
@user.save # => false
@user.update_attribute(:email, 'foo@bar.com') # => true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment