Class: CompletionKit::MetricGroupsController
Constant Summary
ApplicationController::ONBOARDING_DISMISS_COOKIE
Instance Method Summary
collapse
Instance Method Details
#create ⇒ Object
22
23
24
25
26
27
28
29
30
31
32
|
# File 'app/controllers/completion_kit/metric_groups_controller.rb', line 22
def create
@metric_group = MetricGroup.new(metric_group_params.except(:metric_ids))
@metrics = Metric.includes(:tags).order(:name)
if @metric_group.save
@metric_group.replace_metrics!(metric_group_params[:metric_ids])
redirect_to metric_group_path(@metric_group), notice: "Metric group was successfully created."
else
render :new, status: :unprocessable_entity
end
end
|
#destroy ⇒ Object
45
46
47
48
|
# File 'app/controllers/completion_kit/metric_groups_controller.rb', line 45
def destroy
@metric_group.destroy
redirect_to metric_groups_path, notice: "Metric group was successfully destroyed."
end
|
#edit ⇒ Object
18
19
20
|
# File 'app/controllers/completion_kit/metric_groups_controller.rb', line 18
def edit
@metrics = Metric.includes(:tags).order(:name)
end
|
#index ⇒ Object
6
7
8
|
# File 'app/controllers/completion_kit/metric_groups_controller.rb', line 6
def index
@metric_groups = apply_tag_filter(MetricGroup.includes(:metrics, :tags).order(:name))
end
|
#new ⇒ Object
13
14
15
16
|
# File 'app/controllers/completion_kit/metric_groups_controller.rb', line 13
def new
@metric_group = MetricGroup.new
@metrics = Metric.includes(:tags).order(:name)
end
|
#show ⇒ Object
10
11
|
# File 'app/controllers/completion_kit/metric_groups_controller.rb', line 10
def show
end
|
#update ⇒ Object
34
35
36
37
38
39
40
41
42
43
|
# File 'app/controllers/completion_kit/metric_groups_controller.rb', line 34
def update
@metrics = Metric.includes(:tags).order(:name)
if @metric_group.update(metric_group_params.except(:metric_ids))
@metric_group.replace_metrics!(metric_group_params[:metric_ids])
redirect_to metric_group_path(@metric_group), notice: "Metric group was successfully updated."
else
render :edit, status: :unprocessable_entity
end
end
|