一切正确,但错误仍然存在,我为所有你看到的所有代码
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
答案 0 :(得分:0)
1)检查'rake routes' 2)使用您在路线列表中获得的URL或路径。这将解决您的错误
如果这不能解决您的错误, 粘贴您的路由文件和link_to调用哪个返回错误。