app/controllers/users_controller.rb
def create
    @user = User.new( params[:user] )  
    
    if(@user.valid?)
      @user.password = params[:user][:password]
      @user.password_confirmation = @user.password  
      if @user.save
        flash[:notice] = 'User has been successfully created'
        redirect_to :action => 'list'
      else
        flash[:notice] = 'Updating error'
        @user.password = nil
        @user.password_confirmation = nil
        render :action => 'new'
      end
    else
      @user.password = nil
      @user.password_confirmation = nil
      render :action => 'new'
    end
  
  end
#
# Creates new user basing on params passed in form
# params[:user]
#

Creates new user basing on params passed in form
params[:user]
Creates new user basing on params passed in form params [ : user ]
def create
    @user = User.new( params[:user] )  
    if(@user.valid?)
      @user.password = params[:user][:password]
      @user.password_confirmation = @user.password  
      if @user.save
        flash[:notice] = 'User has been successfully created'
        redirect_to :action => 'list'
      else
        flash[:notice] = 'Updating error'
        @user.password = nil
        @user.password_confirmation = nil
        render :action => 'new'
      end
    else
      @user.password = nil
      @user.password_confirmation = nil
      render :action => 'new'
    end
  end
def create @user = User . new ( params [ :user ] ) if ( @user . valid? ) @user . password = params [ :user ] [ :password ] @user . password_confirmation = @user . password if @user . save flash [ :notice ] = 'User has been successfully created' redirect_to :action => 'list' else flash [ :notice ] = 'Updating error' @user . password = nil @user . password_confirmation = nil render :action => 'new' end else @user . password = nil @user . password_confirmation = nil render :action => 'new' end end
Creates new user basing on params passed in form
params[:user]
Creates new user basing on params passed in form params [ : user ]