Skip to content

Commit

Permalink
Merge pull request #3442 from DFE-Digital/rails-8
Browse files Browse the repository at this point in the history
[CAPT-1999] Rails 8
  • Loading branch information
asmega authored Dec 2, 2024
2 parents 4cd2285 + cb3631c commit 2cd7bfd
Show file tree
Hide file tree
Showing 4 changed files with 83 additions and 64 deletions.
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ git_source(:github) { |repo| "https://github.com/#{repo}.git" }
ruby "3.3.5"

# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem "rails", "~> 7.2.2"
gem "rails", "~> 8.0"
# Use postgresql as the database for Active Record
gem "pg", ">= 0.18", "< 2.0"
# Use Puma as the app server
Expand Down
123 changes: 62 additions & 61 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -19,70 +19,69 @@ GIT
GEM
remote: https://rubygems.org/
specs:
actioncable (7.2.2)
actionpack (= 7.2.2)
activesupport (= 7.2.2)
actioncable (8.0.0)
actionpack (= 8.0.0)
activesupport (= 8.0.0)
nio4r (~> 2.0)
websocket-driver (>= 0.6.1)
zeitwerk (~> 2.6)
actionmailbox (7.2.2)
actionpack (= 7.2.2)
activejob (= 7.2.2)
activerecord (= 7.2.2)
activestorage (= 7.2.2)
activesupport (= 7.2.2)
actionmailbox (8.0.0)
actionpack (= 8.0.0)
activejob (= 8.0.0)
activerecord (= 8.0.0)
activestorage (= 8.0.0)
activesupport (= 8.0.0)
mail (>= 2.8.0)
actionmailer (7.2.2)
actionpack (= 7.2.2)
actionview (= 7.2.2)
activejob (= 7.2.2)
activesupport (= 7.2.2)
actionmailer (8.0.0)
actionpack (= 8.0.0)
actionview (= 8.0.0)
activejob (= 8.0.0)
activesupport (= 8.0.0)
mail (>= 2.8.0)
rails-dom-testing (~> 2.2)
actionpack (7.2.2)
actionview (= 7.2.2)
activesupport (= 7.2.2)
actionpack (8.0.0)
actionview (= 8.0.0)
activesupport (= 8.0.0)
nokogiri (>= 1.8.5)
racc
rack (>= 2.2.4, < 3.2)
rack (>= 2.2.4)
rack-session (>= 1.0.1)
rack-test (>= 0.6.3)
rails-dom-testing (~> 2.2)
rails-html-sanitizer (~> 1.6)
useragent (~> 0.16)
actiontext (7.2.2)
actionpack (= 7.2.2)
activerecord (= 7.2.2)
activestorage (= 7.2.2)
activesupport (= 7.2.2)
actiontext (8.0.0)
actionpack (= 8.0.0)
activerecord (= 8.0.0)
activestorage (= 8.0.0)
activesupport (= 8.0.0)
globalid (>= 0.6.0)
nokogiri (>= 1.8.5)
actionview (7.2.2)
activesupport (= 7.2.2)
actionview (8.0.0)
activesupport (= 8.0.0)
builder (~> 3.1)
erubi (~> 1.11)
rails-dom-testing (~> 2.2)
rails-html-sanitizer (~> 1.6)
activejob (7.2.2)
activesupport (= 7.2.2)
activejob (8.0.0)
activesupport (= 8.0.0)
globalid (>= 0.3.6)
activemodel (7.2.2)
activesupport (= 7.2.2)
activerecord (7.2.2)
activemodel (= 7.2.2)
activesupport (= 7.2.2)
activemodel (8.0.0)
activesupport (= 8.0.0)
activerecord (8.0.0)
activemodel (= 8.0.0)
activesupport (= 8.0.0)
timeout (>= 0.4.0)
activerecord-copy (1.1.0)
activerecord (>= 3.1)
activerecord-nulldb-adapter (1.1.1)
activerecord (>= 6.0, < 8.1)
activestorage (7.2.2)
actionpack (= 7.2.2)
activejob (= 7.2.2)
activerecord (= 7.2.2)
activesupport (= 7.2.2)
activestorage (8.0.0)
actionpack (= 8.0.0)
activejob (= 8.0.0)
activerecord (= 8.0.0)
activesupport (= 8.0.0)
marcel (~> 1.0)
activesupport (7.2.2)
activesupport (8.0.0)
base64
benchmark (>= 0.3)
bigdecimal
Expand All @@ -94,6 +93,7 @@ GEM
minitest (>= 5.1)
securerandom (>= 0.3)
tzinfo (~> 2.0, >= 2.0.5)
uri (>= 0.13.1)
addressable (2.8.7)
public_suffix (>= 2.0.2, < 7.0)
aes_key_wrap (1.1.0)
Expand All @@ -109,7 +109,7 @@ GEM
brakeman (6.2.1)
racc
builder (3.3.0)
bullet (7.2.0)
bullet (8.0.0)
activesupport (>= 3.0.0)
uniform_notifier (~> 1.11)
capybara (3.40.0)
Expand All @@ -136,10 +136,10 @@ GEM
declarative (0.0.20)
delayed_cron_job (0.9.0)
fugit (>= 1.5)
delayed_job (4.1.12)
activesupport (>= 3.0, < 8.0)
delayed_job_active_record (4.1.10)
activerecord (>= 3.0, < 8.0)
delayed_job (4.1.13)
activesupport (>= 3.0, < 9.0)
delayed_job_active_record (4.1.11)
activerecord (>= 3.0, < 9.0)
delayed_job (>= 3.0, < 5)
diff-lcs (1.5.1)
docile (1.4.0)
Expand Down Expand Up @@ -629,20 +629,20 @@ GEM
rack (>= 1.0.0)
rackup (2.2.1)
rack (>= 3)
rails (7.2.2)
actioncable (= 7.2.2)
actionmailbox (= 7.2.2)
actionmailer (= 7.2.2)
actionpack (= 7.2.2)
actiontext (= 7.2.2)
actionview (= 7.2.2)
activejob (= 7.2.2)
activemodel (= 7.2.2)
activerecord (= 7.2.2)
activestorage (= 7.2.2)
activesupport (= 7.2.2)
rails (8.0.0)
actioncable (= 8.0.0)
actionmailbox (= 8.0.0)
actionmailer (= 8.0.0)
actionpack (= 8.0.0)
actiontext (= 8.0.0)
actionview (= 8.0.0)
activejob (= 8.0.0)
activemodel (= 8.0.0)
activerecord (= 8.0.0)
activestorage (= 8.0.0)
activesupport (= 8.0.0)
bundler (>= 1.15.0)
railties (= 7.2.2)
railties (= 8.0.0)
rails-dom-testing (2.2.0)
activesupport (>= 5.0.0)
minitest
Expand All @@ -654,9 +654,9 @@ GEM
rack
railties (>= 5.1)
semantic_logger (~> 4.13)
railties (7.2.2)
actionpack (= 7.2.2)
activesupport (= 7.2.2)
railties (8.0.0)
actionpack (= 8.0.0)
activesupport (= 8.0.0)
irb (~> 1.13)
rackup (>= 1.0.0)
rake (>= 12.2)
Expand Down Expand Up @@ -811,6 +811,7 @@ GEM
uk_postcode (2.1.8)
unicode-display_width (2.6.0)
uniform_notifier (1.16.0)
uri (1.0.2)
useragent (0.16.10)
validate_email (0.1.6)
activemodel (>= 3.0)
Expand Down Expand Up @@ -887,7 +888,7 @@ DEPENDENCIES
puma (~> 6.4)
rack-mini-profiler
rack_session_access
rails (~> 7.2.2)
rails (~> 8.0)
rails_semantic_logger
rollbar
rotp
Expand Down
20 changes: 18 additions & 2 deletions app/models/student_loans_data_importer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,28 @@ def row_to_hash(row)
full_name: row.fetch("Full name"),
date_of_birth: cast_as_date(row.fetch("Date of birth")),
policy_name: row.fetch("Policy name"),
no_of_plans_currently_repaying: row.fetch("No of Plans Currently Repaying"),
plan_type_of_deduction: row.fetch("Plan Type of Deduction"),
no_of_plans_currently_repaying: calculate_no_of_plans_currently_repaying(row.fetch("No of Plans Currently Repaying")),
plan_type_of_deduction: calculate_plan_type_of_deduction(row.fetch("Plan Type of Deduction")),
amount: row.fetch("Amount")
}
end

def calculate_plan_type_of_deduction(value)
if value == "No data"
nil
else
value
end
end

def calculate_no_of_plans_currently_repaying(value)
if value == "No data"
nil
else
value
end
end

def cast_as_date(string)
Date.strptime(string, I18n.t("date.formats.day_month_year"))
rescue TypeError, Date::Error
Expand Down
2 changes: 2 additions & 0 deletions config/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -73,5 +73,7 @@ class Application < Rails::Application
config.active_record.yaml_column_permitted_classes = [BigDecimal, Date, Symbol]

config.email_regexp = /\A[a-zA-Z0-9.!\#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+\z/

config.active_support.to_time_preserves_timezone = :offset
end
end

0 comments on commit 2cd7bfd

Please sign in to comment.