RubyonRails

Profile Updation in Rails

Account Controller –>

session[:user_id]= self.current_user.id

HOME Controller inside:

def list
end

def search
@user = User.find(session[:user_id])
if @user.update_attributes (params[:user])
flash[:notice] = ‘User Name was successfully updated.’
redirect_to :action => ‘index’, :id => @user
else
redirect_to :action => ‘list’
end

end

LIST.RHTML

<%= start_form_tag :action => ‘search’ %>
<%= text_field ‘user’,’name’ %>
<%= text_field ‘user’,’age’ %>
<%= submit_tag ‘Update Profile’ %>

<% end_form_tag %>

INDEX.RHTML

<%= flash[:notice] %>