In my opinion, the upgrade guide is unclear about how to migrate related records to the new database schema. In particular, it is about this section from Noticed 2.0 > Models:
# Extract related record to `belongs_to :record` association
# This allows ActiveRecord associations instead of querying the JSON data
# attributes[:record] = params.delete(:user) || params.delete(:account)
The params variable is not defined anywhere else in this code block and it would be clearer if it just said attribute[:params] which is the correct thing to use in this case instead of what I used first (notification.params) which does not contain the deserialized record.
In my opinion, the upgrade guide is unclear about how to migrate related records to the new database schema. In particular, it is about this section from Noticed 2.0 > Models:
The
params
variable is not defined anywhere else in this code block and it would be clearer if it just saidattribute[:params]
which is the correct thing to use in this case instead of what I used first (notification.params
) which does not contain the deserialized record.