Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ruby-on-rails-3/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails 3 rails3:操作被路由到错误的控制器。可能的错误?_Ruby On Rails 3_Controller_Rails Routing - Fatal编程技术网

Ruby on rails 3 rails3:操作被路由到错误的控制器。可能的错误?

Ruby on rails 3 rails3:操作被路由到错误的控制器。可能的错误?,ruby-on-rails-3,controller,rails-routing,Ruby On Rails 3,Controller,Rails Routing,我有两个模型(用户和配置文件)具有1对1的关联 class Profile < ActiveRecord::Base attr_accessible :language_tokens, :tele, :languages, :serviceDesc, :service belongs_to :user ... class User < ActiveRecord::Base has_one :profile, dependent: :destroy 我的个人资料编辑

我有两个模型(用户和配置文件)具有1对1的关联

class Profile < ActiveRecord::Base
  attr_accessible :language_tokens, :tele, :languages, :serviceDesc, :service
  belongs_to :user
  ...

class User < ActiveRecord::Base
  has_one :profile, dependent: :destroy
我的个人资料编辑表单只是一个标准表单,提交后应发送到我的个人资料更新操作

<%= form_for @profile do |f| %>
  <%= render 'shared/host_information', :f => f%>
  <%= render 'shared/service_information', :f => f%>
  <%= f.submit 'done', class: "bnt"%>
<% end %>


HTML form:
<form id="edit_profile_6" class="edit_profile" method="post" action="/profiles/6" accept-charset="UTF-8">
以下是相关路线:

profiles POST   /profiles(.:format)                   profiles#create
new_profile GET    /profiles/new(.:format)               profiles#new
edit_profile GET    /profiles/:id/edit(.:format)          profiles#edit
profile PUT    /profiles/:id(.:format)               profiles#update

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
调试此问题的最佳方法是什么?这是一对一关联的一些奇怪的副作用还是这里有bug?我使用的是rails 3.2.2

*更新* 所以这看起来确实像一个bug。我重新生成了我的控制器(相同的名称)并复制了相同的代码,现在它在没有任何其他更改的情况下工作。我仍然有兴趣知道这是否是一个已知的问题,以及将来如何调试类似的问题

/railsapp/loco_app/app/controllers/users_controller.rb:82
@user = User.find_by_id(params[:id])
(rdb:15) p params
{"utf8"=>"✓", "_method"=>"put", "authenticity_token"=>"qXx5EWwIWASiARKVFE7eDd43gHnBSmK538YAXeesDyI=", "profile"=>{"country_id"=>"8", "city_id"=>"22", "tele"=>"", "language_tokens"=>"18,14", "service"=>"9",  },
"commit"=>"done", "action"=>"update", "controller"=>"profiles", "id"=>"6"}
(rdb:15)
profiles POST   /profiles(.:format)                   profiles#create
new_profile GET    /profiles/new(.:format)               profiles#new
edit_profile GET    /profiles/:id/edit(.:format)          profiles#edit
profile PUT    /profiles/:id(.:format)               profiles#update

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