Class: Railspress::Admin::TagsController

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

Instance Method Summary collapse

Instance Method Details

#createObject



14
15
16
17
18
19
20
21
# File 'app/controllers/railspress/admin/tags_controller.rb', line 14

def create
  @tag = Tag.new(tag_params)
  if @tag.save
    redirect_to admin_tags_path, notice: "Tag created."
  else
    render :new, status: :unprocessable_entity
  end
end

#destroyObject



34
35
36
37
# File 'app/controllers/railspress/admin/tags_controller.rb', line 34

def destroy
  @tag.destroy
  redirect_to admin_tags_path, notice: "Tag deleted."
end

#editObject



23
24
# File 'app/controllers/railspress/admin/tags_controller.rb', line 23

def edit
end

#indexObject



6
7
8
# File 'app/controllers/railspress/admin/tags_controller.rb', line 6

def index
  @tags = Tag.ordered
end

#newObject



10
11
12
# File 'app/controllers/railspress/admin/tags_controller.rb', line 10

def new
  @tag = Tag.new
end

#updateObject



26
27
28
29
30
31
32
# File 'app/controllers/railspress/admin/tags_controller.rb', line 26

def update
  if @tag.update(tag_params)
    redirect_to admin_tags_path, notice: "Tag updated."
  else
    render :edit, status: :unprocessable_entity
  end
end