Skip to content

Commit

Permalink
Use AR Arel table to type cast booleans in order to avoid deprecation…
Browse files Browse the repository at this point in the history
… warning

```
DEPRECATION WARNING: Passing a column to `quote` has been deprecated. It
is only used for type casting, which should be handled elsewhere.
```
  • Loading branch information
thom-oman committed Dec 16, 2020
1 parent ca83329 commit 5ee572f
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions lib/statesman/adapters/active_record.rb
Original file line number Diff line number Diff line change
Expand Up @@ -305,19 +305,11 @@ def mysql_gaplock_protection?
end

def db_true
value = ::ActiveRecord::Base.connection.type_cast(
true,
transition_class.columns_hash["most_recent"],
)
::ActiveRecord::Base.connection.quote(value)
Arel::Nodes::Quoted.new(true).to_sql
end

def db_false
value = ::ActiveRecord::Base.connection.type_cast(
false,
transition_class.columns_hash["most_recent"],
)
::ActiveRecord::Base.connection.quote(value)
Arel::Nodes::Quoted.new(false).to_sql
end

def db_null
Expand Down

0 comments on commit 5ee572f

Please sign in to comment.