Skip to content

Models: use associations more #2241

@olleolleolle

Description

@olleolleolle

A Workshop is a specialization of Event.

It has a method #host that breaks how "Active Relation" work - it forces a SQL query on each rendering (so that each Event template calls 11 queries to the DB, which could all have been there already), that is "N+1 queries".

app/models/workshop.rb:34:in `host'
app/presenters/workshop_presenter.rb:31:in `venue'
app/views/events/_event.html.haml:20:in `_app_views_events__event_html_haml___3133112490946951653_62480'
app/views/workshops/_workshop.html.haml:1:in `_app_views_workshops__workshop_html_haml___4439689423734540482_62460'
app/views/dashboard/show.html.haml:74:in `block in _app_views_dashboard_show_html_haml___154197011926960493_62020'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions