Luckily we can still send int values when doing a where clause on categories AND by Rails 5, we can also do a string array search of categories. So we do not need to update find_notifications_for
Decision Choice: another option instead of version checks is to typecast the categories from find_categories_for back to its corresponding ints (eg. .pluck('categories as i')). IMO, this makes the pluck a bit harder to understand and as mentioned in previous bullet point, receiving categories as strings does not seem to have a breaking domino effect. (because .where can accept either integer search or string search of enum fields).
Regardless, we will test thoroughly in Staging Canary When Up.
Removed duplicate mailer method that uses .send in a way that is which is no longer valid in Ruby 2.6+
Rails 5 - Fix NotificationMailer Specs
Changes
Update
NotificationMailer#find_categories_for
specs to allow for Rails 5 typecasting of enum fields.ActiveRecord:Enum
where it typecasts enum attributes to its string value. See: https://github.com/rails/rails/commit/c51f9b61ce1e167f5f58f07441adcfa117694301find_notifications_for
find_categories_for
back to its corresponding ints (eg..pluck('categories as i')
). IMO, this makes thepluck
a bit harder to understand and as mentioned in previous bullet point, receiving categories as strings does not seem to have a breaking domino effect. (because.where
can accept either integer search or string search of enum fields).Removed duplicate mailer method that uses
.send
in a way that is which is no longer valid in Ruby 2.6+Add
template_name
parameter tomail to
to specify template used. Due to a change in ActionMailer 4.2 -> Actionmailer 5.0TODO Once On Staging