I want to display all records of a table with a checkbox in front of it
and after i checked some of them i want to submit this form and the
controller has to process the selected records. (changing the value of a
status field)
if someone could give me some pointers or maybe a code example, i would
be very gratefull!
I’m pressed for time thsi morning. If you own a copy of
AgileWebDevelopment then look up [] and it will give you the answer. If
you don’t own the book, I’d suggest you buy one if at all possible. It
will save you tens of hours of misery.
If that doesn’t work try a google search including [] as this is what
you add to the model name to get what you want.
I’m pressed for time thsi morning. If you own a copy of
AgileWebDevelopment then look up [] and it will give you the answer. If
you don’t own the book, I’d suggest you buy one if at all possible. It
will save you tens of hours of misery.
If that doesn’t work try a google search including [] as this is what
you add to the model name to get what you want.
hey, uh well just customize the list.rhtml view so that it loops through
each record and writes out a checkbox for each one in the correct
location with a unique name, something like “checkbox_1” where the 1 is
the id of the current record. Then wrap the list in a form pointing to
an action called “list_update” or something. Then in the action, loop
through all the items in param saying:
param.each do |key,value|
if key =~ /^checkbox_([0-9]+)$/ @record.find($1) @record.status = “new status” @record.save
end
end
Thank you Jeremy,
I get it :0)
i am going to trie this
Jeremy W. wrote:
hey, uh well just customize the list.rhtml view so that it loops through
each record and writes out a checkbox for each one in the correct
location with a unique name, something like “checkbox_1” where the 1 is
the id of the current record. Then wrap the list in a form pointing to
an action called “list_update” or something. Then in the action, loop
through all the items in param saying:
param.each do |key,value|
if key =~ /^checkbox_([0-9]+)$/ @record.find($1) @record.status = “new status” @record.save
end
end