finally, setting the display_name works.

This commit is contained in:
nilsding 2014-11-11 20:20:00 +01:00
parent 550824e287
commit fb48c6d995
3 changed files with 8 additions and 5 deletions

View File

@ -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

View File

@ -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

View File

@ -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"