都是正确的,但错误仍然存在,我把所有的代码都给你看到了
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