Jump to content


Check out our Community Blogs

Register and join over 40,000 other developers!


Recent Status Updates

View All Updates

Photo
- - - - -

Why not user update on ruby on rails

ruby on rails

This topic has been archived. This means that you cannot reply to this topic.
No replies to this topic

#1 shabbir149

shabbir149

    CC Lurker

  • Just Joined
  • Pip
  • 1 posts

Posted 15 January 2016 - 11:50 PM

Hi All, I can't update my user information.

This is controller



  def edit
    @users= current_user
  end

  def update
    @users= current_user
    if @users.update_attributes(user_params)
      # Handle a successful update.
      flash[:notice] = "Your profile updated"
      render 'edit'
    else
      render 'edit'
    end
  end

  private

  def user_params
    params.require(:users).permit(:first_name, :last_name, :father_name,
:mother_name )
  end

View
<%= form_for :users, url: upload_resumes_path(@users), action: :update,
method: :post  do |f| %>
  <%= f.text_field :first_name %>
  <%= f.text_field :last_name %>
  <%= f.text_field :father_name %>
  <%= f.text_field :mother_name %>
  <%= f.submit "Submit" %>
<% end %>

Routes:
  get  'users'   => 'users#edit'
  post  'users'   => 'users#update'

Edited by shabbir149, 15 January 2016 - 11:52 PM.