How can I access currently selected records in the view?

One of my views enables searching records using a text field. The rendered view contains only records that match the search.

After the view has rendered, I want to add an option to perform an update on the displayed records. The problem is, I don't know how to figure out which records are shown, since the search form is different from the update form, and I can only submit one of them.

Any ideas?

Let us assume you are displaying search results using @mysearchlist and iterate through them.

<% @mysearchlist.each do |a| %>   <%= link_to a.title, :action => "show", :id => a.id %>   <%= link_to 'edit', :action => "edit", :id => a.id %> <% end %>

There you go!.

Thanks for the quick response.

I'm not sure I follow. My view is rendered with partials, called from search function when the user submits the search:

<%= render :partial => 'record', :collection => @search_results %>

Do you edit one by one, or are you looking for something more like an edit in place within the listing?

It's more like finding the records to update using a filtering form, and then updating some or all the attributes in these records using another update form. More code and explanations in this post: http://railsforum.com/viewtopic.php?id=27309 Feel free to answer there, and I'll link it here. Thanks!