Wednesday, May 29, 2013

[Rails] Re: Storing Rails controller callback data in session

Checked Rails code, and if I understand correctly, session in fact comes from request:

# actionpack-3.2.11/lib/action_controller/metal.rb:132
delegate :session, :to => "@_request" 

It seems session is valid only within request cycle context and although it can be accessed, the changes are not saved, as demonstrated by the project.

Hence, your suggestion to use proven techniques is the correct one :-)
Thanks (still glad to have found the reason for above behaviour)!

On Tuesday, May 28, 2013 3:21:42 PM UTC+2, Ruby-Forum.com User wrote:
"Vanja Radovanović" <elV...@gmail.com> wrote in post #1110347:
>
http://stackoverflow.com/questions/16770090/storing-rails-controller-callback-data-in-session
>
> The idea is:
>
>    - Perform some time consuming action in background.
>    - Have the results from that action be propagated back to the
> controller
>    using a callback.
>    - Store the result in an in memory session store.
>    - Have the result in session be used and available from that point
>    onward.

This sounds like a bad idea right out of the gate. My suggestion is to
put the whole thing out of your mind.

If you have a "time consuming action" then use one of the established
backgrounding solutions that are available:

https://github.com/resque/resque
https://github.com/collectiveidea/delayed_job

--
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 unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/9bb17672-900c-4563-94af-ad7251b33353%40googlegroups.com?hl=en-US.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate