1

在我的 Rails 应用程序中,我嵌套了如下路线:-

resources :users do
  resources :posts do
  end
end

假设我需要获取单个用户帖子的所有评论。我应该使用 fetch 功能来收集帖子。

class DemoApp.Collections.Posts extends Backbone.Collection
// here my url should consist of user_id  and action where the posts
// are being fetched.
url: "/users/user_id/posts"

为了获取评论,我应该在对象上调用 fetch 函数。

 posts = DemoApp.Collections.Posts 
 posts.fetch()

我在传递 user_id 时遇到问题。

Gem 使用了骨干轨 (0.9.2.1)

红宝石版本 1.9.3

轨道版本 3.2.1

4

0 回答 0