Class: Admin::TaxonomiesController

Inherits:
BaseController
  • Object
show all
Defined in:
app/controllers/admin/taxonomies_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



16
17
18
19
20
21
22
23
# File 'app/controllers/admin/taxonomies_controller.rb', line 16

def create
  @taxonomy = Taxonomy.new(params[:taxonomy])
  if @taxonomy.save
    redirect_to edit_admin_taxonomy_url(@taxonomy), :notice => "Successfully created taxonomy."
  else
    render :action => 'new'
  end
end

#destroyObject



39
40
41
42
43
# File 'app/controllers/admin/taxonomies_controller.rb', line 39

def destroy
  @taxonomy = Taxonomy.find(params[:id])
  @taxonomy.destroy
  redirect_to admin_taxonomies_url, :notice => "Successfully destroyed taxonomy."
end

#editObject



25
26
27
28
# File 'app/controllers/admin/taxonomies_controller.rb', line 25

def edit
  @taxonomy = Taxonomy.find(params[:id])
  @tree = root_tree(@taxonomy)
end

#indexObject



4
5
6
# File 'app/controllers/admin/taxonomies_controller.rb', line 4

def index
  @taxonomies = Taxonomy.all 
end

#newObject



12
13
14
# File 'app/controllers/admin/taxonomies_controller.rb', line 12

def new
  @taxonomy = Taxonomy.new
end

#showObject



8
9
10
# File 'app/controllers/admin/taxonomies_controller.rb', line 8

def show
  @taxonomy = Taxonomy.find(params[:id])
end

#updateObject



30
31
32
33
34
35
36
37
# File 'app/controllers/admin/taxonomies_controller.rb', line 30

def update
  @taxonomy = Taxonomy.find(params[:id])
  if @taxonomy.update_attributes(params[:taxonomy])
    redirect_to admin_taxonomies_url, :notice  => "Successfully updated taxonomy."
  else
    render :action => 'edit'
  end
end