有条件:使用thinking_sphinx
我的控制器中有以下行
@articles = Article.search 'pancakes', :with => {:author_id => params[:id]}
,只要指定了 params[:id] ,它就可以正常工作,但如果没有指定,它就会失败
searchd error (status: 1): invalid or truncated request
所以我的问题是,是否有 :with => ; {:author_id =>; params[:id]} 条件是它们是有效的 params[:id]
谢谢
I have the following line in my controller
@articles = Article.search 'pancakes', :with => {:author_id => params[:id]}
and it works fine as long as I have a params[:id] specified, but if I don't, it fails with
searchd error (status: 1): invalid or truncated request
So my question is, is there anyway to have the :with => {:author_id => params[:id]} conditional on their being a valid params[:id]
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)