Class: Admin::TagsController
Instance Method Summary
collapse
Methods included from BlogHelper
#blog_base_url, #this_blog
Instance Method Details
#create ⇒ Object
11
12
13
14
15
16
17
18
19
20
|
# File 'app/controllers/admin/tags_controller.rb', line 11
def create
@tag = this_blog.tags.new(tag_params)
if @tag.save
redirect_to admin_tags_url, notice: 'Tag was successfully created.'
else
fetch_tags
render :index
end
end
|
#destroy ⇒ Object
33
34
35
|
# File 'app/controllers/admin/tags_controller.rb', line 33
def destroy
destroy_a(Tag)
end
|
#edit ⇒ Object
9
|
# File 'app/controllers/admin/tags_controller.rb', line 9
def edit; end
|
#index ⇒ Object
5
6
7
|
# File 'app/controllers/admin/tags_controller.rb', line 5
def index
@tag = Tag.new
end
|
#update ⇒ Object
22
23
24
25
26
27
28
29
30
31
|
# File 'app/controllers/admin/tags_controller.rb', line 22
def update
old_name = @tag.name
if @tag.update(tag_params)
Redirect.create(from_path: "/tag/#{old_name}", to_path: @tag.permalink_url(nil, true))
redirect_to admin_tags_url, notice: I18n.t('admin.tags.edit.success')
else
render :edit
end
end
|