Hi everyone,
I’ve been thinking and googling about this for the whole afternoon and
I dont find the solution, but I know there must be an easy way (after
all this is rails):
I have an page where user objects are listed (e.g. customers) and they
have several attributes (like name, e-mail etc.) and a special
attribute called contacted (which can be true or false depending on if
this customer has been contacted by the sales people or not)
No big deal I thought, just write two controller methods
‘set_contacted’ and ‘unset_contacted’ and we are done by passing over
the IDs of the corresponding objects. But then there came in two more
attributes and I suddenly end up with 6 controller methods which feels
horrible wrong to me (Not even to mention the DRY principle violation).
What I would like to do is the following using checkboxes and a form
for the whole table and a submit button in order to save the changes
made to the user objects
User | contacted
user1 | [x]
user2 | [ ]
user3 | [ ]
[ Save changes ]
You sometimes see a similar behaviour in Webmail clients where you can
check serveral e-mails at once and then hit a delete button.
Any sort of help is appreciated! Have a nice week-end
Matt