mirror of
https://github.com/Growstuff/growstuff.git
synced 2026-09-27 16:34:59 -04:00
* Optimize PaperTrail whodunnit query in CropsController#show Replace @crop.versions.map(&:whodunnit) with @crop.versions.distinct.pluck(:whodunnit) to avoid instantiating all PaperTrail version objects and loading object/object_changes into memory. Co-authored-by: CloCkWeRX <365751+CloCkWeRX@users.noreply.github.com> * Optimize PaperTrail whodunnit query in CropsController#show Replace @crop.versions.map(&:whodunnit) with @crop.versions.distinct.pluck(:whodunnit) to avoid instantiating all PaperTrail version objects and loading object/object_changes into memory. Added unit test in spec/controllers/crops_controller_spec.rb. Co-authored-by: CloCkWeRX <365751+CloCkWeRX@users.noreply.github.com> * Optimize PaperTrail whodunnit query in CropsController#show Use @crop.versions.reorder(nil).distinct.pluck(:whodunnit) to avoid instantiating all PaperTrail version objects into memory and prevent PostgreSQL PG::InvalidColumnReference errors with SELECT DISTINCT. Co-authored-by: CloCkWeRX <365751+CloCkWeRX@users.noreply.github.com> * Fix crop route parameter in controller spec Update parameter key from id to slug in CropsController show spec to match param: :slug route definition. Co-authored-by: CloCkWeRX <365751+CloCkWeRX@users.noreply.github.com> --------- Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>