Class: Binda::CategoriesController
Instance Method Summary
collapse
#after_sign_in_path_for, #after_sign_out_path_for, #set_locale
Instance Method Details
#create ⇒ Object
23
24
25
26
27
28
29
30
|
# File 'app/controllers/binda/categories_controller.rb', line 23
def create
@category = @structure.categories.build(category_params)
if @category.save
redirect_to structure_category_path( @structure.slug, @category.slug ), notice: 'Category was successfully created.'
else
redirect_to structure_category_path( @structure.slug, @category.slug )
end
end
|
#destroy ⇒ Object
40
41
42
43
|
# File 'app/controllers/binda/categories_controller.rb', line 40
def destroy
@category.destroy
redirect_to structure_categories_url( @structure.slug ), notice: 'Category was successfully destroyed.'
end
|
#edit ⇒ Object
20
21
|
# File 'app/controllers/binda/categories_controller.rb', line 20
def edit
end
|
#index ⇒ Object
8
9
10
|
# File 'app/controllers/binda/categories_controller.rb', line 8
def index
@categories = @structure.categories.order(:name).all
end
|
#new ⇒ Object
16
17
18
|
# File 'app/controllers/binda/categories_controller.rb', line 16
def new
@category = @structure.categories.build()
end
|
#show ⇒ Object
12
13
14
|
# File 'app/controllers/binda/categories_controller.rb', line 12
def show
redirect_to action: :edit
end
|
#update ⇒ Object
32
33
34
35
36
37
38
|
# File 'app/controllers/binda/categories_controller.rb', line 32
def update
if @category.update(category_params)
redirect_to structure_category_path( @structure.slug, @category.slug ), notice: 'Category was successfully updated.'
else
redirect_to structure_category_path( @structure.slug, @category.slug )
end
end
|