On Sun, 13 Jun 2010, Dan Sosedov wrote:

Does it possible to load all application helpers into rake test?

Sorry guys, i have not much experience with rake.

On Jun 13, 4:51 am, jonah honeyman <[email protected]>
wrote:
Are you asking how to use Merb::Mailer from outside of a controller? If
so, you can do something like this:

    users.each do |u|
      mail = Merb::Mailer.new({
        :to => u.email,
        :from => MY_EMAIL,
        :subject => "[awesomesauce.com] Monthly report",
        :text => u.text_for_monthly_report
      })

      mail.deliver!
    end

On Sun, Jun 13, 2010 at 02:08:34AM -0700, Dan Sosedov wrote:
Is there any good example how to send emails from rake tasks? For
example, i have a task that executed every month be able to send
emails to specific users.

# monthly.rake file
namespace :periodic do
  task :monthly => :merb_env do
    users = User.all(........)
    users.each do |u|
        .... some operations ....
       and here goes block that should send email.
    end
  end
end

Ideas?

--

You should get global helpers as a result of the :merb_env task, which you
can simply define as dependency for tasks requiring it.

---
Michishige Kaito

BOFH excuse #217:

The MGs ran out of gas.

--
You received this message because you are subscribed to the Google Groups 
"merb" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to [email protected].
For more options, visit this group at http://groups.google.com/group/merb?hl=en.

Reply via email to