No commit activity in last 3 years
No release in over 3 years
Just like acts_as_list, but allows updating through standard restful methods.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies

Development

>= 0
>= 0
 Project Readme

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¶ ↑

  • Automatically update your list’s order through standard REST methods

  • Support for Rails Optimistic Locking

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 github.com/12spokes/acts_as_restful_list/issues

Note on Patches/Pull Requests¶ ↑

  • Fork the project.

  • Make your feature addition or bug fix.

  • Add specs for it. This is important so I don’t break it in a future version unintentionally.

  • Commit, do not mess with rakefile, version, or history. (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)

  • Send me a pull request. Bonus points for topic branches.

Copyright © 2010 ‘12 Spokes’. See LICENSE for details.