I’d like to implement a “select all” checkbox for a table of records (analogous to how it’s done in webmail). My plan is as follows: for each row/record the checkbox should carry the id in its value attribute. Then in my Rails controller I would validate that the logged in user has access to these records by retrieving records and comparing ids (unless there’s a better way for doing authorization). Finally, do something with records (delete, move etc.)
Do you think it would take a lot more development effort to create a map with masked ids and use that in checkboxes or is the current approach fine? Any libraries (client or server-side) that might come in handy?
I’d like to implement a select all checkbox for a table of records (analogous
Share
This is easy you can use jQuery to add the “check all” function. To build the list of checkboxes you can easily use the form builder. You can use cancan for the authorization.
For both cancan and HABTM Checkboxes there are railscasts that can help you!