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