Skip to content

Instantly share code, notes, and snippets.

@MaryKuz
Created March 28, 2019 12:11
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 MaryKuz/e11ed5af6f519638c5467ec7c3e52dff to your computer and use it in GitHub Desktop.
Save MaryKuz/e11ed5af6f519638c5467ec7c3e52dff to your computer and use it in GitHub Desktop.
Check user and email
validate do |model|
if user
model.errors.add :password, 'is invalid' unless user.authenticate password
else
model.errors.add :email, 'not found'
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment