On 8/27/06, Till Vollmer <till.vollmer@googlemail.com>
wrote:>
> I have programmed a sweeper for a model (no registering through
> controller). I encountered some problems with that:
>
> The sweeper was only called once when i initialized it in
> envrionment.rb by callinf MySweeper.instance.
>
> Then with webbrick it worked fine when I called MySweeper.instnce in
> the vefore filter of application.rb (which I think is not good at all)
>
> With lighthttpd this does not work, the sweeper is NEVER called.
>
> So I tried to add it in the config part (observe) of environment.rb but
> thanI got an error that one plugin that my model (that I observe) uses
> is not found (seems that they are not loaded then)
>
> I tried to add it after the config, but also the sweeper is never
> called
>
> Why is the sweeper not called on lighttpd and on webrick it works fine.
> What is the difference. How can I use sweepers on lighthttp?
>
> Anyone using sweeper with lighttpd?
>
> Regards
> Till
>
If you''re not using a controller in your sweeper, you should be using
an Observer instead. You can specify them to be instantiated in one
of two ways:
# config/environment.rb
config.active_record.observers << :my_observer
# your controller
observer :my_observer
Please use the Ruby on Rails list for general questions, this list is
for discussion on development of the core framework.
--
Rick Olson
http://weblog.techno-weenie.net
http://mephistoblog.com
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Core" group.
To post to this group, send email to rubyonrails-core@googlegroups.com
To unsubscribe from this group, send email to
rubyonrails-core-unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/rubyonrails-core
-~----------~----~----~----~------~----~------~--~---