- Fix the
&
operator which doesfind_in_set
for mysql and postgres, accepting strings and integers. - Add
regex_matches
, an alias for=~
.
- Fix a subtle bug on table access as in
table[:col]
in certain situations. ==
and!=
deprecation warnings can stem fromarel
itself, so now we don't emit them because they're plain wrong.
- Fallback to Ruby's Warning module if ActiveSupport doesn't exist. Relevant for old Rails versions.
- Added documentation on how to "properly" configure the deprecator in a Rails application.
- Use ActiveSupport's deprecation machinery instead of Ruby's Warning module.
- Fix a bug with group concat that didn't correctly check for the separator value.
- Fix deprecation warnings for
==
and!=
, showing the true location. - Always emit deprecation warnings for
==
and!=
.
- Improved deprecation warnings for
==
and!=
, showing the location where they're called.
- MS SQL: restrict date-quoting to Arel <= 6 (Rails 4.2)
- MS SQL: turn on warnings on requires only when gem is found
- Rails: 7.2 support for mysql, postgres, and sqlite.
- Attributes: deprecate
==
and!=
. They're causing issues withactive_record
, and they're not sanitary.
- MS SQL: turn on warnings on requires only when necessary.
- MS SQL: add support for jruby 9.4 via activerecord-jdbc-alt-adapter
- Postgres:
- Datetime formatting in postgres now behaves like mysql: if the target
timezone is a string, we automatically consider that you're trying to
convert from
UTC
. - Datetime casting will now automatically ask for a
timestamp without timezone
, also aligning with the expected befavior in mysql. This also makes casting work better with timezone conversion, especially if you don't pass the timezone from which you're converting to.Will produce:scope .select(Arel.quoted('2022-02-01 10:42:00') .cast(:datetime) .format_date('%Y/%m/%d %H:%M:%S', 'Europe/Paris') .as('res'))
SELECT TO_CHAR( CAST('2022-02-01 10:42:00' AS timestamp without time zone) AT TIME ZONE 'UTC' AT TIME ZONE 'Europe/Paris', 'YYYY/MM/DD HH24:MI:SS' ) AS "res" -- …
- Datetime formatting in postgres now behaves like mysql: if the target
timezone is a string, we automatically consider that you're trying to
convert from
-
o.format_date
as an alternative too.format
The actual behavior offormat
is inconsistent across DB vendors: in mysql we can format dates and numbers with it, and in the other ones we only format dates.We're planning on normalizing this behavior. We want
format
to "cleverly" format dates or numbers, andformat_date
/format_number
to strictly format dates / numbers.The introduction of
format_date
is the first step in this direction.
- This used to fail.
Arel.when(a).then(b).format('%Y-%m-%d')
o.present
, a synonym foro.not_blank
o.coalesce_blank(a, b, c)
o.if_present
, if the value isnull
or blank, then it returnsnull
, otherwise, it returns the value. Inspired by rails'presence
.