Created
November 23, 2010 19:42
-
-
Save jeffrydegrande/712386 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 Company < ActiveRecord::Base | |
def update_with_password(params={}) | |
if params[:password].blank? | |
params.delete(:password) | |
params.delete(:password_confirmation) if params[:password_confirmation].blank? | |
end | |
update_attributes(params) | |
end | |
protected | |
def password_required? | |
!persisted? || password.present? || password_confirmation.present? | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment