Class: Paginas::CategoriesController

Inherits:
ApplicationController show all
Defined in:
app/controllers/paginas/categories_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



15
16
17
18
19
20
21
22
# File 'app/controllers/paginas/categories_controller.rb', line 15

def create
  @category = Category.new(category_params)
  if @category.save
    redirect_to @category, notice: 'Category was successfully created.'
  else
    render :new
  end
end

#destroyObject



30
31
32
33
# File 'app/controllers/paginas/categories_controller.rb', line 30

def destroy
  @category.destroy
  redirect_to categories_url, notice: 'Category was successfully destroyed.'
end

#editObject



13
14
# File 'app/controllers/paginas/categories_controller.rb', line 13

def edit
end

#indexObject



5
6
7
# File 'app/controllers/paginas/categories_controller.rb', line 5

def index
  @categories = Category.all
end

#newObject



10
11
12
# File 'app/controllers/paginas/categories_controller.rb', line 10

def new
  @category = Category.new
end

#showObject



8
9
# File 'app/controllers/paginas/categories_controller.rb', line 8

def show
end

#updateObject



23
24
25
26
27
28
29
# File 'app/controllers/paginas/categories_controller.rb', line 23

def update
  if @category.update(category_params)
    redirect_to @category, notice: 'Category was successfully updated.'
  else
    render :edit
  end
end