Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ruby-on-rails/52.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/unix/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails 在Rails中查找集合_Ruby On Rails_Ember Data - Fatal编程技术网

Ruby on rails 在Rails中查找集合

Ruby on rails 在Rails中查找集合,ruby-on-rails,ember-data,Ruby On Rails,Ember Data,我是Rails noob,但我想将其用作带有Ember数据的Ember应用程序的后端。不幸的是,我有一些未知的东西 RESTAdapter文档说明: 帖子的评论可以通过post.get(“评论”)加载。其余的 适配器将向/comments?ids[]=1&ids[]=2&ids[]=3发送GET请求 如果您使用类似App.Post.find({title:“Some title”})的东西,它将生成类似的URL,格式与您期望的格式大致相同:/posts?title=Some+title 是否有一

我是Rails noob,但我想将其用作带有Ember数据的Ember应用程序的后端。不幸的是,我有一些未知的东西

RESTAdapter文档说明:

帖子的评论可以通过post.get(“评论”)加载。其余的 适配器将向/comments?ids[]=1&ids[]=2&ids[]=3发送GET请求

如果您使用类似App.Post.find({title:“Some title”})的东西,它将生成类似的URL,格式与您期望的格式大致相同:/posts?title=Some+title

是否有一些选项或gem可以用来处理这种简单的查询,或者我必须手动解析控制器中的参数

为了澄清,我知道我可以告诉我的Rails控制器返回一个集合,如:

@comments = Comment.find(params[:ids])
respond_with(@comments)
但对于RESTAPI来说,查询ID或类似的可访问属性似乎是一个足够常见的用例,可以内置一些东西,或者编写一个gem来处理它

谁能给我指出正确的方向吗


谢谢。

这可能对您的情况有所帮助:


洗劫看起来很有希望。非常感谢。