diff --git a/db/dev_seeds/images/proposals/firdouss-ross-414668-unsplash_846x475.jpg b/db/dev_seeds/images/proposals/firdouss-ross-414668-unsplash_846x475.jpg new file mode 100644 index 000000000..0e7ccc053 Binary files /dev/null and b/db/dev_seeds/images/proposals/firdouss-ross-414668-unsplash_846x475.jpg differ diff --git a/db/dev_seeds/images/proposals/nathan-dumlao-496190-unsplash_713x475.jpg b/db/dev_seeds/images/proposals/nathan-dumlao-496190-unsplash_713x475.jpg new file mode 100644 index 000000000..35d227f34 Binary files /dev/null and b/db/dev_seeds/images/proposals/nathan-dumlao-496190-unsplash_713x475.jpg differ diff --git a/db/dev_seeds/images/proposals/steve-harvey-597760-unsplash_713x475.jpg b/db/dev_seeds/images/proposals/steve-harvey-597760-unsplash_713x475.jpg new file mode 100644 index 000000000..055022027 Binary files /dev/null and b/db/dev_seeds/images/proposals/steve-harvey-597760-unsplash_713x475.jpg differ diff --git a/db/dev_seeds/images/proposals/tim-mossholder-302931-unsplash_713x475.jpg b/db/dev_seeds/images/proposals/tim-mossholder-302931-unsplash_713x475.jpg new file mode 100644 index 000000000..2af0afe96 Binary files /dev/null and b/db/dev_seeds/images/proposals/tim-mossholder-302931-unsplash_713x475.jpg differ diff --git a/db/dev_seeds/proposals.rb b/db/dev_seeds/proposals.rb index 05060897c..d68c09419 100644 --- a/db/dev_seeds/proposals.rb +++ b/db/dev_seeds/proposals.rb @@ -1,3 +1,26 @@ +IMAGE_FILES = %w{ + firdouss-ross-414668-unsplash_846x475.jpg + nathan-dumlao-496190-unsplash_713x475.jpg + steve-harvey-597760-unsplash_713x475.jpg + tim-mossholder-302931-unsplash_713x475.jpg +}.map do |filename| + File.new(Rails.root.join("db", + "dev_seeds", + "images", + "proposals", filename)) +end + +def add_image_to(imageable) + # imageable should respond to #title & #author + imageable.image = Image.create!({ + imageable: imageable, + title: imageable.title, + attachment: IMAGE_FILES.sample, + user: imageable.author + }) + imageable.save +end + section "Creating Proposals" do tags = Faker::Lorem.words(25) 30.times do @@ -15,6 +38,7 @@ section "Creating Proposals" do geozone: Geozone.all.sample, skip_map: "1", terms_of_service: "1") + add_image_to proposal end end @@ -35,6 +59,7 @@ section "Creating Archived Proposals" do skip_map: "1", terms_of_service: "1", created_at: Setting["months_to_archive_proposals"].to_i.months.ago) + add_image_to proposal end end @@ -56,6 +81,7 @@ section "Creating Successful Proposals" do skip_map: "1", terms_of_service: "1", cached_votes_up: Setting["votes_for_proposal_success"]) + add_image_to proposal end tags = ActsAsTaggableOn::Tag.where(kind: 'category') @@ -74,6 +100,7 @@ section "Creating Successful Proposals" do geozone: Geozone.all.sample, skip_map: "1", terms_of_service: "1") + add_image_to proposal end end