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:
parent
e17bf81823
commit
85c603fc9e
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user