Unfortunately the rails-i18n-updater plugin adds the rails translations
to the load path after rails has already loaded the translations, so we
have to force a reload to get the translated versions.
The sql_session_store plugin doesn't work with rails 3 and doesn't
seem to be supported anymore, so drop it in favour of the builtin
database backed session storage.
It's impossible to stop rails 2 loading a newer i18n gem if it is
installed, so go with the flow and use the latest one but override
the interpolation pattern for now.
Contrary to what the ruby documentation says, sending a signal
to PID 0 actually signals the whole process group, not just the
current process. So use Process.pid to make sure we only signal
the current process.
Rails 3 pulls in i18n version 0.4.1 as a separate gem which then
breaks our code if it is running on a machine with rails 3 installed
as it tries to monkey patch i18n and fails, so this fix allows us
to run on a machine with rails 3 installed.
Use a preinitializer to load the settings from application.yml so
that they are available as early as possible. All settings can also
be overridden using environment variables.
The ad-hoc settins in environment.rb are then moved to this new
system so we have one consistent location for settings.
Falling back to the rails code for pk_and_sequence_for doesn't work
because we still wind up retrying the slow version of the query for
tables with no primary key. So just replace it instead.
Rails tries to query the system tables to find the primary key
and it's controlling sequence, but it doesn't specify that it is
looking for objects of class "pg_class" so the pg_depend table
has to be sequentially scanned instead of being accessed using
the index.
Tests on the production database show that the time taken for
this query drops from 3.5s to 15ms if the index is used.
time.formats in the locale and then looks for the requested format in
that hash, thereby not doing fallback correctly. To make things worse
it then defaults to just using the requested format name as the format...