我目前有一个路线文件
devise_for :users, controllers: {omniauth_callbacks: "omniauth_callbacks"}
resources :users do
resources :posts
end
match "posts" => "posts#main"
get "home/index"
root :to => 'home#index'
end
我现在想做的是,也显示/users/:user_id/problems/:id
为/problems/:id
. 但不确定我应该如何将它放入路线?
注意:我确实在用户和帖子之间有关系。
class User < ActiveRecord::Base
has_many :posts
和
class Post < ActiveRecord::Base
belongs_to :user
谢谢
UDPATE:我得到的错误是Couldn't find User without an ID