finally, setting the display_name works.
This commit is contained in:
parent
550824e287
commit
fb48c6d995
|
@ -9,9 +9,10 @@ class UserController < ApplicationController
|
|||
|
||||
def update
|
||||
authenticate_user!
|
||||
params.require(:display_name)
|
||||
current_user.display_name = params[:display_name]
|
||||
current_user.save!
|
||||
user_attributes = params.require(:user).permit(:display_name)
|
||||
unless current_user.update_attributes(user_attributes)
|
||||
flash[:error] = "fork it"
|
||||
end
|
||||
redirect_to edit_user_profile_path
|
||||
end
|
||||
end
|
||||
|
|
|
@ -16,6 +16,8 @@ class User < ActiveRecord::Base
|
|||
|
||||
validates :screen_name, presence: true, format: { with: SCREEN_NAME_REGEX }, uniqueness: { case_sensitive: false }
|
||||
|
||||
|
||||
|
||||
def login=(login)
|
||||
@login = login
|
||||
end
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
.col-md-9.col-xs-12.col-sm-9
|
||||
.panel.panel-default
|
||||
.panel-body
|
||||
= bootstrap_form_for(update_user_profile_path, method: "patch") do |f|
|
||||
= bootstrap_form_for(:user, method: "patch") do |f|
|
||||
|
||||
= f.text_field :display_name, label: "Your name"
|
||||
|
||||
|
|
Loading…
Reference in New Issue