Gemfileと'bundleinstall'に次の行を入れてインストールしました:
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
このプラグインはrails3で機能しないのですか、それともステップがありませんか?
これが私が使用しているコードです:
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