Skip to content

Commit

Permalink
Merge pull request #22 from eisuke/n_plus_one
Browse files Browse the repository at this point in the history
Kill n+1 queries and fix tag links
  • Loading branch information
eisuke authored Nov 18, 2016
2 parents 54dfcba + db7edbf commit 71583c6
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion app/controllers/kuroko2/dashboard_controller.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
class Kuroko2::DashboardController < Kuroko2::ApplicationController
def index
@definitions = current_user.job_definitions
@definitions = current_user.job_definitions.includes(:tags, :job_instances, :job_schedules)

@input_tags = params[:tag] || []
if @input_tags.present?
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/kuroko2/job_definitions_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ class Kuroko2::JobDefinitionsController < Kuroko2::ApplicationController
before_action :set_definition, only: [:show, :edit, :update, :destroy]

def index
rel = Kuroko2::JobDefinition
rel = Kuroko2::JobDefinition.joins(:admins).includes(:tags, :job_instances, :job_schedules, :admins)
query = query_params[:q]

if query.present?
Expand Down
2 changes: 1 addition & 1 deletion app/views/kuroko2/job_definitions/_list.html.slim
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
td= labeled_status(definition.job_instances.take)
td
- definition.tags.each do |tag|
=link_to tag.name, root_path('tag': [tag.name]), class: 'label label-default spacer-right-3'
=link_to tag.name, { 'tag': [tag.name] }, class: 'label label-default spacer-right-3'
= first_line(definition.description)
td
= link_to definition, class: 'btn btn-sm btn-default' do
Expand Down

0 comments on commit 71583c6

Please sign in to comment.