Class: FeatureBox::CategoriesController
Instance Method Summary
collapse
#current_ability, #pages_helper, #retrieve_vars
Methods included from Helpers
define_helpers, included
Instance Method Details
#create ⇒ Object
19
20
21
22
23
24
25
26
|
# File 'app/controllers/feature_box/categories_controller.rb', line 19
def create
@category.name = params[:category][:name]
if @category.save
redirect_to categories_path, notice: 'Category was successfully created.'
else
render action: "new"
end
end
|
#destroy ⇒ Object
37
38
39
40
|
# File 'app/controllers/feature_box/categories_controller.rb', line 37
def destroy
@category.destroy
redirect_to categories_path, notice: 'Category was successfully deleted.'
end
|
#edit ⇒ Object
16
17
|
# File 'app/controllers/feature_box/categories_controller.rb', line 16
def edit
end
|
#index ⇒ Object
5
6
7
8
9
10
11
|
# File 'app/controllers/feature_box/categories_controller.rb', line 5
def index
pages_helper do |limit,offset|
@real_categories = Category.limit(limit).offset(offset)
@total = Category.count
@offset = offset
end
end
|
#new ⇒ Object
13
14
|
# File 'app/controllers/feature_box/categories_controller.rb', line 13
def new
end
|
#update ⇒ Object
28
29
30
31
32
33
34
35
|
# File 'app/controllers/feature_box/categories_controller.rb', line 28
def update
@category.name = params[:category][:name]
if @category.save
redirect_to categories_path, notice: 'Category was successfully updated.'
else
render action: "edit"
end
end
|