Make acts_as_list work for insert_at(1) #1966 [hensleyl@papermountain.org]

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2008 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
This commit is contained in:
Jamis Buck 2005-08-14 08:35:08 +00:00
parent e17bf81823
commit 85c603fc9e
3 changed files with 12 additions and 1 deletions

@ -1,5 +1,7 @@
*SVN*
* Make acts_as_list work for insert_at(1) #1966 [hensleyl@papermountain.org]
* Fix typo in count_by_sql documentation #1969 [Alexey Verkhovsky]
* Allow add_column and create_table to specify NOT NULL #1712 [emptysands@gmail.com]

@ -72,7 +72,7 @@ def position_column
# the first in the list of all chapters.
module InstanceMethods
def insert_at(position = 1)
position == 1 ? add_to_list_top : insert_at_position(position)
insert_at_position(position)
end
def move_lower

@ -142,6 +142,15 @@ def test_insert_at
new4.reload
assert_equal 4, new4.pos
new5 = ListMixin.create("parent_id" => 20)
assert_equal 5, new5.pos
new5.insert_at(1)
assert_equal 1, new5.pos
new4.reload
assert_equal 5, new4.pos
end
def test_delete_middle