0

是正確的,但問題仍然存在,我做的所有代碼到所有你看到的路由錯誤的Rails,不undertand

Routing Error 

No route matches {:controller=>"posts", :user_id=>#<Post id: 1, title: "sa", content: "sasa", created_at: "2013-01-06 00:25:03", updated_at: "2013-01-06 00:25:03", image_file_name: nil, image_content_type: nil, image_file_size: nil, image_updated_at: nil, user_id: 1>, :action=>"edit"} 
Try running rake routes for more information on available routes. 

我的路線是:

get "painel/index" 

resources :posts 

    resources :user do 
    resources :posts,:comments 

     end 

和我的模型是:

user.rb 

    attr_accessible :email, :password, :password_confirmation,:username 
    has_many :posts 
    has_many :comments 

post.rb 

    attr_accessible :content, :title ,:image 
    has_many :comments 
    belongs_to :user 
+2

它看起來像b/n:posts資源和:user /:posts資源不匹配,而不是將控制器設置爲'posts',你可能希望它是'user/posts'。 .. 請告訴我們你是如何調用該路線(即link_to呼叫...)。 –

回答

0

1)檢查 '耙路線'
2)使用你的路線列表獲取URL或路徑。這將解決你的錯誤

如果這並不能解決你的錯誤,
粘貼你的路線文件和link_to調用哪個返回錯誤。