POST /users POST /users.json
START:create
# File app/controllers/users_controller.rb, line 31 def create @user = User.new(user_params) respond_to do |format| if @user.save format.html { redirect_to users_url, notice: "User #{@user.name} was successfully created." } format.json { render action: 'show', status: :created, location: @user } else format.html { render action: 'new' } format.json { render json: @user.errors, status: :unprocessable_entity } end end end
DELETE /users/1 DELETE /users/1.json
START:delete_user
# File app/controllers/users_controller.rb, line 74 def destroy begin @user.destroy flash[:notice] = "User #{@user.name} deleted" rescue Exception => e flash[:notice] = e.message end respond_to do |format| format.html { redirect_to users_url } format.json { head :no_content } end end
GET /users/1/edit
# File app/controllers/users_controller.rb, line 25 def edit end
GET /users GET /users.json
START:index
# File app/controllers/users_controller.rb, line 7 def index @users = User.order(:name) end
GET /users/new
# File app/controllers/users_controller.rb, line 20 def new @user = User.new end
GET /users/1 GET /users/1.json
# File app/controllers/users_controller.rb, line 16 def show end
PATCH/PUT /users/1 PATCH/PUT /users/1.json
START:update
# File app/controllers/users_controller.rb, line 54 def update respond_to do |format| if @user.update(user_params) format.html { redirect_to users_url, notice: "User #{@user.name} was successfully updated." } format.json { head :no_content } else format.html { render action: 'edit' } format.json { render json: @user.errors, status: :unprocessable_entity } end end end