我试图从与默认注册/编辑视图不同的视图更新我的用户。我还没有完全设置好表格,但是我一开始就遇到了路由问题。尝试在设计中更新用户,当表单呈现在注册之外时出现问题/编辑
这是我的形式:
%section#profile-editor
.row
.small-12.columns
%h2 Edit Profile
.row
.small-12.columns
.well
=form_tag(edit_thing_registration_path,method: 'PUT', id: "my-awesome-dropzone.dropzone") do
.row
.small-4.columns
%input#photo-dropzone{:name => "file", :type => "file"}/
.small-8.columns
.row
.small-12.columns
%label{:for => "Name"} Name
%input{:name => "Name", :type => "text"}/
.small-6.columns
%label{:for => "Website"} Website
%input{:name => "Website", :type => "text"}/
.small-6.columns
%label{:for => "Itunes"} Itunes URL
%input{:name => "Itunes", :type => "text"}/
.small-6.columns
%label{:for => "Video"} Youtube Video URL (For Profile)
%input{:name => "Video", :type => "text"}/
.small-6.columns
%label{:for => "Email"} Admin Email
%input{:name => "Email", :type => "text"}/
.row
.small-12.columns.pad-top
%label{:for => "RTE"} Content
%input.jqte{:name => "input", :type => "text", :value => ""}/
= submit_tag "Submit", class: "button button-green"
这是我的路线:
devise_for :things, controllers: { registrations: "things/devise/registrations", sessions: "things/devise/sessions"}
控制器:
class things::Devise::RegistrationsController < Devise::RegistrationsController
def update
# For Rails 4
account_update_params = devise_parameter_sanitizer.sanitize(:account_update)
# For Rails 3
# account_update_params = params[:user]
# required for settings form to submit when password is left blank
if account_update_params[:password].blank?
account_update_params.delete("password")
account_update_params.delete("password_confirmation")
end
@user = thing.find(current_thing.id)
if @user.update_attributes(account_update_params)
set_flash_message :notice, :updated
# Sign in the user bypassing validation in case their password changed
sign_in @user, :bypass => true
redirect_to thing_path(@user)
else
render "edit"
end
end
什么,当我点击提交发生了:
No route matches [PUT] "/things/edit"
条
耙路线:
new_thing_session GET /things/sign_in(.:format) things/devise/sessions#new
thing_session POST /things/sign_in(.:format) things/devise/sessions#create
destroy_thing_session DELETE /things/sign_out(.:format) things/devise/sessions#destroy
thing_password POST /things/password(.:format) devise/passwords#create
new_thing_password GET /things/password/new(.:format) devise/passwords#new
edit_thing_password GET /things/password/edit(.:format) devise/passwords#edit
PATCH /things/password(.:format) devise/passwords#update
PUT /things/password(.:format) devise/passwords#update
cancel_thing_registration GET /things/cancel(.:format) things/devise/registrations#cancel
thing_registration POST /things(.:format) things/devise/registrations#create
new_thing_registration GET /things/sign_up(.:format) things/devise/registrations#new
edit_thing_registration GET /things/edit(.:format) things/devise/registrations#edit
PATCH /things(.:format) things/devise/registrations#update
PUT /things(.:format) things/devise/registrations#update
DELETE /things(.:format) things/devise/registrations#destroy
'rake routes'的输出是什么? – rossta 2014-10-04 13:27:58
增加了耙路线输出 – TuxedoTomson 2014-10-04 20:07:19