我有一个 rails 4 应用程序,我想在其中使用 Best in Place 或 Rest in Place 或任何 gem 来提供就地编辑。
这两个我都试过了。对于这两者,我将用户的“名称”属性设置为可编辑。
当我访问用户的显示页面时,单击名称并出现输入字段。但是提交时,它不会更新记录。
日志:
Processing by UsersController#update as JSON
Parameters: {"user"=>{"name"=>"lkj"}, "authenticity_token"=>"TOz1cbnLc5KrX5JLZl0hiOsf7ZvwXhp6lD2qUIfH+og=", "id"=>"7"}
User Load (0.1ms) SELECT "users".* FROM "users" WHERE "users"."remember_token" = '62f0af062cc8544a31bfe5a02ef00bf34d449959' LIMIT 1
User Load (0.3ms) SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1 [["id", "7"]]
(0.1ms) begin transaction
User Exists (0.2ms) SELECT 1 AS one FROM "users" WHERE (LOWER("users"."email") = LOWER('juan@juan.com') AND "users"."id" != 7) LIMIT 1
(0.1ms) rollback transaction
Completed 500 Internal Server Error in 41ms
发送的消息是否是 PUT 而不是 PATCH?
我在用户控制器中的更新操作:
def update
if @user.update_attributes(user_params)
flash[:success] = "Perfil actualizado"
sign_in @user
redirect_to @user
else
render 'edit'
end
end
任何帮助都感激不尽。
谢谢!