Skip to content

Instantly share code, notes, and snippets.

@nsanta
Created November 7, 2012 23:41
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 nsanta/4035404 to your computer and use it in GitHub Desktop.
Save nsanta/4035404 to your computer and use it in GitHub Desktop.
ActiveResource is dead, long live ActiveResource 3
class User < ActiveResource::Base
self.site = 'http://37s.sunrise.i:3000'
validates_presence_of :login, :email
before_validation :ensure_login_has_a_value
after_destroy :log_user_deletion
protected
def ensure_login_has_a_value
unless login
self.login = email unless email.blank?
end
end
def log_user_deletion
# Log ...
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment