Ruby-on-rails gem 因“where”而失败meta_where 的条件
我有一个问题,可能是宝石问题,但可能是元问题。我使用gems安装meta_where-1.0.4,响应是我成功了,并且提供了meta_where的uri,但是当我在控制器的搜索方法中尝试where-条件时,类似于这个例子,meta-where提供:
Person.where(:skill_set.matches => 'Hello%'
报告错误:
"undefined method 'matches' for :skill_set:Symbol"
就好像宝石的方法没有被访问一样。我尝试使用“require”,但这没有帮助。
我使用的是 Windows XP、Firefox、Ruby 1.9.2。
我需要做什么? 谢谢,巴尼
I have a question about what is probably a gems problem, but may be meta-where. I used gems to install meta_where-1.0.4, and the response was that I succeeded and the uri for meta_where was provided, but when I tried a where-condition in the search method of a controller, similar to this example that meta-where provides:
Person.where(:skill_set.matches => 'Hello%'
an error was reported:
"undefined method 'matches' for :skill_set:Symbol"
It's as if the gem's methods aren't being accessed. I tried using "require" but that didn't help.
I'm using Windows XP, Firefox, Ruby 1.9.2.
What do I need to do?
Thanks, Barney
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我假设您已经运行了迁移,并且
person
表中有一个skill_set
属性:您不需要require
。只需将'gem meta_where'
添加到您的 Gemfile 中,然后运行 'bundle install'
即可。I assume you have run the migrations and there is a
skill_set
attribute in theperson
table: you don't needrequire
. Just add'gem meta_where'
to your Gemfile and then run'bundle install'
.