-
Notifications
You must be signed in to change notification settings - Fork 21
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
Upgrade defaults ror 7.1 #7292
Upgrade defaults ror 7.1 #7292
Conversation
Review app https://teaching-vacancies-review-pr-7292.test.teacherservices.cloud was successfully deleted |
119ea3a
to
f606bb6
Compare
f606bb6
to
fb4b5aa
Compare
e88b9eb
to
79a7009
Compare
873a213
to
7e3cfef
Compare
7e3cfef
to
dfd8f14
Compare
532e84e
to
6ee2279
Compare
7da05b4
to
5ddde53
Compare
5ddde53
to
7142486
Compare
config/application.rb
Outdated
@@ -28,6 +28,8 @@ module TeachingVacancies | |||
class Application < Rails::Application | |||
config.load_defaults 7.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should this not be 7.1 now?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes!
data = encryptor.decrypt_and_verify(token) | ||
find(data[:id]) | ||
data = begin | ||
encryptor(serializer: :json_allow_marshal).decrypt_and_verify(token) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we need this change? It looks this would get even more complicated with Rails 7.2. Are there any down-sides to just using the default?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This allows previous subscriptions encrypted with marshal
to be decrypted as we migrate towards json
in the next Rails release.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Think a comment (as per your slack message) would be useful here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need the decrypt to be json_allow_marhsall
to allow previously encrypted subscriptions (with the old marshal serialiser) to be read. If we want to keep json
only, we might have to write a data migration to re-encrypt the subscription.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I meant in the code...
rescue ActiveSupport::MessageEncryptor::InvalidMessage | ||
raise ActiveRecord::RecordNotFound | ||
end | ||
|
||
def token | ||
token_values = { id: id } | ||
self.class.encryptor.encrypt_and_sign(token_values) | ||
self.class.encryptor(serializer: :json_allow_marshal).encrypt_and_sign(token_values) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
having defaulted the encryptor to :json_allow_marshal, we don't need to make this change IMHO
Trello card URL
https://trello.com/c/2FJobHjP/1401-rails-71-defaults-not-loaded-need-to-run-rails-appupdate-and-migrate-settings-forwards
Changes in this PR:
Add rails 7.1 defaults