Class: Eventable::CategoriesController

Inherits:
EventableController show all
Defined in:
app/controllers/eventable/categories_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



7
8
9
10
11
12
13
14
15
16
17
18
# File 'app/controllers/eventable/categories_controller.rb', line 7

def create
  if @category.update_attributes(params[:eventable_category])
    try_after_callback do
      flash[:notice] = 'Category was successfully created.'
      redirect_to(eventable_category_path(@category))
    end
  else
    try_after_callback :fail do
      render :action => "new"
    end
  end
end

#destroyObject



33
34
35
36
37
38
# File 'app/controllers/eventable/categories_controller.rb', line 33

def destroy
  @category.destroy
  try_after_callback do
    redirect_to(eventable_categories_path)
  end
end

#updateObject



20
21
22
23
24
25
26
27
28
29
30
31
# File 'app/controllers/eventable/categories_controller.rb', line 20

def update
  if @category.update_attributes(params[:eventable_category])
    try_after_callback do
      flash[:notice] = 'Category was successfully updated.'
      redirect_to(eventable_category_path(@category))
    end
  else
    try_after_callback :fail do
      render :action => "edit"
    end
  end
end