mirror of
https://github.com/Growstuff/growstuff.git
synced 2026-11-05 20:52:48 -05:00
- Refactored `PhotosController#index` to use ActiveRecord queries instead of Searchkick/Elasticsearch. - Handled filtering by crop and planting via associations. - Added eager loading for the photo owner to prevent N+1 queries. - Decoupled the `Photo` model from Elasticsearch by removing the `SearchPhotos` concern. - Deleted `app/models/concerns/search_photos.rb`. - Updated controller and model specs to use standard ActiveRecord expectations. - Cleaned up the photo factory by removing the now-obsolete `:reindex` trait. Co-authored-by: CloCkWeRX <365751+CloCkWeRX@users.noreply.github.com>
24 lines
629 B
Ruby
24 lines
629 B
Ruby
# frozen_string_literal: true
|
|
|
|
# Read about factories at https://github.com/thoughtbot/factory_bot
|
|
|
|
FactoryBot.define do
|
|
factory :photo do
|
|
owner
|
|
source { 'flickr' }
|
|
source_id { 1 }
|
|
title { Faker::Movies::HarryPotter.quote }
|
|
license_name { "CC-BY" }
|
|
license_url { "http://example.com/license.html" }
|
|
thumbnail_url { "http://example.com/#{Faker::File.file_name}.jpg" }
|
|
fullsize_url { "http://example.com/#{Faker::File.file_name}.jpg" }
|
|
link_url { Faker::Internet.url }
|
|
|
|
factory :unlicensed_photo do
|
|
license_name { "All rights reserved" }
|
|
license_url { nil }
|
|
end
|
|
|
|
end
|
|
end
|