class UsersController

Public Instance Methods

create() click to toggle source

POST /users POST /users.json

# File app/controllers/users_controller.rb, line 31
def create
  @user = User.new(params[:user])

  respond_to do |format|
    if @user.save
      format.html { redirect_to @user, notice: 'User was successfully created.' }
      format.json { render json: @user, status: :created, location: @user }
    else
      format.html { render action: "new" }
      format.json { render json: @user.errors, status: :unprocessable_entity }
    end
  end
end
destroy() click to toggle source

DELETE /users/1 DELETE /users/1.json

# File app/controllers/users_controller.rb, line 66
def destroy
  @user = User.find(params[:id])
  @user.destroy

  respond_to do |format|
    format.html { redirect_to users_url }
    format.json { head :no_content }
  end
end
edit() click to toggle source

GET /users/1/edit

# File app/controllers/users_controller.rb, line 25
def edit
  @user = User.find(params[:id])
end
new() click to toggle source

GET /users/new GET /users/new.json

# File app/controllers/users_controller.rb, line 15
def new
  @user = User.new

  respond_to do |format|
    format.html # new.html.erb

    format.json { render json: @user }
  end
end
show() click to toggle source

GET /users/1 GET /users/1.json

# File app/controllers/users_controller.rb, line 4
def show
  @user = User.find(params[:id])

  respond_to do |format|
    format.html # show.html.erb

    format.json { render json: @user }
  end
end
update() click to toggle source

PUT /users/1 PUT /users/1.json

# File app/controllers/users_controller.rb, line 47
def update
  @user = User.find(params[:id])

  respond_to do |format|
    if @user.update_attributes(params[:user])
      format.html { redirect_to({:controller=> "projects", :action => "new"}, {:notice => 'Project was successfully created.'}) }
                              format.json { head :no_content }
    else
      format.html { render action: "edit" }
      format.json { render json: @user.errors, status: :unprocessable_entity }
    end
  end
end