Hi,

I have a scenario where the session variable is handy in the model - I 
need to be able to get the current value, as it may be changed at any 
time.

I have a delayed_job that runs a long running model activity (calling 
multiple web services, populating the database, etc.) in the background. 
This is triggered when a user selects an item from a list in the UI. 
However, if the user clicks on another item, I want the current 
processing to stop, as I want to keep the delayed_job worker pool as 
free as possible (the more the jobs, the more I am billed by the 
hoster). The only way I can see to achieve this is to set a session 
variable (session[:current_topic_id]) when the user clicks on a topic, 
and then check in each stage of the model action if the current topic is 
the same as the one stored in the session, and abort the long job if 
they are out of sync.

Here, passing in the session variable to the model method wont really 
work for me, I have to pass in the session id and check the variable 
value across the model code.

Thanks
Anand

Pratik Naik wrote:
> Hey David,
> 
> Sorry, I didn't mean to quote you ( just pressed gmail reply button ).
> My message was not for you, but for the people using the code :)
> 
> On Tue, Jul 29, 2008 at 5:36 PM, David A. Black <dbl...@rubypal.com> 
> wrote:
>>>>
>>>>
>> thinking that the method and variable names were being hurled at a
>>  * Co-taught by D.A. Black and Erik Kastner
>> See http://www.rubypal.com for details and updates!
>>
>> >
>>
> 
> 
> 
> --
> Cheers!
> - Pratik
> http://m.onkey.org

-- 
Posted via http://www.ruby-forum.com/.

-- 
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-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to