Sha256: 807136cb5a89cd2120d803e83fc74b0ef36ea13164f4db5d66081adeb4e5bfdb
Contents?: true
Size: 663 Bytes
Versions: 2
Compression:
Stored size: 663 Bytes
Contents
namespace :user do desc "Create a user given email and password" task :create, [:email, :password] => :environment do |t, args| user = User.new(:email => args[:email], :password => args[:password]) if user.save puts "User #{user.email} created!" else puts "Error: #{user.errors.full_messages.join(", ")}" end end task :admin, [:email, :password] => [:environment, :create] do |t, args| user = User.find_by_email(args[:email]) if user user.admin = true if user.save puts "User made admin." else puts "User NOT saved as admin." end else put "User not found." end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
daily-0.0.3 | lib/tasks/user.rake |
daily-0.0.2 | lib/tasks/user.rake |