0
我有一個自定義Devise窗體,我想更新我的設計用戶。但是from不保存更改。自定義設計更新表單不保存更改
形式:
.small-12.columns
.well
=form_tag(test_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_tag :name
= text_field_tag :name
= submit_tag "Submit", class: "button button-green"
登錄:
Started PUT "/tests" for 127.0.0.1 at 2014-10-06 11:48:04 -0700
Processing by Tests::Devise::RegistrationsController#update as HTML
Parameters: {"utf8"=>"✓", "authenticity_token"=>"0R7keMt16tsIdjawQHE7yq15Ye6V/w5I4klAvs1WWLY=", "name"=>"testt", "commit"=>"Submit"}
Artist Load (0.4ms) SELECT "artists".* FROM "artists" WHERE "artists"."id" = 19 ORDER BY "artists"."id" ASC LIMIT 1
Artist Load (0.2ms) SELECT "artists".* FROM "artists" WHERE "artists"."id" = $1 LIMIT 1 [["id", 19]]
(0.1ms) BEGIN
(0.1ms) COMMIT
Redirected to http://site.dev/artists/19
Completed 302 Found in 5ms (ActiveRecord: 0.8ms)
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 = Test.find(current_test.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 artist_path(@user)
else
render "edit"
end
end
什麼我必須做正確更新我的PARAMS?