# Only able to update email but fname etc not updating

**URL:** <https://www.ruby-forum.com/t/only-able-to-update-email-but-fname-etc-not-updating/152986>\
**Category:** Rails\
**Created:** [November 10, 2008, 9:54pm UTC](https://www.ruby-forum.com/t/only-able-to-update-email-but-fname-etc-not-updating/152986 "2008-11-10T21:54:10Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![bababobo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/6a8cbe/32.png) [@bababobo](https://www.ruby-forum.com/u/bababobo)\
**Post date:** [November 10, 2008, 9:54pm UTC](https://www.ruby-forum.com/t/only-able-to-update-email-but-fname-etc-not-updating/152986/1 "2008-11-10T21:54:10Z")

</div>

I am using Restful\_Authentication plugin for login/logout. I am trying  
to update the profile page which has columns email and fname etc, its  
updating only the email column but not updating the fname and other  
columns once i hit save and gives me flash message as 'Profile was  
successfully updated. Please let me know how can i fix it to update all  
fields not just email field.

– following is the code in my users\_controller.rb :-

class UsersController \< ApplicationController

# render new.rhtml

def new  
@title = ‘new’  
end

def create  
cookies.delete :auth\_token  
# protects against session fixation attacks, wreaks havoc with  
# request forgery protection.  
# uncomment at your own risk  
# reset\_session  
@user = User.new(params[:user])  
@user.save  
if @user.errors.empty?  
self.current\_user = @user  
redirect\_back\_or\_default(’/session/new’)  
flash[:notice] = “Thanks for signing up!”  
else  
render :action =\> ‘new’  
end  
end

def update  
@user = User.find(params[:id])

```
respond_to do |format|
  if @user.update_attributes(params[:user])
    flash[:notice] = 'Profile was successfully updated.'
    format.html { redirect_to :controller => 'sessions', :action =>

```

‘edit\_profile’ }  
format.xml { head :ok }  
else  
flash[:error] = ‘Unable to update profile.’  
format.html { render :controller =\> ‘sessions’, :action =\>  
‘edit\_profile’ }  
format.xml { render :xml =\> @user.errors, :status =\>  
:unprocessable\_entity }  
end  
end  
end

def edit  
@user = User.find(params[:id])  
end

end

– following is the code in my edit\_profile.html.erb file located in  
(views/sessions/edit\_profile):-

## Edit Profile
\<% form\_for @current\_user do |f| %\> \<%= f.error\_messages %\> 

\<%= f.label :email %\>  
 \<%= f.text\_field :email %\>

\<%= f.label :fname %\>  
 \<%= f.text\_field :fname %\>

\<%= f.label :middle\_name %\>  
 \<%= f.text\_field :mname %\>

\<%= f.label :last\_name %\>  
 \<%= f.text\_field :lname %\>

\<%= f.submit "Save" %\>

\<% end %\>

---

<div class="post-metadata">

**Author:** ![bababobo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/6a8cbe/32.png) [@bababobo](https://www.ruby-forum.com/u/bababobo)\
**Post date:** [November 10, 2008, 9:55pm UTC](https://www.ruby-forum.com/t/only-able-to-update-email-but-fname-etc-not-updating/152986/2 "2008-11-10T21:55:37Z")

</div>

attached is my sessions\_controller.rb (its is mostly generated by  
restfull authentication plugin)
