Class: Blogr::TagsController

Inherits:
ApplicationController show all
Defined in:
app/controllers/blogr/tags_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



26
27
28
29
30
31
32
33
34
# File 'app/controllers/blogr/tags_controller.rb', line 26

def create
	@tag = Tag.new(tag_params)

	if @tag.save
		redirect_to tags_path, notice: 'Tag was successfully created.'
	else
		render action: 'new'
	end
end

#destroyObject



44
45
46
47
# File 'app/controllers/blogr/tags_controller.rb', line 44

def destroy
	@tag.destroy
	redirect_to categories_url, notice: 'Tag was successfully destroyed.'
end

#editObject



22
23
24
# File 'app/controllers/blogr/tags_controller.rb', line 22

def edit
	@title = "Editing '#{@tag.name}'"
end

#indexObject



8
9
10
11
# File 'app/controllers/blogr/tags_controller.rb', line 8

def index
	@tags = Tag.all
	@title = "Tags"
end

#newObject



17
18
19
20
# File 'app/controllers/blogr/tags_controller.rb', line 17

def new
	@tag = Tag.new
	@title = "New Tag"
end

#showObject



13
14
15
# File 'app/controllers/blogr/tags_controller.rb', line 13

def show
	@title = @tag.name
end

#updateObject



36
37
38
39
40
41
42
# File 'app/controllers/blogr/tags_controller.rb', line 36

def update
	if @tag.update(tag_params)
		redirect_to tags_path, notice: 'Tag was successfully updated.'
	else
		render action: 'edit'
	end
end