On Thu, 2007-12-20 at 01:36 -0800, bublik wrote:> Give me please example
> How i can send send email from Backgroundrb worker and
> How get access to my modele User
>
> my config
> ------------------------------
> ---
> port: "3333"
> timer_sleep: 60
> load_rails: true
> environment: development
> rails_env: development
> host: localhost
> database_yml: config/database.yml
> acl:
> deny: all
> allow: localhost 127.0.0.1
> order: deny,allow
> ------------------------------
> my worker
> ------------------------------
> class PsWorker < BackgrounDRb::Rails
>
> repeat_every 2.minutes
> first_run Time.now
>
> def do_work(args)
> # This method is called in it''s own new thread when you
> # call new worker. args is set to :args
> # logger.debug(''DO_WORK ''+args.inspect)
> Sende1.deliver_test()
> end
> end
You are running an old version of backgroundrb, please update your
plugin from here:
http://svn.devjavu.com/backgroundrb/trunk/
Full instructions can be found here:
http://backgroundrb.rubyforge.org/
So your worker with new plugin would look like:
class PsWorker < BackgrounDRb::MetaWorker
set_worker_name :ps_worker
# gets called when worker is created
def create(args)
deliver_test_mail()
add_periodic_timer(2*60) { deliver_test_mail }
end
def deliver_test_mail
Sende1.deliver_test
end
end
Inside your workers, you have full access to your rails environment( and
hence model and everything).
For more information, you can join backgroundrb mailing list on:
http://rubyforge.org/mailman/listinfo/backgroundrb-devel
--
Let them talk of their oriental summer climes of everlasting
conservatories; give me the privilege of making my own summer with my
own coals.
http://gnufied.org
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---