我通過將以下行的Gemfile和「包安裝」安裝:有沒有人得到acts_as_list在rails 3上工作?
gem 'acts_as_list', '>= 0.1.0'
然而,當我嘗試使用它,是因爲預期的效果不是:
technician.move_to_top #works => position = 1
technician.move_to_bottom #does not work properly; also makes position = 1
technician.move_higher #does not work; returns nil
technician.move_lower #does not work; also returns nil
這是否插件只是不使用導軌3或我錯過了一個步驟?
這裏是我使用的代碼:
class WorkQueue < ActiveRecord::Base
has_many :technicians, :order => "position"
end
class Technician < ActiveRecord::Base
belongs_to :work_queue
acts_as_list :scope => "work_queue_id" #I also tried using work_queue
end
這是控制檯:
wq = WorkQueue.new
technician = Technician.last
wq.technicians << technician
可能是位置不是連續的數字? – lulalala 2012-07-02 10:19:16
使用gem acts_as_lists https://github.com/swanandp/acts_as_list時面臨同樣的問題。你有沒有找到如何解決它。我正在使用** Rails 3.2.2 ** – 2012-10-24 13:25:15