This should be pretty simple…
If you have an instance variable in a controller passed to its view, and
you have <% form_remote_tag :url => { :action => ‘other_action’ } do -%>
etc <% end %>, can you access the instance variable in the action
other_action?
You’re not really changing the view…
The idea is that I really need to store a variable and have it go from
first action -> view -> second action -> manipulated -> passed back to
the view in render :update. If the above is not possible, what is the
best way to do this? Sessions?
Alright. But you can’t access it directly from the second action right?
The variable I want to pass is a very long array of objects, and I was
afraid it wasn’t going to be efficient if I passed it through a form (or
a session).
Julian L. wrote:
pass it in on the form
<% form_remote_tag :url => {:action => ‘other_action’, :the_var => @the_var } do -%>
then in the destination action, set
@the_var = params[:the_var]
Julian.
Learn Ruby on Rails! Check out the FREE VIDS (for a limited time)
VIDEO #4 coming soon! http://sensei.zenunit.com/
Alright. But you can’t access it directly from the second action right?
The variable I want to pass is a very long array of objects, and I was
afraid it wasn’t going to be efficient if I passed it through a form (or
a session).
Julian L. wrote:
pass it in on the form
<% form_remote_tag :url => {:action => ‘other_action’, :the_var => @the_var } do -%>
then in the destination action, set
@the_var = params[:the_var]
Julian.
Learn Ruby on Rails! Check out the FREE VIDS (for a limited time)
VIDEO #4 coming soon! http://sensei.zenunit.com/
When you submit that form it will make a ‘new’ request back to the
server. Unfortunately rails really resets ‘per request’ – except for
session vars and things you pass back to it.
by the way, the object i’m passing has sensitive data. should i still
pass it through the form?
only if you trust the security of your clients’ computers
I suppose if it’s sensitive save it to your session [or to a database
then reload it]
bearing in mind of course that with the default session store the
session data is on the client’s computer.
Frederick C. wrote:
|
| On 16 Apr 2008, at 16:46, Roger P. wrote:
|
|> Shannon C. wrote:
|>> by the way, the object i’m passing has sensitive data. should i still
|>> pass it through the form?
|> only if you trust the security of your clients’ computers
|> I suppose if it’s sensitive save it to your session [or to a database
|> then reload it]
| bearing in mind of course that with the default session store the
| session data is on the client’s computer.
|
And keeping in mind that SSL should be used to encrypt transmitting
sensitive information over a hostile network like the internet.
At the bottom of a good deal of the bravery that appears in the world
there lurks a miserable cowardice. Men will face powder and steel
because they cannot face public opinion.
~ – Edwin Hubbel Chapin
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.8 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org