12spokes / acts_as_restful_list

Just like acts_as_list, but restful.
MIT License
14 stars 9 forks source link

= acts_as_restful_list

It's just like acts_as_list, but instead of having to clutter your code with non-standard method calls like insert_at, acts_as_restful_list makes managing lists simple. You update the position attribute just like you would update anything else and the rest is taken care of for you.

== Features

== Installation

environment.rb

config.gem 'acts_as_restful_list'

in Terminal

rake gems:install

== Usage

=== In your model:

class Item < ActiveRecord::Base belongs_to :parent acts_as_restful_list :scope => :parent end

=== Now, simply CRUD away:

item = Item.create item.position # 1

item2 = Item.create item.position # 2

item3 = Item.create item.position # 3

item.destroy item2.position # 1 item3.position # 2

item3.position = 1 item3.save item3.position # 1 item2.position # 2

different_parent = Item.create(:parent_id => 1) different_parent.position # 1

And that's that.

Report issues at http://github.com/12spokes/acts_as_restful_list/issues

== Note on Patches/Pull Requests

== Copyright

Copyright (c) 2010 '12 Spokes'. See LICENSE for details.