Class: FeatureBox::CategoriesController

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

Instance Method Summary collapse

Methods inherited from ApplicationController

#current_ability, #pages_helper, #retrieve_vars

Methods included from Helpers

define_helpers, included

Instance Method Details

#createObject



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

#destroyObject



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

#editObject



16
17
# File 'app/controllers/feature_box/categories_controller.rb', line 16

def edit
end

#indexObject



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

#newObject



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

def new
end

#updateObject



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