Class: WhurlEngine::CategoriesController

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

Instance Method Summary collapse

Instance Method Details

#createObject



11
12
13
14
15
16
# File 'app/controllers/whurl_engine/categories_controller.rb', line 11

def create
  @category = WhurlEngine::Category.new(params[:category])
  unless @category.save
    render :partial => 'whurl_engine/shared/error', :locals => {:object => @category}
  end
end

#destroyObject



29
30
31
32
33
34
# File 'app/controllers/whurl_engine/categories_controller.rb', line 29

def destroy
  @category = WhurlEngine::Category.find(params[:id])
  unless @category.destroy
    render :partial => 'whurl_engine/shared/error', :locals => {:object => @category}
  end
end

#editObject



18
19
20
# File 'app/controllers/whurl_engine/categories_controller.rb', line 18

def edit
  @category = WhurlEngine::Category.find(params[:id])
end

#indexObject



3
4
5
# File 'app/controllers/whurl_engine/categories_controller.rb', line 3

def index
  @categories = WhurlEngine::Category.all.sort
end

#newObject



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

def new
  @category = WhurlEngine::Category.new
end

#updateObject



22
23
24
25
26
27
# File 'app/controllers/whurl_engine/categories_controller.rb', line 22

def update
  @category = WhurlEngine::Category.find(params[:id])
  unless @category.update_attributes(params[:category])
    render :partial => 'whurl_engine/shared/error', :locals => {:object => @category}
  end
end