Skip to content

Instantly share code, notes, and snippets.

@rociopaez
Last active August 29, 2015 14:05
Show Gist options
  • Save rociopaez/d900c0d6ff32c2755df0 to your computer and use it in GitHub Desktop.
Save rociopaez/d900c0d6ff32c2755df0 to your computer and use it in GitHub Desktop.
class UpdateProfile < Scrivener
attr_accessor :name
attr_accessor :email
attr_accessor :current_email
def validate
assert_present :name
if assert_email :email
if current_email != email
user = User.fetch(email)
assert(user.nil?, [:email, :not_unique])
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment