I want to be able to change a property on multiple records in my app. I
thought about adding a checkbox so that one can pick which records to
update. The question is how to implement the actual update - if the
checkbox isn’t part of the model, how can I iterate the records in the
view and see which are selected? My records are displayed using a
I’ve decided on a different approach and I could use some help:
The page containing the records to modify also contains a small form to
filter the displayed records. It uses observe_form to periodically call
a function to filter the view.
I want to use this form filter as a selector on which records to update
it will be a two step process:
the user picks which records to update by applying the filter.
the user will update attributes using a different form.
The filter works by taking the selected attributes in it’s form and
calling a helper function that returns a :conditions array “cond” to use
with activerecord’s find function - @products = Product.find(:all,
:conditions => cond).
This is all fine, but I have one problem - how can get have the filter’s
conditions available to the updating function (which isn’t called from
the observe_form helper)?
If I could have the :conditions available when I search which records to
update, then everything will be simpler. Any advice will be more than
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.