【发布时间】:2016-05-27 13:43:29
【问题描述】:
我的 config/routes.rb 中有这个
resources :my_objects
我有 app/controllers/my_objects_controller.rb
def edit
respond_to do |format|
@my_object = MyObject.find(params[:id])
format.json {
render :json => @my_object
}
end
end
但是当我尝试使用(通过 GET)联系此 URL 时,我从 JQuery 中得到 404
http://localhost:3000/my_objects/edit/8
我也试过
http://localhost:3000/my_objects/edit?id=8
仍然得到 404。我需要使用什么正确的 URL 来从我的编辑链接中获取数据?
【问题讨论】:
-
你可以尝试运行
rake routes并将输出粘贴到这里
标签: ruby-on-rails ruby-on-rails-4 routes http-status-code-404 config