Class: CompletionKit::TagsController
Constant Summary
ApplicationController::ONBOARDING_DISMISS_COOKIE
Instance Method Summary
collapse
Instance Method Details
#create ⇒ Object
18
19
20
21
22
23
24
25
|
# File 'app/controllers/completion_kit/tags_controller.rb', line 18
def create
@tag = Tag.new(tag_params)
if @tag.save
redirect_to tags_path, notice: "Tag was successfully created."
else
render :new, status: :unprocessable_entity
end
end
|
#destroy ⇒ Object
35
36
37
38
|
# File 'app/controllers/completion_kit/tags_controller.rb', line 35
def destroy
@tag.destroy
redirect_to tags_path, notice: "Tag was successfully destroyed."
end
|
#edit ⇒ Object
15
16
|
# File 'app/controllers/completion_kit/tags_controller.rb', line 15
def edit
end
|
#index ⇒ Object
5
6
7
8
9
|
# File 'app/controllers/completion_kit/tags_controller.rb', line 5
def index
@tags = Tag.order(:name)
@tagging_counts = Tagging.group(:tag_id).count
@tagging_by_type = Tagging.group(:tag_id, :taggable_type).count
end
|
#new ⇒ Object
11
12
13
|
# File 'app/controllers/completion_kit/tags_controller.rb', line 11
def new
@tag = Tag.new(color: Tag::COLORS.sample)
end
|
#update ⇒ Object
27
28
29
30
31
32
33
|
# File 'app/controllers/completion_kit/tags_controller.rb', line 27
def update
if @tag.update(tag_params)
redirect_to tags_path, notice: "Tag was successfully updated."
else
render :edit, status: :unprocessable_entity
end
end
|