【发布时间】:2013-01-10 11:52:19
【问题描述】:
我正在 Rails 中创建 REST 服务。这是我的路线。
resources :users
match '/users', :controller => 'users', :action => 'options', :constraints => {:method => 'OPTIONS'}
我能够 [GET] 我的用户。我正在尝试更新我的用户,但出现错误:
ActionController::RoutingError (No route matches [OPTIONS] "/users/1"):
当我运行rake routes 时,这是给我的路线:
users GET /users(.:format) users#index
POST /users(.:format) users#create
new_user GET /users/new(.:format) users#new
edit_user GET /users/:id/edit(.:format) users#edit
user GET /users/:id(.:format) users#show
PUT /users/:id(.:format) users#update
DELETE /users/:id(.:format) users#destroy
/users(.:format) users#options {:method=>"OPTIONS"}
有人可以告诉我如何修复我的路线,以便我可以进行任何类型的 REST 调用吗?谢谢。
【问题讨论】:
标签: ruby-on-rails-3 rest activerecord routes