diff --git a/.elasticbeanstalk/config.yml b/.elasticbeanstalk/config.yml new file mode 100644 index 0000000..f7b4d2c --- /dev/null +++ b/.elasticbeanstalk/config.yml @@ -0,0 +1,21 @@ +branch-defaults: + actions: + environment: prod-env + main: + environment: prod-env +environment-defaults: + prod-env: + branch: null + repository: null +global: + application_name: hop-skip-drive-test + default_ec2_keyname: null + default_platform: Ruby 3.2 running on 64bit Amazon Linux 2023 + default_region: us-west-2 + include_git_submodules: true + instance_profile: null + platform_name: null + platform_version: null + profile: null + sc: git + workspace_type: Application diff --git a/.ruby-version b/.ruby-version index 03463f3..0fa4ae4 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -ruby-3.3.0 +3.3.0 \ No newline at end of file diff --git a/Gemfile.lock b/Gemfile.lock index 6cbda39..7dbc7c0 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -325,6 +325,7 @@ PLATFORMS aarch64-linux arm-linux arm64-darwin-22 + arm64-darwin-23 x86-linux x86_64-darwin x86_64-linux diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index aadf6ca..88e70a9 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -1,14 +1,16 @@ # frozen_string_literal: true +# rubocop:disable Lint/RedundantSafeNavigation class ApplicationController < ActionController::API private def pagination_params params.permit(:limit, :offset) end private def limit - pagination_params[:limit] || 2 + pagination_params[:limit]&.to_i || 2 end private def offset - pagination_params[:offset] || 0 + pagination_params[:offset]&.to_i || 0 end end +# rubocop:enable Lint/RedundantSafeNavigation diff --git a/db/seeds.rb b/db/seeds.rb index 0126b70..8ec9fb0 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -8,9 +8,19 @@ {line_1:"1107 S Lemay Ave", line_2: "Suite 240", city: "Fort Collins", state: "CO", zip_code: "80524"}, {line_1:"1024 S Lemay Ave", city: "Fort Collins", state: "CO", zip_code: "80524"}, {line_1:"4601 Corbett Dr", city: "Fort Collins", state: "CO", zip_code: "80528"}, + {line_1: "1113 W Plum St", line_2: "Apt 201D", city: "Fort Collins", state: "CO", zip_code: "80512"}, + {line_1: "3397 WAGON TRAIL RD", city: "Fort Collins", state: "CO", zip_code: "80524"}, + {line_1: "5700 N HIGHWAY 1", city: "Fort Collins", state: "CO", zip_code: "80524"}, + {line_1: "6609 DESERT WILLOW WAY", line_2: "Unit 1", city: "Fort Collins", state: "CO", zip_code: "80525"}, + {line_1: "2002 BATTLECREEK DR", line_2: "APT 6303", city: "Fort Collins", state: "CO", zip_code: "80528"}, + {line_1: "1901 YORKTOWN AVE", city: "Fort Collins", state: "CO", zip_code: "80526"}, + {line_1: "3024 SUMAC ST", city: "Fort Collins", state: "CO", zip_code: "80526"}, + {line_1: "700 E DRAKE RD", line_2: "APT P08", city: "Fort Collins", state: "CO", zip_code: "80525"}, + {line_1: "333 RIVA RIDGE DR", line_2: "APT C201", city: "Fort Collins", state: "CO", zip_code: "80526"}, ].freeze + # Create Drivers ActiveRecord::Base.connection.transaction do puts "Creating Drivers..." @@ -18,14 +28,18 @@ first_name = Faker::Name.first_name last_name = Faker::Name.last_name driver = Driver.build(first_name:,last_name:) - address = Address.create(ADDRESSES.sample) + address = Address.create(**ADDRESSES.sample) driver.driver_addresses.build(address_id: address.id, current: true) driver.save! end puts "Creating remaining Addresses..." ADDRESSES[(Address.count + 1)..].each do |attrs| - Address.create(**attrs) + Address.find_or_create_by(line_1: attrs[:line_1], line_2: attrs[:line_2]) do + city = attrs[:city] + state = attrs[:state] + zip_code = attrs[:zip_code] + end end puts "Creating Rides..."