Created
November 7, 2012 23:41
-
-
Save nsanta/4035404 to your computer and use it in GitHub Desktop.
ActiveResource is dead, long live ActiveResource 3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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