使用 AR_Extensions查找器指定“not_in”
我尝试使用 AR-Extensions 查找器但没有成功:
我的代码:
Post.all(:conditions=>{:updated_at_not_in=>2.weeks.ago..Date.today}}
我得到“updated_at_not_in:未知列”。
我缺少什么吗?
附注 在 Post 模型中我需要:
require 'ar-extensions'
require 'ar-extensions/adapters/mysql'
require 'ar-extensions/import/mysql'
我正在使用 MySQL、Rails 2.3.8
I'm trying to use AR-Extensions finders without success:
My code:
Post.all(:conditions=>{:updated_at_not_in=>2.weeks.ago..Date.today}}
I get "updated_at_not_in: unknown column".
Anything I am missing?
p.s.
In the Post model I have required:
require 'ar-extensions'
require 'ar-extensions/adapters/mysql'
require 'ar-extensions/import/mysql'
I'm using MySQL, Rails 2.3.8
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不要回避这个问题。我还没有时间研究您所得到的内容,但是当您升级到 Rails 3.x 后,此语法不再可用。我已将其从 activerecord-import 中删除,并且不打算将其作为自己的 gem 引入。当我在 2006 年第一次编写这段代码时,我希望激励 Rails-core 团队引入一种更具可插拔性的架构,以便在数据库适配器上拥有更好的查找器,但它从未实现。对于您在这个问题上花费的时间,我深表歉意。
Not to skirt around the issue. I haven't had time to investigate what you're getting, but this syntax is no longer available as you upgrade to Rails 3.x. I have removed it from activerecord-import and have no plans to introduce it as its own gem. When I first wrote this code in 2006 I was hoping to inspire the rails-core team to introduce a more pluggable architecture for having better finders across database adapters, but it never took. I apologize for any time you spent with this issue.