-
Notifications
You must be signed in to change notification settings - Fork 72
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Kill n+1 queries and fix tag links #22
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
seems ci has broken.. does the example randomly fails?
@@ -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) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why do you join admins not only including it? (I don't know about table structures)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The admins
is a has_many :through association. it do not work only includes
.
@@ -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' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why don't you use named routes path?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because this partial view used in dashboards and user details pages (/users/:id
).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ic, this view is used both of dashboard and user pages, and you want to link to each of them.
btw, { tag: [tag.name] }
LGTM |
No description provided.