Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rails upgrade 7.0.8 to 7.1.0 #5478

Merged
merged 22 commits into from
Jan 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
123c200
Update Rails version in Gemfile from 7.0.8 to 7.1.0
sarvaiyanidhi Jan 3, 2024
6c2f97e
rails app:update and overrides code
sarvaiyanidhi Jan 4, 2024
23befdf
fixture singular path warning fix, Nokogiri parsed_body method fix
sarvaiyanidhi Jan 5, 2024
c7b9f24
Fix for deprecation warning for Rails.application.secrets and preview…
sarvaiyanidhi Jan 5, 2024
78bd955
Configuration changes related to Rails 7.1.0
sarvaiyanidhi Jan 5, 2024
67204da
Changes for Nokogiri parsed_body to html to match expectation
sarvaiyanidhi Jan 5, 2024
33edac1
Changes for DEPRECATION WARNING: Setting action_dispatch.show_except…
sarvaiyanidhi Jan 5, 2024
49f45e8
Fixed failing spec
sarvaiyanidhi Jan 6, 2024
097686a
Code changes to handle ActionView::Template::Error: Cannot get a sig…
sarvaiyanidhi Jan 7, 2024
7749518
Ruby Standard fix
sarvaiyanidhi Jan 8, 2024
c6d07d8
Ruby Standard fix
sarvaiyanidhi Jan 8, 2024
d267aa9
Config changes to handle deprecation warining of supporting multiple …
sarvaiyanidhi Jan 9, 2024
63e833a
Fixing rspec issue
sarvaiyanidhi Jan 9, 2024
1d639db
Reverted deprecation warning changes for spec failing issue
sarvaiyanidhi Jan 9, 2024
7577090
Changes for ActionMailer deprecation warning
sarvaiyanidhi Jan 10, 2024
d7b4b1f
Ruby Standard Fix
sarvaiyanidhi Jan 10, 2024
5506197
Updated code to load defaults 7.1 and fix file load issue
sarvaiyanidhi Jan 10, 2024
6e57ee4
Ruby Lint issue fix
sarvaiyanidhi Jan 10, 2024
6d9e514
Merged main branch and fixed failing spec
sarvaiyanidhi Jan 17, 2024
1a05d0d
Reverted preview_path to old code to check failing spec issue
sarvaiyanidhi Jan 31, 2024
2f7ee4d
Reverted to actual code as specs were still failing with old code
sarvaiyanidhi Jan 31, 2024
52b5a59
Fix for failing specs
sarvaiyanidhi Jan 31, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
source "https://rubygems.org"

ruby "3.2.2"
gem "rails", "~> 7.0.8"
gem "rails", "7.1.0"

gem "after_party" # post-deployment tasks
gem "amazing_print" # easier console reading
Expand Down
159 changes: 94 additions & 65 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,74 +1,82 @@
GEM
remote: https://rubygems.org/
specs:
actioncable (7.0.8)
actionpack (= 7.0.8)
activesupport (= 7.0.8)
actioncable (7.1.0)
actionpack (= 7.1.0)
activesupport (= 7.1.0)
nio4r (~> 2.0)
websocket-driver (>= 0.6.1)
actionmailbox (7.0.8)
actionpack (= 7.0.8)
activejob (= 7.0.8)
activerecord (= 7.0.8)
activestorage (= 7.0.8)
activesupport (= 7.0.8)
zeitwerk (~> 2.6)
actionmailbox (7.1.0)
actionpack (= 7.1.0)
activejob (= 7.1.0)
activerecord (= 7.1.0)
activestorage (= 7.1.0)
activesupport (= 7.1.0)
mail (>= 2.7.1)
net-imap
net-pop
net-smtp
actionmailer (7.0.8)
actionpack (= 7.0.8)
actionview (= 7.0.8)
activejob (= 7.0.8)
activesupport (= 7.0.8)
actionmailer (7.1.0)
actionpack (= 7.1.0)
actionview (= 7.1.0)
activejob (= 7.1.0)
activesupport (= 7.1.0)
mail (~> 2.5, >= 2.5.4)
net-imap
net-pop
net-smtp
rails-dom-testing (~> 2.0)
actionpack (7.0.8)
actionview (= 7.0.8)
activesupport (= 7.0.8)
rack (~> 2.0, >= 2.2.4)
rails-dom-testing (~> 2.2)
actionpack (7.1.0)
actionview (= 7.1.0)
activesupport (= 7.1.0)
nokogiri (>= 1.8.5)
rack (>= 2.2.4)
rack-session (>= 1.0.1)
rack-test (>= 0.6.3)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.2.0)
actiontext (7.0.8)
actionpack (= 7.0.8)
activerecord (= 7.0.8)
activestorage (= 7.0.8)
activesupport (= 7.0.8)
rails-dom-testing (~> 2.2)
rails-html-sanitizer (~> 1.6)
actiontext (7.1.0)
actionpack (= 7.1.0)
activerecord (= 7.1.0)
activestorage (= 7.1.0)
activesupport (= 7.1.0)
globalid (>= 0.6.0)
nokogiri (>= 1.8.5)
actionview (7.0.8)
activesupport (= 7.0.8)
actionview (7.1.0)
activesupport (= 7.1.0)
builder (~> 3.1)
erubi (~> 1.4)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.1, >= 1.2.0)
activejob (7.0.8)
activesupport (= 7.0.8)
erubi (~> 1.11)
rails-dom-testing (~> 2.2)
rails-html-sanitizer (~> 1.6)
activejob (7.1.0)
activesupport (= 7.1.0)
globalid (>= 0.3.6)
activemodel (7.0.8)
activesupport (= 7.0.8)
activemodel (7.1.0)
activesupport (= 7.1.0)
activemodel-serializers-xml (1.0.2)
activemodel (> 5.x)
activesupport (> 5.x)
builder (~> 3.1)
activerecord (7.0.8)
activemodel (= 7.0.8)
activesupport (= 7.0.8)
activestorage (7.0.8)
actionpack (= 7.0.8)
activejob (= 7.0.8)
activerecord (= 7.0.8)
activesupport (= 7.0.8)
activerecord (7.1.0)
activemodel (= 7.1.0)
activesupport (= 7.1.0)
timeout (>= 0.4.0)
activestorage (7.1.0)
actionpack (= 7.1.0)
activejob (= 7.1.0)
activerecord (= 7.1.0)
activesupport (= 7.1.0)
marcel (~> 1.0)
mini_mime (>= 1.1.0)
activesupport (7.0.8)
activesupport (7.1.0)
base64
bigdecimal
concurrent-ruby (~> 1.0, >= 1.0.2)
connection_pool (>= 2.2.5)
drb
i18n (>= 1.6, < 2)
minitest (>= 5.1)
mutex_m
tzinfo (~> 2.0)
addressable (2.8.5)
public_suffix (>= 2.0.2, < 6.0)
Expand Down Expand Up @@ -176,6 +184,8 @@ GEM
activesupport (>= 5.0)
request_store (>= 1.0)
ruby2_keywords
drb (2.2.0)
ruby2_keywords
email_spec (2.2.2)
htmlentities (~> 4.3.3)
launchy (~> 2.1)
Expand Down Expand Up @@ -249,6 +259,10 @@ GEM
image_processing (1.12.2)
mini_magick (>= 4.9.5, < 5)
ruby-vips (>= 2.0.17, < 3)
io-console (0.7.1)
irb (1.11.0)
rdoc
reline (>= 0.3.8)
jbuilder (2.11.5)
actionview (>= 5.0.0)
activesupport (>= 5.0.0)
Expand Down Expand Up @@ -289,6 +303,7 @@ GEM
minitest (5.21.1)
multi_xml (0.6.0)
multipart-post (2.3.0)
mutex_m (0.2.0)
net-http-persistent (4.0.1)
connection_pool (~> 2.2)
net-imap (0.4.9)
Expand Down Expand Up @@ -335,6 +350,8 @@ GEM
pry-byebug (3.10.1)
byebug (~> 11.0)
pry (>= 0.13, < 0.15)
psych (5.1.2)
stringio
public_suffix (5.0.4)
puma (6.4.2)
nio4r (~> 2.0)
Expand All @@ -346,22 +363,27 @@ GEM
rack (>= 1.0, < 4)
rack-cors (2.0.1)
rack (>= 2.0.0)
rack-session (1.0.2)
rack (< 3)
rack-test (2.1.0)
rack (>= 1.3)
rails (7.0.8)
actioncable (= 7.0.8)
actionmailbox (= 7.0.8)
actionmailer (= 7.0.8)
actionpack (= 7.0.8)
actiontext (= 7.0.8)
actionview (= 7.0.8)
activejob (= 7.0.8)
activemodel (= 7.0.8)
activerecord (= 7.0.8)
activestorage (= 7.0.8)
activesupport (= 7.0.8)
rackup (1.0.0)
rack (< 3)
webrick
rails (7.1.0)
actioncable (= 7.1.0)
actionmailbox (= 7.1.0)
actionmailer (= 7.1.0)
actionpack (= 7.1.0)
actiontext (= 7.1.0)
actionview (= 7.1.0)
activejob (= 7.1.0)
activemodel (= 7.1.0)
activerecord (= 7.1.0)
activestorage (= 7.1.0)
activesupport (= 7.1.0)
bundler (>= 1.15.0)
railties (= 7.0.8)
railties (= 7.1.0)
rails-controller-testing (1.0.5)
actionpack (>= 5.0.1.rc1)
actionview (>= 5.0.1.rc1)
Expand All @@ -373,16 +395,21 @@ GEM
rails-html-sanitizer (1.6.0)
loofah (~> 2.21)
nokogiri (~> 1.14)
railties (7.0.8)
actionpack (= 7.0.8)
activesupport (= 7.0.8)
method_source
railties (7.1.0)
actionpack (= 7.1.0)
activesupport (= 7.1.0)
irb
rackup (>= 1.0.0)
rake (>= 12.2)
thor (~> 1.0)
zeitwerk (~> 2.5)
thor (~> 1.0, >= 1.2.2)
zeitwerk (~> 2.6)
rainbow (3.1.1)
rake (13.1.0)
rdoc (6.6.2)
psych (>= 4.0.0)
regexp_parser (2.8.1)
reline (0.4.1)
io-console (~> 0.5)
request_store (1.5.1)
rack (>= 1.4)
responders (3.1.1)
Expand Down Expand Up @@ -482,6 +509,7 @@ GEM
rubocop-performance (~> 1.19.1)
stimulus-rails (1.3.3)
railties (>= 6.0.0)
stringio (3.1.0)
strong_migrations (1.6.4)
activerecord (>= 5.2)
thor (1.3.0)
Expand Down Expand Up @@ -514,6 +542,7 @@ GEM
addressable (>= 2.8.0)
crack (>= 0.3.2)
hashdiff (>= 0.4.0, < 2.0.0)
webrick (1.8.1)
websocket (1.2.10)
websocket-driver (0.7.6)
websocket-extensions (>= 0.1.0)
Expand Down Expand Up @@ -587,7 +616,7 @@ DEPENDENCIES
pundit
rack-attack
rack-cors
rails (~> 7.0.8)
rails (= 7.1.0)
rails-controller-testing
rake
request_store
Expand Down
5 changes: 5 additions & 0 deletions app/controllers/casa_org_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ class CasaOrgController < ApplicationController
before_action :set_sent_emails, only: %i[edit update]
before_action :require_organization!
after_action :verify_authorized
before_action :set_active_storage_url_options, only: %i[edit update]

def edit
authorize @casa_org
Expand Down Expand Up @@ -82,4 +83,8 @@ def set_sent_emails
def set_learning_hour_topics
@learning_hour_topics = LearningHourTopic.for_organization(@casa_org)
end

def set_active_storage_url_options
ActiveStorage::Current.url_options = {host: request.base_url}
end
end
3 changes: 2 additions & 1 deletion app/views/casa_org/edit.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@
</div>
<div class="col-sm align-middle my-auto">
<% if current_organization.court_report_template.attached? %>
<%= link_to 'Download Current Template', rails_blob_path(current_organization.court_report_template, only_path: true), class: "btn btn-info" %>
<% ActiveStorage::Current.url_options = { host: request.base_url } %>
<%= link_to 'Download Current Template', current_organization.court_report_template.url(only_path: true), class: "btn btn-info" %>
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Had to remove rails_blob_path and update with url code to handle ActionView::Template::Error: Cannot get a signed_id for a new record error.

Referred this open issue - https://stackoverflow.com/questions/77201333/cannot-get-a-signed-id-for-a-new-record-with-url-for-after-attaching-pictur

<% end %>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion bin/setup
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ require "fileutils"
APP_ROOT = File.expand_path("..", __dir__)

def system!(*args)
system(*args) || abort("\n== Command #{args} failed ==")
system(*args, exception: true) || abort("\n== Command #{args} failed ==")
end

FileUtils.chdir APP_ROOT do
Expand Down
10 changes: 8 additions & 2 deletions config/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,12 @@
module Casa
class Application < Rails::Application
# Initialize configuration defaults for originally generated Rails version.
config.load_defaults 7.0
config.load_defaults 7.1

# Please, add to the `ignore` list any other `lib` subdirectories that do
# not contain `.rb` files, or that should not be reloaded or eager loaded.
# Common ones are `templates`, `generators`, or `middleware`, for example.
config.autoload_lib(ignore: %w[assets tasks mailers])

# Configuration for the application, engines, and railties goes here.
#
Expand All @@ -19,7 +24,8 @@ class Application < Rails::Application
# config.time_zone = "Central Time (US & Canada)"
# config.eager_load_paths << Rails.root.join("extras")

config.action_mailer.preview_path ||= defined?(Rails.root) ? Rails.root.join("lib", "mailers", "previews") : nil
config.action_mailer.preview_paths << (defined?(Rails.root) ? Rails.root.join("lib", "mailers", "previews") : nil)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm wondering if the difference between ||= and << is what's causing the failing rspec test in github @sarvaiyanidhi

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In Rails 7.1.0 there is now support for multiple preview paths so I am appending as per new configuration.

https://edgeguides.rubyonrails.org/upgrading_ruby_on_rails.html#support-multiple-preview-paths-for-actionmailer-preview

In one of the earlier commit, I still reverted to earlier code base to check if specs pass with it but encountered same issue so not sure if this is the problem 1d639db


config.eager_load_paths << Rails.root.join("app", "lib", "importers")
config.assets.paths << Rails.root.join("app", "assets", "webfonts")
config.active_storage.variant_processor = :mini_magick
Expand Down
8 changes: 7 additions & 1 deletion config/environments/development.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# In the development environment your application's code is reloaded any time
# it changes. This slows down response time but is perfect for development
# since you don't have to restart the web server when you make code changes.
config.cache_classes = false
config.enable_reloading = true

# Do not eager load code on boot.
config.eager_load = false
Expand Down Expand Up @@ -58,6 +58,9 @@
# Highlight code that triggered database queries in logs.
config.active_record.verbose_query_logs = true

# Highlight code that enqueued background job in logs.
config.active_job.verbose_enqueue_logs = true

# Suppress logger output for asset requests.
config.assets.quiet = true
config.assets.digest = false
Expand All @@ -78,4 +81,7 @@
# Uncomment if you wish to allow Action Cable access from any origin.
# config.action_cable.disable_request_forgery_protection = true
config.hosts << ENV["DEV_HOSTS"]

# Raise error when a before_action's only/except options reference missing actions
config.action_controller.raise_on_missing_callback_actions = false
end
Loading