You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Use _read_attribute in associations preloader instead of public reader
Using `ActiveModel::AttributeMethods#[]` or `AttributeMethods#read_attribute` is
not suitable when association involves a model with `id` column which is
not a whole primary key but still used as a foreign key. Public reader
treats `id` as an idenfitier and thus returns value for the primary key
column and not the `id` column. By using `_read_attribute` reader we can
ensure we are reading the column value directly.
Co-authored-by: Paarth Madan <[email protected]>
0 commit comments