这是我的路线档案:
devise_for :users, :controllers => { :omniauth_callbacks => "users/omniauth_callbacks" }
resources :users do
post 'update_and_sign_in', :on => :member
end
以下是佣金路线的输出:
update_and_sign_in_user POST /users/:id/update_and_sign_in(.:format) users#update_and_sign_in
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
这是控制器:
def update_and_sign_in
@user = User.find(params[:id])
if @user.update_attributes(params[:user])
redirect_to root_path, :notice => "You have successfully signed up"
else
render 'get_email'
end
end
以下是表格:
=form_for(@user,:url => update_and_sign_in_user,:method => "put", :html => {:class => 'well'}) do |f|
我收到此错误,我无法弄清楚为什么或如何解决它:
No route matches {:action=>"update_and_sign_in", :controller=>"users"}
答案 0 :(得分:0)
您的路线是POST,但表单中的方法是PUT。
答案 1 :(得分:0)
只是为了澄清:哪个控制器是:
def update_and_sign_in
@user = User.find(params[:id])
if @user.update_attributes(params[:user])
redirect_to root_path, :notice => "You have successfully signed up"
else
render 'get_email'
end
end
上? UsersController或Users :: OmniauthCallbacksController?