Only able to update email but fname etc not updating


#1

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

#2

attached is my sessions_controller.rb (its is mostly generated by
restfull authentication plugin)