Hi,
I guess my question is: how can I pass an array as a parameter with
link_to.
Just say in index action: @stuff = Model.find(:all)
Then in view I have: link_to and pass the whole array @stuff to the next
action.
Thanks
Hi,
I guess my question is: how can I pass an array as a parameter with
link_to.
Just say in index action: @stuff = Model.find(:all)
Then in view I have: link_to and pass the whole array @stuff to the next
action.
Thanks
Then in view I have: link_to and pass the whole array @stuff to the next
action.
In your view your link_to should link to an action in a controller. The
action in that controller should then be responsible for gathering data
from the model (just like the action you used to get to this page).
What you’re describing seems to be to be a violation of MVC. It’s your
application, but I hope you understand the implications of doing that.
For example:
What happens if the data changes from the time the initial page is
displayed and the user finally clicks on the link. Are you planning on
passing them stale data in your array?
How much additional bandwidth will you be consuming by passing in an
array of objects through a request?
How do you plan on serializing that array into a steam that can be
passed through a HTTP request?
Justin To wrote:
Hi,
I guess my question is: how can I pass an array as a parameter with
link_to.Just say in index action: @stuff = Model.find(:all)
Then in view I have: link_to and pass the whole array @stuff to the next
action.Thanks
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.
Sponsor our Newsletter | Privacy Policy | Terms of Service | Remote Ruby Jobs