-
-
Notifications
You must be signed in to change notification settings - Fork 357
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
position not updated with move_higher or move_lover #23
Comments
I put this into a unit test: https://github.com/nerab/acts_as_list_issue_23 My test passes with Rails 3.1.3 on Ruby 1.8.7. |
This seems like a serious bug. I am on it. |
Is there any status on this? |
Unfortunately, not yet. If anyone is willing to send pull request, I'll be more than glad to merge it. |
I've added a test case which is passing on 1.8.7 and 1.9.2. |
This might be a data caching issue. I tried the same thing, seems to work w/o issue. |
I've spent a few minutes trying to write a failing test with the existing test harnesses, but I can verify that the problem exists with the sqlite3 and PostgreSQL adapters. I'm continuing to investigate however I think the problem lies with #bottom_item. |
@jschairb When you verified the problem, did you actually check DB values? i.e. |
See brendon/acts_as_list#23 for context. We were seeing an issue in which moving a model up in the list would not update the models position property if there were two items in the list. For now, we're reloading the model after changing the position to ensure an accurate position property.
See brendon/acts_as_list#23 for context. We were seeing an issue in which moving a model up in the list would not update the models position property if there were two items in the list. For now, we're reloading the model after changing the position to ensure an accurate position property.
See brendon/acts_as_list#23 for context. We were seeing an issue in which moving a model up in the list would not update the models position property if there were two items in the list. For now, we're reloading the model after changing the position to ensure an accurate position property.
I have a strange behavior with acts_as_list, Rails 3.1 and Ruby 1.9.2p290.
Steps to reproduce
rails new asl_test
cd asl_test
gem 'acts_as_list', :git => 'https://github.com/swanandp/acts_as_list.git'
in gemfile.
bundle update
rails generate model Hand side:string
rails generate model Finger position:integer name:string hand_id:integer
bundle exec rake db:migrate
class Hand < ActiveRecord::Base
has_many :fingers
end
class Finger < ActiveRecord::Base
belongs_to :hand
acts_as_list :scope => :hand
end
rails console
lefty = Hand.create(:side => "left")
lefty.fingers.create(:name => "thumb")
lefty.fingers.create(:name => "index")
lefty.fingers.create(:name => "ring")
lefty.fingers.create(:name => "middle")
lefty.fingers.create(:name => "baby")
Let's see the fingers
lefty.fingers.each do |finger| puts "#{finger.position}: #{finger.name}" end
That gives what was inserted.
1: thumb
2: index
3: ring
4: middle
5: baby
But one finger is not at the good place so try to correct that.
lefty.fingers[3].move_lower
Let's see the fingers now
lefty.fingers.each do |finger| puts "#{finger.position}: #{finger.name}" end
The result is not what I expected
1: thumb
2: index
3: ring
5: middle
5: baby
I don't know why middle and ring where not interverted and why there are two fingers whose position is 5.
The text was updated successfully, but these errors were encountered: