gpt4 book ai didi

ruby-on-rails-3 - 有没有人让acts_as_list 在rails 3 上工作?

转载 作者:行者123 更新时间:2023-12-04 17:04:55 24 4
gpt4 key购买 nike

我通过将以下行放在 Gemfile 和“捆绑安装”中进行安装:

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

这个插件是否不适用于 rails 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

最佳答案

不要使用 "acts-as-list"gem,因为这个 gem 很长一段时间都不会更新。

尝试这个:

rails plugin install git://github.com/swanandp/acts_as_list.git

关于ruby-on-rails-3 - 有没有人让acts_as_list 在rails 3 上工作?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4505591/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com