sinfin / auctify

Rails engine for auctions of items
MIT License
11 stars 4 forks source link

Pridat has_one last_sale pro :item #29

Closed mreq closed 3 years ago

mreq commented 3 years ago

Aby slo v seznamu predmetu nacitat bez n+1. Provizorni reseni (v AA item modelu), ktere ale nacita vzdy vsechny sales:

  has_one :last_sale, -> { order(id: :desc) },
                      class_name: "Auctify::Sale::Base",
                      foreign_key: :item_id

Spravne by to melo mit vlastni foreign key, aby se tohle nedelo.