I have a rake task that sends out the next 'x' invitations to join a beta it uses this code:
desc "This will send out the next batch of invites for the beta"
task :send_invites => :environment do
limit = ENV['limit']
c = 0
invitation = Invitation.all(:conditions => { :sent_at => nil, :sender_id => nil }, :limit => limit).each do |i|
Mailer.deliver_invitation(i, register_url(i.token))
c.increment!
end
puts "Sent #{c} invitations."
end
I need to pass in the 'register_url' to the Mailer in order for the link to show up in the email, but since this is running from a rake task and not from a request it does not have a access to the helper methods. What is the best way of achieving this?