Method: CategoriesController#create

Defined in:
app/controllers/categories_controller.rb

#createObject

POST /categories POST /categories.json



36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'app/controllers/categories_controller.rb', line 36

def create
  @category = Category.new(params[:category])

  respond_to do |format|
    if @category.save
      format.html { redirect_to @category, notice: 'Category was successfully created.' }
      format.json { render json: @category, status: :created, location: @category }
    else
      format.html { render action: "new" }
      format.json { render json: @category.errors, status: :unprocessable_entity }
    end
  end
end