Commit b76f47f8 authored by Sean McGivern's avatar Sean McGivern

Always use rails mode for Oj

Oj's `object` mode is the default, and serialises symbols as
`":foo"` (so the result of calling `#inspect` on the symbol). The
`rails` mode, which is what we want, serialises them as the result of
calling `#to_s`, so just `"foo"`.

We set Oj's default mode to `rails` in an initialiser. However, this
happens after we've already made a call that uses Oj - in
`active_record_lifecycle.rb`, we add a hook to log when the ActiveRecord
connection was established.

For Puma, that hook will run after the worker start, which is also after
the initialiser. However, running a console or a Rake task (like
migrations) will run that hook immediately, so it's before we've set the
default options, and uses `object` mode. Moving the initialiser to those
that run before autoloading lets us sidestep this and always use `rails`
mode.
parent f061a542
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment