acts_as_list 0.1.5 → 0.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.travis.yml +5 -0
- data/Gemfile +2 -0
- data/README.md +13 -1
- data/Rakefile +1 -3
- data/acts_as_list.gemspec +1 -1
- data/init.rb +2 -0
- data/lib/acts_as_list.rb +21 -1
- data/lib/acts_as_list/active_record/acts/list.rb +5 -3
- data/lib/acts_as_list/version.rb +1 -1
- data/test/shared.rb +1 -0
- data/test/shared_list.rb +0 -11
- data/test/shared_list_sub.rb +1 -1
- data/test/shared_top_addition.rb +87 -0
- data/test/test_list.rb +23 -0
- metadata +14 -12
- data/README.rdoc +0 -35
    
        data/.travis.yml
    ADDED
    
    
    
        data/Gemfile
    CHANGED
    
    
    
        data/README.md
    CHANGED
    
    | @@ -2,7 +2,7 @@ | |
| 2 2 |  | 
| 3 3 | 
             
            ## Description
         | 
| 4 4 |  | 
| 5 | 
            -
            This `acts_as extension | 
| 5 | 
            +
            This `acts_as` extension provides the capabilities for sorting and reordering a number of objects in a list. The class that has this specified needs to have a `position` column defined as an integer on the mapped database table.
         | 
| 6 6 |  | 
| 7 7 |  | 
| 8 8 | 
             
            ## Example
         | 
| @@ -22,6 +22,17 @@ This `acts_as extension` provides the capabilities for sorting and reordering a | |
| 22 22 | 
             
            ## Notes
         | 
| 23 23 | 
             
            If the `position` column has a default value, then there is a slight change in behavior, i.e if you have 4 items in the list, and you insert 1, with a default position 0, it would be pushed to the bottom of the list. Please look at the tests for this and some recent pull requests for discussions related to this.
         | 
| 24 24 |  | 
| 25 | 
            +
            ## Versions
         | 
| 26 | 
            +
            All versions `0.1.5` onwards require Rails 3.0.x and higher.
         | 
| 27 | 
            +
             | 
| 28 | 
            +
            ## Build Status
         | 
| 29 | 
            +
            [](https://secure.travis-ci.org/swanandp/acts_as_list)
         | 
| 30 | 
            +
             | 
| 31 | 
            +
            ## Roadmap
         | 
| 32 | 
            +
             | 
| 33 | 
            +
            1. Sort based feature
         | 
| 34 | 
            +
            2. Rails 4 compatibility and bye bye Rails 2! Older versions would of course continue to work with Rails 2, but there won't be any support on those.
         | 
| 35 | 
            +
             | 
| 25 36 | 
             
            ## Contributing to `acts_as_list`
         | 
| 26 37 |  | 
| 27 38 | 
             
            - Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
         | 
| @@ -31,6 +42,7 @@ If the `position` column has a default value, then there is a slight change in b | |
| 31 42 | 
             
            - Commit and push until you are happy with your contribution
         | 
| 32 43 | 
             
            - Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
         | 
| 33 44 | 
             
            - Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
         | 
| 45 | 
            +
            - I would recommend using Rails 3.1.x and higher for testing the build before a pull request. The current test harness does not quite work with 3.0.x. The plugin itself works, but the issue lies with testing infrastructure.
         | 
| 34 46 |  | 
| 35 47 | 
             
            ## Copyright
         | 
| 36 48 |  | 
    
        data/Rakefile
    CHANGED
    
    | @@ -12,11 +12,9 @@ desc 'Test the acts_as_list plugin.' | |
| 12 12 | 
             
            Rake::TestTask.new(:test) do |t|
         | 
| 13 13 | 
             
              t.libs << 'lib' << 'test'
         | 
| 14 14 | 
             
              t.pattern = 'test/**/test_*.rb'
         | 
| 15 | 
            -
              t.verbose =  | 
| 15 | 
            +
              t.verbose = false
         | 
| 16 16 | 
             
            end
         | 
| 17 17 |  | 
| 18 | 
            -
             | 
| 19 | 
            -
             | 
| 20 18 | 
             
            # Run the rdoc task to generate rdocs for this gem
         | 
| 21 19 | 
             
            require 'rdoc/task'
         | 
| 22 20 | 
             
            RDoc::Task.new do |rdoc|
         | 
    
        data/acts_as_list.gemspec
    CHANGED
    
    | @@ -24,7 +24,7 @@ Gem::Specification.new do |s| | |
| 24 24 |  | 
| 25 25 |  | 
| 26 26 | 
             
              # Dependencies (installed via 'bundle install')...
         | 
| 27 | 
            -
              s.add_development_dependency("bundler", [" | 
| 27 | 
            +
              s.add_development_dependency("bundler", [">= 1.0.0"])
         | 
| 28 28 | 
             
              s.add_development_dependency("activerecord", [">= 1.15.4.7794"])
         | 
| 29 29 | 
             
              s.add_development_dependency("rdoc")
         | 
| 30 30 | 
             
              s.add_development_dependency("sqlite3")
         | 
    
        data/init.rb
    CHANGED
    
    
    
        data/lib/acts_as_list.rb
    CHANGED
    
    | @@ -1,2 +1,22 @@ | |
| 1 1 | 
             
            require 'acts_as_list/active_record/acts/list'
         | 
| 2 | 
            -
             | 
| 2 | 
            +
             | 
| 3 | 
            +
            module ActsAsList
         | 
| 4 | 
            +
              if defined? Rails::Railtie
         | 
| 5 | 
            +
                require 'rails'
         | 
| 6 | 
            +
                class Railtie < Rails::Railtie
         | 
| 7 | 
            +
                  initializer 'acts_as_list.insert_into_active_record' do
         | 
| 8 | 
            +
                    ActiveSupport.on_load :active_record do
         | 
| 9 | 
            +
                      ActsAsList::Railtie.insert
         | 
| 10 | 
            +
                    end
         | 
| 11 | 
            +
                  end
         | 
| 12 | 
            +
                end
         | 
| 13 | 
            +
              end
         | 
| 14 | 
            +
             | 
| 15 | 
            +
              class Railtie
         | 
| 16 | 
            +
                def self.insert
         | 
| 17 | 
            +
                  if defined?(ActiveRecord)
         | 
| 18 | 
            +
                    ActiveRecord::Base.send(:include, ActiveRecord::Acts::List)
         | 
| 19 | 
            +
                  end
         | 
| 20 | 
            +
                end
         | 
| 21 | 
            +
              end
         | 
| 22 | 
            +
            end
         | 
| @@ -32,8 +32,9 @@ module ActiveRecord | |
| 32 32 | 
             
                    #   Example: <tt>acts_as_list :scope => 'todo_list_id = #{todo_list_id} AND completed = 0'</tt>
         | 
| 33 33 | 
             
                    # * +top_of_list+ - defines the integer used for the top of the list. Defaults to 1. Use 0 to make the collection
         | 
| 34 34 | 
             
                    #   act more like an array in its indexing.
         | 
| 35 | 
            +
                    # * +add_new_at+ - specifies whether objects get added to the :top or :bottom of the list. (default: +bottom+)
         | 
| 35 36 | 
             
                    def acts_as_list(options = {})
         | 
| 36 | 
            -
                      configuration = { :column => "position", :scope => "1 = 1", :top_of_list => 1}
         | 
| 37 | 
            +
                      configuration = { :column => "position", :scope => "1 = 1", :top_of_list => 1, :add_new_at => :bottom}
         | 
| 37 38 | 
             
                      configuration.update(options) if options.is_a?(Hash)
         | 
| 38 39 |  | 
| 39 40 | 
             
                      configuration[:scope] = "#{configuration[:scope]}_id".intern if configuration[:scope].is_a?(Symbol) && configuration[:scope].to_s !~ /_id$/
         | 
| @@ -58,7 +59,7 @@ module ActiveRecord | |
| 58 59 | 
             
                      end
         | 
| 59 60 |  | 
| 60 61 | 
             
                      class_eval <<-EOV
         | 
| 61 | 
            -
                        include ActiveRecord::Acts::List::InstanceMethods
         | 
| 62 | 
            +
                        include ::ActiveRecord::Acts::List::InstanceMethods
         | 
| 62 63 |  | 
| 63 64 | 
             
                        def acts_as_list_top
         | 
| 64 65 | 
             
                          #{configuration[:top_of_list]}.to_i
         | 
| @@ -75,7 +76,7 @@ module ActiveRecord | |
| 75 76 | 
             
                        #{scope_condition_method}
         | 
| 76 77 |  | 
| 77 78 | 
             
                        after_destroy :decrement_positions_on_lower_items
         | 
| 78 | 
            -
                         | 
| 79 | 
            +
                        before_create :add_to_list_#{configuration[:add_new_at]}
         | 
| 79 80 | 
             
                      EOV
         | 
| 80 81 | 
             
                    end
         | 
| 81 82 | 
             
                  end
         | 
| @@ -198,6 +199,7 @@ module ActiveRecord | |
| 198 199 | 
             
                    private
         | 
| 199 200 | 
             
                      def add_to_list_top
         | 
| 200 201 | 
             
                        increment_positions_on_all_items
         | 
| 202 | 
            +
                        self[position_column] = acts_as_list_top
         | 
| 201 203 | 
             
                      end
         | 
| 202 204 |  | 
| 203 205 | 
             
                      def add_to_list_bottom
         | 
    
        data/lib/acts_as_list/version.rb
    CHANGED
    
    
    
        data/test/shared.rb
    CHANGED
    
    
    
        data/test/shared_list.rb
    CHANGED
    
    | @@ -102,17 +102,6 @@ module Shared | |
| 102 102 | 
             
                  assert_equal 5, new4.pos
         | 
| 103 103 | 
             
                end
         | 
| 104 104 |  | 
| 105 | 
            -
                def test_insert_middle_with_unsaved_item
         | 
| 106 | 
            -
                  assert_equal [1, 2, 3, 4], ListMixin.find(:all, :conditions => 'parent_id = 5', :order => 'pos').map(&:id)
         | 
| 107 | 
            -
             | 
| 108 | 
            -
                  # new item, not saved yet
         | 
| 109 | 
            -
                  insert_this = ListMixin.new(:parent_id => 5)
         | 
| 110 | 
            -
                  insert_this.insert_at(2)
         | 
| 111 | 
            -
             | 
| 112 | 
            -
                  assert_equal [1, 2, 3, 4, 5], ListMixin.find(:all, :conditions => 'parent_id = 5', :order => 'pos').map(&:pos)
         | 
| 113 | 
            -
                  assert_equal [1, 5, 2, 3, 4], ListMixin.find(:all, :conditions => 'parent_id = 5', :order => 'pos').map(&:id)
         | 
| 114 | 
            -
                end
         | 
| 115 | 
            -
             | 
| 116 105 | 
             
                def test_delete_middle
         | 
| 117 106 | 
             
                  assert_equal [1, 2, 3, 4], ListMixin.find(:all, :conditions => 'parent_id = 5', :order => 'pos').map(&:id)
         | 
| 118 107 |  | 
    
        data/test/shared_list_sub.rb
    CHANGED
    
    | @@ -52,7 +52,7 @@ module Shared | |
| 52 52 | 
             
                  new = ListMixinSub1.create("parent_id" => 20)
         | 
| 53 53 | 
             
                  assert_equal 2, new.pos
         | 
| 54 54 |  | 
| 55 | 
            -
                  new =  | 
| 55 | 
            +
                  new = ListMixinSub1.create("parent_id" => 20)
         | 
| 56 56 | 
             
                  assert_equal 3, new.pos
         | 
| 57 57 |  | 
| 58 58 | 
             
                  new4 = ListMixin.create("parent_id" => 20)
         | 
| @@ -0,0 +1,87 @@ | |
| 1 | 
            +
            module Shared
         | 
| 2 | 
            +
              module TopAddition
         | 
| 3 | 
            +
                def setup
         | 
| 4 | 
            +
                  (1..4).each { |counter| TopAdditionMixin.create! :pos => counter, :parent_id => 5 }
         | 
| 5 | 
            +
                end
         | 
| 6 | 
            +
             | 
| 7 | 
            +
                def test_reordering
         | 
| 8 | 
            +
                  assert_equal [4, 3, 2, 1], TopAdditionMixin.find(:all, :conditions => 'parent_id = 5', :order => 'pos').map(&:id)
         | 
| 9 | 
            +
             | 
| 10 | 
            +
                  TopAdditionMixin.find(2).move_lower
         | 
| 11 | 
            +
                  assert_equal [4, 3, 1, 2], TopAdditionMixin.find(:all, :conditions => 'parent_id = 5', :order => 'pos').map(&:id)
         | 
| 12 | 
            +
             | 
| 13 | 
            +
                  TopAdditionMixin.find(2).move_higher
         | 
| 14 | 
            +
                  assert_equal [4, 3, 2, 1], TopAdditionMixin.find(:all, :conditions => 'parent_id = 5', :order => 'pos').map(&:id)
         | 
| 15 | 
            +
             | 
| 16 | 
            +
                  TopAdditionMixin.find(1).move_to_bottom
         | 
| 17 | 
            +
                  assert_equal [4, 3, 2, 1], TopAdditionMixin.find(:all, :conditions => 'parent_id = 5', :order => 'pos').map(&:id)
         | 
| 18 | 
            +
             | 
| 19 | 
            +
                  TopAdditionMixin.find(1).move_to_top
         | 
| 20 | 
            +
                  assert_equal [1, 4, 3, 2], TopAdditionMixin.find(:all, :conditions => 'parent_id = 5', :order => 'pos').map(&:id)
         | 
| 21 | 
            +
             | 
| 22 | 
            +
                  TopAdditionMixin.find(2).move_to_bottom
         | 
| 23 | 
            +
                  assert_equal [1, 4, 3, 2], TopAdditionMixin.find(:all, :conditions => 'parent_id = 5', :order => 'pos').map(&:id)
         | 
| 24 | 
            +
             | 
| 25 | 
            +
                  TopAdditionMixin.find(4).move_to_top
         | 
| 26 | 
            +
                  assert_equal [4, 1, 3, 2], TopAdditionMixin.find(:all, :conditions => 'parent_id = 5', :order => 'pos').map(&:id)
         | 
| 27 | 
            +
                end
         | 
| 28 | 
            +
             | 
| 29 | 
            +
                def test_injection
         | 
| 30 | 
            +
                  item = TopAdditionMixin.new(:parent_id => 1)
         | 
| 31 | 
            +
                  assert_equal '"mixins"."parent_id" = 1', item.scope_condition
         | 
| 32 | 
            +
                  assert_equal "pos", item.position_column
         | 
| 33 | 
            +
                end
         | 
| 34 | 
            +
             | 
| 35 | 
            +
                def test_insert
         | 
| 36 | 
            +
                  new = TopAdditionMixin.create(:parent_id => 20)
         | 
| 37 | 
            +
                  assert_equal 1, new.pos
         | 
| 38 | 
            +
                  assert new.first?
         | 
| 39 | 
            +
                  assert new.last?
         | 
| 40 | 
            +
             | 
| 41 | 
            +
                  new = TopAdditionMixin.create(:parent_id => 20)
         | 
| 42 | 
            +
                  assert_equal 1, new.pos
         | 
| 43 | 
            +
                  assert new.first?
         | 
| 44 | 
            +
                  assert !new.last?
         | 
| 45 | 
            +
             | 
| 46 | 
            +
                  new = TopAdditionMixin.create(:parent_id => 20)
         | 
| 47 | 
            +
                  assert_equal 1, new.pos
         | 
| 48 | 
            +
                  assert new.first?
         | 
| 49 | 
            +
                  assert !new.last?
         | 
| 50 | 
            +
             | 
| 51 | 
            +
                  new = TopAdditionMixin.create(:parent_id => 0)
         | 
| 52 | 
            +
                  assert_equal 1, new.pos
         | 
| 53 | 
            +
                  assert new.first?
         | 
| 54 | 
            +
                  assert new.last?
         | 
| 55 | 
            +
                end
         | 
| 56 | 
            +
             | 
| 57 | 
            +
                def test_insert_at
         | 
| 58 | 
            +
                  new = TopAdditionMixin.create(:parent_id => 20)
         | 
| 59 | 
            +
                  assert_equal 1, new.pos
         | 
| 60 | 
            +
             | 
| 61 | 
            +
                  new = TopAdditionMixin.create(:parent_id => 20)
         | 
| 62 | 
            +
                  assert_equal 1, new.pos
         | 
| 63 | 
            +
             | 
| 64 | 
            +
                  new = TopAdditionMixin.create(:parent_id => 20)
         | 
| 65 | 
            +
                  assert_equal 1, new.pos
         | 
| 66 | 
            +
             | 
| 67 | 
            +
                  new4 = TopAdditionMixin.create(:parent_id => 20)
         | 
| 68 | 
            +
                  assert_equal 1, new4.pos
         | 
| 69 | 
            +
             | 
| 70 | 
            +
                  new4.insert_at(3)
         | 
| 71 | 
            +
                  assert_equal 3, new4.pos
         | 
| 72 | 
            +
                end
         | 
| 73 | 
            +
             | 
| 74 | 
            +
                def test_delete_middle
         | 
| 75 | 
            +
                  assert_equal [4, 3, 2, 1], TopAdditionMixin.find(:all, :conditions => 'parent_id = 5', :order => 'pos').map(&:id)
         | 
| 76 | 
            +
             | 
| 77 | 
            +
                  TopAdditionMixin.find(2).destroy
         | 
| 78 | 
            +
             | 
| 79 | 
            +
                  assert_equal [4, 3, 1], TopAdditionMixin.find(:all, :conditions => 'parent_id = 5', :order => 'pos').map(&:id)
         | 
| 80 | 
            +
             | 
| 81 | 
            +
                  assert_equal 3, TopAdditionMixin.find(1).pos
         | 
| 82 | 
            +
                  assert_equal 2, TopAdditionMixin.find(3).pos
         | 
| 83 | 
            +
                  assert_equal 1, TopAdditionMixin.find(4).pos
         | 
| 84 | 
            +
                end
         | 
| 85 | 
            +
             | 
| 86 | 
            +
              end
         | 
| 87 | 
            +
            end
         | 
    
        data/test/test_list.rb
    CHANGED
    
    | @@ -69,6 +69,10 @@ class DefaultScopedMixin < Mixin | |
| 69 69 | 
             
              default_scope { order('pos ASC') }
         | 
| 70 70 | 
             
            end
         | 
| 71 71 |  | 
| 72 | 
            +
            class TopAdditionMixin < Mixin
         | 
| 73 | 
            +
              acts_as_list :column => "pos", :add_new_at => :top, :scope => :parent_id
         | 
| 74 | 
            +
            end
         | 
| 75 | 
            +
             | 
| 72 76 | 
             
            class ActsAsListTestCase < Test::Unit::TestCase
         | 
| 73 77 | 
             
              # No default test required a this class is abstract.
         | 
| 74 78 | 
             
              # Need for test/unit.
         | 
| @@ -232,3 +236,22 @@ class DefaultScopedTest < ActsAsListTestCase | |
| 232 236 | 
             
              end
         | 
| 233 237 |  | 
| 234 238 | 
             
            end
         | 
| 239 | 
            +
             | 
| 240 | 
            +
            #class TopAdditionMixin < Mixin
         | 
| 241 | 
            +
             | 
| 242 | 
            +
            class TopAdditionTest < ActsAsListTestCase
         | 
| 243 | 
            +
              include Shared::TopAddition
         | 
| 244 | 
            +
              def setup
         | 
| 245 | 
            +
                setup_db
         | 
| 246 | 
            +
                super
         | 
| 247 | 
            +
              end
         | 
| 248 | 
            +
            end
         | 
| 249 | 
            +
             | 
| 250 | 
            +
            class TopAdditionTestWithDefault < ActsAsListTestCase
         | 
| 251 | 
            +
              include Shared::TopAddition
         | 
| 252 | 
            +
             | 
| 253 | 
            +
              def setup
         | 
| 254 | 
            +
                setup_db_with_default
         | 
| 255 | 
            +
                super
         | 
| 256 | 
            +
              end
         | 
| 257 | 
            +
            end
         | 
    
        metadata
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: acts_as_list
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0.1. | 
| 4 | 
            +
              version: 0.1.6
         | 
| 5 5 | 
             
              prerelease: 
         | 
| 6 6 | 
             
            platform: ruby
         | 
| 7 7 | 
             
            authors:
         | 
| @@ -11,22 +11,22 @@ authors: | |
| 11 11 | 
             
            autorequire: 
         | 
| 12 12 | 
             
            bindir: bin
         | 
| 13 13 | 
             
            cert_chain: []
         | 
| 14 | 
            -
            date: 2012- | 
| 14 | 
            +
            date: 2012-04-19 00:00:00.000000000 Z
         | 
| 15 15 | 
             
            dependencies:
         | 
| 16 16 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 17 17 | 
             
              name: bundler
         | 
| 18 | 
            -
              requirement: & | 
| 18 | 
            +
              requirement: &2152347900 !ruby/object:Gem::Requirement
         | 
| 19 19 | 
             
                none: false
         | 
| 20 20 | 
             
                requirements:
         | 
| 21 | 
            -
                - -  | 
| 21 | 
            +
                - - ! '>='
         | 
| 22 22 | 
             
                  - !ruby/object:Gem::Version
         | 
| 23 23 | 
             
                    version: 1.0.0
         | 
| 24 24 | 
             
              type: :development
         | 
| 25 25 | 
             
              prerelease: false
         | 
| 26 | 
            -
              version_requirements: * | 
| 26 | 
            +
              version_requirements: *2152347900
         | 
| 27 27 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 28 28 | 
             
              name: activerecord
         | 
| 29 | 
            -
              requirement: & | 
| 29 | 
            +
              requirement: &2152347320 !ruby/object:Gem::Requirement
         | 
| 30 30 | 
             
                none: false
         | 
| 31 31 | 
             
                requirements:
         | 
| 32 32 | 
             
                - - ! '>='
         | 
| @@ -34,10 +34,10 @@ dependencies: | |
| 34 34 | 
             
                    version: 1.15.4.7794
         | 
| 35 35 | 
             
              type: :development
         | 
| 36 36 | 
             
              prerelease: false
         | 
| 37 | 
            -
              version_requirements: * | 
| 37 | 
            +
              version_requirements: *2152347320
         | 
| 38 38 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 39 39 | 
             
              name: rdoc
         | 
| 40 | 
            -
              requirement: & | 
| 40 | 
            +
              requirement: &2152346840 !ruby/object:Gem::Requirement
         | 
| 41 41 | 
             
                none: false
         | 
| 42 42 | 
             
                requirements:
         | 
| 43 43 | 
             
                - - ! '>='
         | 
| @@ -45,10 +45,10 @@ dependencies: | |
| 45 45 | 
             
                    version: '0'
         | 
| 46 46 | 
             
              type: :development
         | 
| 47 47 | 
             
              prerelease: false
         | 
| 48 | 
            -
              version_requirements: * | 
| 48 | 
            +
              version_requirements: *2152346840
         | 
| 49 49 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 50 50 | 
             
              name: sqlite3
         | 
| 51 | 
            -
              requirement: & | 
| 51 | 
            +
              requirement: &2152346240 !ruby/object:Gem::Requirement
         | 
| 52 52 | 
             
                none: false
         | 
| 53 53 | 
             
                requirements:
         | 
| 54 54 | 
             
                - - ! '>='
         | 
| @@ -56,7 +56,7 @@ dependencies: | |
| 56 56 | 
             
                    version: '0'
         | 
| 57 57 | 
             
              type: :development
         | 
| 58 58 | 
             
              prerelease: false
         | 
| 59 | 
            -
              version_requirements: * | 
| 59 | 
            +
              version_requirements: *2152346240
         | 
| 60 60 | 
             
            description: This "acts_as" extension provides the capabilities for sorting and reordering
         | 
| 61 61 | 
             
              a number of objects in a list. The class that has this specified needs to have a
         | 
| 62 62 | 
             
              "position" column defined as an integer on the mapped database table.
         | 
| @@ -68,9 +68,9 @@ extra_rdoc_files: [] | |
| 68 68 | 
             
            files:
         | 
| 69 69 | 
             
            - .gemtest
         | 
| 70 70 | 
             
            - .gitignore
         | 
| 71 | 
            +
            - .travis.yml
         | 
| 71 72 | 
             
            - Gemfile
         | 
| 72 73 | 
             
            - README.md
         | 
| 73 | 
            -
            - README.rdoc
         | 
| 74 74 | 
             
            - Rakefile
         | 
| 75 75 | 
             
            - acts_as_list.gemspec
         | 
| 76 76 | 
             
            - init.rb
         | 
| @@ -82,6 +82,7 @@ files: | |
| 82 82 | 
             
            - test/shared_array_scope_list.rb
         | 
| 83 83 | 
             
            - test/shared_list.rb
         | 
| 84 84 | 
             
            - test/shared_list_sub.rb
         | 
| 85 | 
            +
            - test/shared_top_addition.rb
         | 
| 85 86 | 
             
            - test/shared_zero_based.rb
         | 
| 86 87 | 
             
            - test/test_list.rb
         | 
| 87 88 | 
             
            homepage: http://github.com/swanandp/acts_as_list
         | 
| @@ -114,5 +115,6 @@ test_files: | |
| 114 115 | 
             
            - test/shared_array_scope_list.rb
         | 
| 115 116 | 
             
            - test/shared_list.rb
         | 
| 116 117 | 
             
            - test/shared_list_sub.rb
         | 
| 118 | 
            +
            - test/shared_top_addition.rb
         | 
| 117 119 | 
             
            - test/shared_zero_based.rb
         | 
| 118 120 | 
             
            - test/test_list.rb
         | 
    
        data/README.rdoc
    DELETED
    
    | @@ -1,35 +0,0 @@ | |
| 1 | 
            -
            = ActsAsList
         | 
| 2 | 
            -
             | 
| 3 | 
            -
            == Description
         | 
| 4 | 
            -
             | 
| 5 | 
            -
            This acts_as extension provides the capabilities for sorting and reordering a number of objects in a list. The class that has this specified needs to have a +position+ column defined as an integer on the mapped database table.
         | 
| 6 | 
            -
             | 
| 7 | 
            -
             | 
| 8 | 
            -
            == Example
         | 
| 9 | 
            -
             | 
| 10 | 
            -
              class TodoList < ActiveRecord::Base
         | 
| 11 | 
            -
                has_many :todo_items, :order => "position"
         | 
| 12 | 
            -
              end
         | 
| 13 | 
            -
             | 
| 14 | 
            -
              class TodoItem < ActiveRecord::Base
         | 
| 15 | 
            -
                belongs_to :todo_list
         | 
| 16 | 
            -
                acts_as_list :scope => :todo_list
         | 
| 17 | 
            -
              end
         | 
| 18 | 
            -
             | 
| 19 | 
            -
              todo_list.first.move_to_bottom
         | 
| 20 | 
            -
              todo_list.last.move_higher
         | 
| 21 | 
            -
             | 
| 22 | 
            -
            == Contributing to acts_as_list
         | 
| 23 | 
            -
             
         | 
| 24 | 
            -
            * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
         | 
| 25 | 
            -
            * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
         | 
| 26 | 
            -
            * Fork the project
         | 
| 27 | 
            -
            * Start a feature/bugfix branch
         | 
| 28 | 
            -
            * Commit and push until you are happy with your contribution
         | 
| 29 | 
            -
            * Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
         | 
| 30 | 
            -
            * Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
         | 
| 31 | 
            -
             | 
| 32 | 
            -
            == Copyright
         | 
| 33 | 
            -
             | 
| 34 | 
            -
            Copyright (c) 2007 David Heinemeier Hansson, released under the MIT license
         | 
| 35 | 
            -
             |