这是我的路线文件:
devise_for :users, :controllers => { :omniauth_callbacks => "users/omniauth_callbacks" }
resources :users do
post 'update_and_sign_in', :on => :member
end
这是 rake 路由的输出:
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"}