Forum: Ruby on Rails Ajax callback w/o model update?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
1cbcd04f1aa12775ce0f51d847bb4849?d=identicon&s=25 Lee Iverson (leei)
on 2006-05-15 23:49
(Received via mailing list)
Is there a way to keep a controller instance variable across a
link_to_remote call?

In essence, I want the call to re-render a partial within my page with
different display parameters, but without doing another DB call.  Is
there a simple way to do this?
87a1b4114f307e1a4f4c9968ccb92a04?d=identicon&s=25 James Moore (Guest)
on 2006-05-16 04:40
(Received via mailing list)
Are the variables short enough that you can serialize them and stuff
them
inside parameters in the URL?  It's ugly but functional, and requires no
back-end help.  (Or turn it into a POST for longer strings.)

 - James
1cbcd04f1aa12775ce0f51d847bb4849?d=identicon&s=25 Lee Iverson (leei)
on 2006-05-16 07:21
(Received via mailing list)
James Moore wrote:
> Are the variables short enough that you can serialize them and stuff them
> inside parameters in the URL?  It's ugly but functional, and requires no
> back-end help.  (Or turn it into a POST for longer strings.)
>
Nope.  I'm talking a fairly hefty Foo.find(:all, :include => [...])...

So there's good reason not to want to re-execute the query just so I can
redisplay with different parameters.
F5c118aaeb5bb7162db613a37e595be8?d=identicon&s=25 Mick Sharpe (micksharpe)
on 2006-05-16 12:48
Is there a problem with storing the results of the query in a session
variable?
1cbcd04f1aa12775ce0f51d847bb4849?d=identicon&s=25 Lee Iverson (leei)
on 2006-05-16 22:58
(Received via mailing list)
Mick Sharpe wrote:
> Is there a problem with storing the results of the query in a session
> variable?
>
Not really, although I'd prefer if it didn't persist to the database or
filesystem.  I'm also concerned about making sure that it gets cleared
as soon as I leave the page...

Thinking it through a bit further, it seems that there are really only
two solutions:
1) Store in the session, in which case, I want to get it cleared as soon
as I leave the page.
  * Is there a callback or such that handles this?
2) Create a data structure in JS and do the redisplay entirely on the
client side.
  * Has anyone experience with this?  Possible with RJS?

Thanks for any help.
This topic is locked and can not be replied to.