From 45438fcfc4084d9e56b6f0c079eaaff8557c24d9 Mon Sep 17 00:00:00 2001 From: Felipe Renan Date: Fri, 25 Jan 2019 17:01:28 -0200 Subject: [PATCH] Fix SQLite3 warning Before setting this option, our test suite was giving the following warning: ``` DEPRECATION WARNING: Leaving `ActiveRecord::ConnectionAdapters::SQLite3Adapter.represent_boolean_as_integer` set to false is deprecated. SQLite databases have used 't' and 'f' to serialize boolean values and must have old data converted to 1 and 0 (its native boolean serialization) before setting this flag to true. Conversion can be accomplished by setting up a rake task which runs ExampleModel.where("boolean_column = 't'").update_all(boolean_column: 1) ExampleModel.where("boolean_column = 'f'").update_all(boolean_column: 0) for all models and all boolean columns, after which the flag must be set to true by adding the following to your application.rb file: Rails.application.config.active_record.sqlite3.represent_boolean_as_integer = true (called from at $PATH/devise/test/rails_app/app/active_record/user.rb:5) ``` After configuring `represent_boolean_as_integer = true` as specified above, we don't have this warning anymore. More info: https://api.rubyonrails.org/classes/ActiveRecord/ConnectionAdapters/SQLite3Adapter.html#method-c-represent_boolean_as_integer --- test/rails_app/config/application.rb | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/test/rails_app/config/application.rb b/test/rails_app/config/application.rb index 6d4606d6..d39fa7dd 100644 --- a/test/rails_app/config/application.rb +++ b/test/rails_app/config/application.rb @@ -44,5 +44,10 @@ module RailsApp config.to_prepare do Devise::SessionsController.layout "application" end + + # Remove this check once Rails 5.0 support is removed. + if Devise::Test.rails52_and_up? + Rails.application.config.active_record.sqlite3.represent_boolean_as_integer = true + end end end