TechSutra

acts_as_list in Ruby on Rails

Though Ruby on Rails saves you a lot of time, at least some part of the saved time is spent on trying to piece together documentation which is spread over different wiki pages and blogs. This post hopefully will help you get rolling with acts_as_list.

Migration

The Model

The Controller These are the changes to be made to the scaffold code generated. update_positions will be used to reorder the list items using a drag and drop AJAX interface.

The View Add the following to your layout view.

The CSS

References

* Ruby Wiki
* Script.aculo.us
blog comments powered by Disqus