Files
growstuff/lib/tasks/sample_data.rake
T
Brenda Wallace be38339b02 Refactor member location updates and improve error handling
- Updated MemberLocationsController to use a hash for location updates, ensuring coordinates are not geocoded again.
- Changed response status codes in member_locations_spec to use symbols for better readability.
- Modified PlacesController to use parentheses for defining MEMBER_FIELDS.
- Enhanced SuggestionsController to disable Rails/SkipsModelValidations for update_columns.
- Updated SeasonsHelper to use compact_blank for cleaner output.
- Refactored MemberDashboard service for improved readability and performance.
- Adjusted migration files to use parentheses for index definitions.
- Updated schema.rb to maintain consistency in index definitions.
- Added SampleData class to generate sample data for development.
- Cleaned up sample_data.rake task to utilize the new SampleData class.
- Updated tests in member_dashboard_spec and place_suggester_spec for consistency and readability.
2026-10-12 19:30:21 +13:00

18 lines
652 B
Ruby

# frozen_string_literal: true
namespace :growstuff do
desc "Add lots of sample members, plantings, harvests and seeds to a development database"
# usage: rake growstuff:sample_data [members=40]
#
# Safe to run more than once: members are named sample_1, sample_2 and so
# on, and a member that already exists is left alone, so running it again
# with a bigger number only adds the new ones.
task sample_data: :environment do
abort "growstuff:sample_data only runs in development" unless Rails.env.development?
require Rails.root.join('lib/sample_data')
SampleData.new(members: ENV.fetch('members', 40).to_i).load
end
end