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 b13788d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 10 deletions.
1 change: 1 addition & 0 deletions .ruby-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2.7.2
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)
transition_table.type_cast_for_database(:most_recent, true)
end

def db_false
value = ::ActiveRecord::Base.connection.type_cast(
false,
transition_class.columns_hash["most_recent"],
)
::ActiveRecord::Base.connection.quote(value)
transition_table.type_cast_for_database(:most_recent, false)
end

def db_null
Expand Down

0 comments on commit b13788d

Please sign in to comment.