I saw several solutions that didn't seem to work for me. Suppose I have the following code -
namespace :genie do task :test => :environment do test_user = User.find_or_create_by_username('test') do |i| i.email = ' email@email.com ' end task :test_reset => :environment do test_user.update_attributes({ :email => ' test@email.com ', }) end
This code does not work when running rake genie: test, rake genie: test_reset because test_user is not defined in the second rake command. How can I call test_user without having to define it every time?
user2601288
source share