Skip to content

Instantly share code, notes, and snippets.

@edavis10
Forked from gilesbowkett/user.rb
Created May 16, 2011 23:49
Show Gist options
  • Save edavis10/975615 to your computer and use it in GitHub Desktop.
Save edavis10/975615 to your computer and use it in GitHub Desktop.
it doesn't have to be complicated
# Append the user's .railsrc.rb to the load modules, that way it's loaded
# after the rails ENV and everything else...
if $0 == 'irb' && ENV['RAILS_ENV']
IRB.conf[:LOAD_MODULES] << File.dirname(__FILE__) + '/.railsrc' # ~/.railsrc.rb, requires .rb
end
module UserPasswordResetter
def new_password_from_irb=(new_password)
self.password = self.password_confirmation = new_password
end
end
User.send(:include, UserPasswordResetter) unless User.included_modules.include?(UserPasswordResetter)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment