buoys 1.0.0 → 2.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (73) hide show
  1. checksums.yaml +5 -5
  2. data/README.md +1 -1
  3. data/Rakefile +2 -0
  4. data/lib/buoys/buoy.rb +2 -2
  5. data/lib/buoys/helper.rb +1 -1
  6. data/lib/buoys/loader.rb +1 -1
  7. data/lib/buoys/version.rb +1 -1
  8. data/lib/generators/buoys/install_generator.rb +1 -1
  9. data/lib/generators/buoys/templates/_buoys.html.erb +1 -1
  10. data/lib/generators/buoys/templates/breadcrumbs.rb +1 -1
  11. data/test/buoys_buoy_test.rb +17 -1
  12. data/test/buoys_generator_test.rb +1 -0
  13. data/test/dummy/Rakefile +1 -1
  14. data/test/dummy/app/assets/config/manifest.js +3 -0
  15. data/test/dummy/app/assets/javascripts/application.js +3 -1
  16. data/test/dummy/app/assets/javascripts/cable.js +13 -0
  17. data/test/dummy/app/assets/stylesheets/application.css +3 -3
  18. data/test/dummy/app/channels/application_cable/channel.rb +4 -0
  19. data/test/dummy/app/channels/application_cable/connection.rb +4 -0
  20. data/test/dummy/app/controllers/application_controller.rb +0 -5
  21. data/test/dummy/app/helpers/application_helper.rb +0 -2
  22. data/test/dummy/app/jobs/application_job.rb +2 -0
  23. data/test/dummy/app/mailers/application_mailer.rb +4 -0
  24. data/test/dummy/app/models/application_record.rb +3 -0
  25. data/test/dummy/app/models/item.rb +1 -1
  26. data/test/dummy/app/models/user.rb +1 -1
  27. data/test/dummy/app/views/layouts/application.html.erb +10 -9
  28. data/test/dummy/app/views/layouts/mailer.html.erb +13 -0
  29. data/test/dummy/app/views/layouts/mailer.text.erb +1 -0
  30. data/test/dummy/bin/bundle +1 -1
  31. data/test/dummy/bin/rails +1 -1
  32. data/test/dummy/bin/setup +20 -13
  33. data/test/dummy/bin/update +31 -0
  34. data/test/dummy/bin/yarn +11 -0
  35. data/test/dummy/config/application.rb +9 -21
  36. data/test/dummy/config/boot.rb +2 -4
  37. data/test/dummy/config/cable.yml +10 -0
  38. data/test/dummy/config/database.yml +1 -1
  39. data/test/dummy/config/environment.rb +1 -3
  40. data/test/dummy/config/environments/development.rb +31 -13
  41. data/test/dummy/config/environments/production.rb +31 -18
  42. data/test/dummy/config/environments/test.rb +10 -13
  43. data/test/dummy/config/initializers/application_controller_renderer.rb +8 -0
  44. data/test/dummy/config/initializers/assets.rb +6 -5
  45. data/test/dummy/config/initializers/backtrace_silencers.rb +0 -2
  46. data/test/dummy/config/initializers/content_security_policy.rb +25 -0
  47. data/test/dummy/config/initializers/cookies_serializer.rb +2 -2
  48. data/test/dummy/config/initializers/filter_parameter_logging.rb +0 -2
  49. data/test/dummy/config/initializers/inflections.rb +0 -2
  50. data/test/dummy/config/initializers/mime_types.rb +0 -2
  51. data/test/dummy/config/initializers/wrap_parameters.rb +2 -4
  52. data/test/dummy/config/locales/en.yml +10 -0
  53. data/test/dummy/config/puma.rb +37 -0
  54. data/test/dummy/config/routes.rb +2 -2
  55. data/test/dummy/config/spring.rb +6 -0
  56. data/test/dummy/config/storage.yml +34 -0
  57. data/test/dummy/config.ru +2 -1
  58. data/test/dummy/db/development.sqlite3 +0 -0
  59. data/test/dummy/db/test.sqlite3 +0 -0
  60. data/test/dummy/log/development.log +105 -0
  61. data/test/dummy/log/test.log +396 -267
  62. data/test/dummy/package.json +5 -0
  63. data/test/dummy/public/404.html +6 -6
  64. data/test/dummy/public/422.html +6 -6
  65. data/test/dummy/public/500.html +6 -6
  66. data/test/dummy/public/apple-touch-icon-precomposed.png +0 -0
  67. data/test/dummy/public/apple-touch-icon.png +0 -0
  68. data/test/dummy/tmp/development_secret.txt +1 -0
  69. data/test/test_helper.rb +6 -7
  70. metadata +87 -53
  71. data/test/dummy/README.rdoc +0 -28
  72. data/test/dummy/config/initializers/session_store.rb +0 -5
  73. data/test/dummy/config/secrets.yml +0 -22
@@ -1,5 +1,3 @@
1
- # frozen_string_literal: true
2
-
3
1
  Rails.application.configure do
4
2
  # Settings specified here will take precedence over those in config/application.rb.
5
3
 
@@ -16,15 +14,13 @@ Rails.application.configure do
16
14
  config.consider_all_requests_local = false
17
15
  config.action_controller.perform_caching = true
18
16
 
19
- # Enable Rack::Cache to put a simple HTTP cache in front of your application
20
- # Add `rack-cache` to your Gemfile before enabling this.
21
- # For large-scale production use, consider using a caching reverse proxy like
22
- # NGINX, varnish or squid.
23
- # config.action_dispatch.rack_cache = true
17
+ # Ensures that a master key has been made available in either ENV["RAILS_MASTER_KEY"]
18
+ # or in config/master.key. This key is used to decrypt credentials (and other encrypted files).
19
+ # config.require_master_key = true
24
20
 
25
21
  # Disable serving static files from the `/public` folder by default since
26
22
  # Apache or NGINX already handles this.
27
- config.serve_static_files = ENV['RAILS_SERVE_STATIC_FILES'].present?
23
+ config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present?
28
24
 
29
25
  # Compress JavaScripts and CSS.
30
26
  config.assets.js_compressor = :uglifier
@@ -33,16 +29,23 @@ Rails.application.configure do
33
29
  # Do not fallback to assets pipeline if a precompiled asset is missed.
34
30
  config.assets.compile = false
35
31
 
36
- # Asset digests allow you to set far-future HTTP expiration dates on all assets,
37
- # yet still be able to expire them through the digest params.
38
- config.assets.digest = true
39
-
40
32
  # `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb
41
33
 
34
+ # Enable serving of images, stylesheets, and JavaScripts from an asset server.
35
+ # config.action_controller.asset_host = 'http://assets.example.com'
36
+
42
37
  # Specifies the header that your server uses for sending files.
43
38
  # config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache
44
39
  # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX
45
40
 
41
+ # Store uploaded files on the local file system (see config/storage.yml for options)
42
+ config.active_storage.service = :local
43
+
44
+ # Mount Action Cable outside main process or domain
45
+ # config.action_cable.mount_path = nil
46
+ # config.action_cable.url = 'wss://example.com/cable'
47
+ # config.action_cable.allowed_request_origins = [ 'http://example.com', /http:\/\/example.*/ ]
48
+
46
49
  # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
47
50
  # config.force_ssl = true
48
51
 
@@ -51,16 +54,16 @@ Rails.application.configure do
51
54
  config.log_level = :debug
52
55
 
53
56
  # Prepend all log lines with the following tags.
54
- # config.log_tags = [ :subdomain, :uuid ]
55
-
56
- # Use a different logger for distributed setups.
57
- # config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)
57
+ config.log_tags = [ :request_id ]
58
58
 
59
59
  # Use a different cache store in production.
60
60
  # config.cache_store = :mem_cache_store
61
61
 
62
- # Enable serving of images, stylesheets, and JavaScripts from an asset server.
63
- # config.action_controller.asset_host = 'http://assets.example.com'
62
+ # Use a real queuing backend for Active Job (and separate queues per environment)
63
+ # config.active_job.queue_adapter = :resque
64
+ # config.active_job.queue_name_prefix = "dummy_#{Rails.env}"
65
+
66
+ config.action_mailer.perform_caching = false
64
67
 
65
68
  # Ignore bad email addresses and do not raise email delivery errors.
66
69
  # Set this to true and configure the email server for immediate delivery to raise delivery errors.
@@ -76,6 +79,16 @@ Rails.application.configure do
76
79
  # Use default logging formatter so that PID and timestamp are not suppressed.
77
80
  config.log_formatter = ::Logger::Formatter.new
78
81
 
82
+ # Use a different logger for distributed setups.
83
+ # require 'syslog/logger'
84
+ # config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new 'app-name')
85
+
86
+ if ENV["RAILS_LOG_TO_STDOUT"].present?
87
+ logger = ActiveSupport::Logger.new(STDOUT)
88
+ logger.formatter = config.log_formatter
89
+ config.logger = ActiveSupport::TaggedLogging.new(logger)
90
+ end
91
+
79
92
  # Do not dump schema after migrations.
80
93
  config.active_record.dump_schema_after_migration = false
81
94
  end
@@ -1,5 +1,3 @@
1
- # frozen_string_literal: true
2
-
3
1
  Rails.application.configure do
4
2
  # Settings specified here will take precedence over those in config/application.rb.
5
3
 
@@ -14,14 +12,11 @@ Rails.application.configure do
14
12
  # preloads Rails for running tests, you may have to set it to true.
15
13
  config.eager_load = false
16
14
 
17
- # Configure static file server for tests with Cache-Control for performance.
18
- if Gem::Version.new(Rails.version) >= Gem::Version.new('5.0.0')
19
- config.public_file_server.enabled = true
20
- config.public_file_server.headers = {'Cache-Control' => 'public, max-age=3600'}
21
- else
22
- config.serve_static_files = true
23
- config.static_cache_control = 'public, max-age=3600'
24
- end
15
+ # Configure public file server for tests with Cache-Control for performance.
16
+ config.public_file_server.enabled = true
17
+ config.public_file_server.headers = {
18
+ 'Cache-Control' => "public, max-age=#{1.hour.to_i}"
19
+ }
25
20
 
26
21
  # Show full error reports and disable caching.
27
22
  config.consider_all_requests_local = true
@@ -33,14 +28,16 @@ Rails.application.configure do
33
28
  # Disable request forgery protection in test environment.
34
29
  config.action_controller.allow_forgery_protection = false
35
30
 
31
+ # Store uploaded files on the local file system in a temporary directory
32
+ config.active_storage.service = :test
33
+
34
+ config.action_mailer.perform_caching = false
35
+
36
36
  # Tell Action Mailer not to deliver emails to the real world.
37
37
  # The :test delivery method accumulates sent emails in the
38
38
  # ActionMailer::Base.deliveries array.
39
39
  config.action_mailer.delivery_method = :test
40
40
 
41
- # Randomize the order test cases are executed.
42
- config.active_support.test_order = :random
43
-
44
41
  # Print deprecation notices to the stderr.
45
42
  config.active_support.deprecation = :stderr
46
43
 
@@ -0,0 +1,8 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # ActiveSupport::Reloader.to_prepare do
4
+ # ApplicationController.renderer.defaults.merge!(
5
+ # http_host: 'example.org',
6
+ # https: false
7
+ # )
8
+ # end
@@ -1,13 +1,14 @@
1
- # frozen_string_literal: true
2
-
3
1
  # Be sure to restart your server when you modify this file.
4
2
 
5
3
  # Version of your assets, change this if you want to expire all your assets.
6
4
  Rails.application.config.assets.version = '1.0'
7
5
 
8
- # Add additional assets to the asset load path
6
+ # Add additional assets to the asset load path.
9
7
  # Rails.application.config.assets.paths << Emoji.images_path
8
+ # Add Yarn node_modules folder to the asset load path.
9
+ Rails.application.config.assets.paths << Rails.root.join('node_modules')
10
10
 
11
11
  # Precompile additional assets.
12
- # application.js, application.css, and all non-JS/CSS in app/assets folder are already added.
13
- # Rails.application.config.assets.precompile += %w( search.js )
12
+ # application.js, application.css, and all non-JS/CSS in the app/assets
13
+ # folder are already added.
14
+ # Rails.application.config.assets.precompile += %w( admin.js admin.css )
@@ -1,5 +1,3 @@
1
- # frozen_string_literal: true
2
-
3
1
  # Be sure to restart your server when you modify this file.
4
2
 
5
3
  # You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
@@ -0,0 +1,25 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Define an application-wide content security policy
4
+ # For further information see the following documentation
5
+ # https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy
6
+
7
+ # Rails.application.config.content_security_policy do |policy|
8
+ # policy.default_src :self, :https
9
+ # policy.font_src :self, :https, :data
10
+ # policy.img_src :self, :https, :data
11
+ # policy.object_src :none
12
+ # policy.script_src :self, :https
13
+ # policy.style_src :self, :https
14
+
15
+ # # Specify URI for violation reports
16
+ # # policy.report_uri "/csp-violation-report-endpoint"
17
+ # end
18
+
19
+ # If you are using UJS then enable automatic nonce generation
20
+ # Rails.application.config.content_security_policy_nonce_generator = -> request { SecureRandom.base64(16) }
21
+
22
+ # Report CSP violations to a specified URI
23
+ # For further information see the following documentation:
24
+ # https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy-Report-Only
25
+ # Rails.application.config.content_security_policy_report_only = true
@@ -1,5 +1,5 @@
1
- # frozen_string_literal: true
2
-
3
1
  # Be sure to restart your server when you modify this file.
4
2
 
3
+ # Specify a serializer for the signed and encrypted cookie jars.
4
+ # Valid options are :json, :marshal, and :hybrid.
5
5
  Rails.application.config.action_dispatch.cookies_serializer = :json
@@ -1,5 +1,3 @@
1
- # frozen_string_literal: true
2
-
3
1
  # Be sure to restart your server when you modify this file.
4
2
 
5
3
  # Configure sensitive parameters which will be filtered from the log file.
@@ -1,5 +1,3 @@
1
- # frozen_string_literal: true
2
-
3
1
  # Be sure to restart your server when you modify this file.
4
2
 
5
3
  # Add new inflection rules using the following format. Inflections
@@ -1,5 +1,3 @@
1
- # frozen_string_literal: true
2
-
3
1
  # Be sure to restart your server when you modify this file.
4
2
 
5
3
  # Add new mime types for use in respond_to blocks:
@@ -1,5 +1,3 @@
1
- # frozen_string_literal: true
2
-
3
1
  # Be sure to restart your server when you modify this file.
4
2
 
5
3
  # This file contains settings for ActionController::ParamsWrapper which
@@ -7,10 +5,10 @@
7
5
 
8
6
  # Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
9
7
  ActiveSupport.on_load(:action_controller) do
10
- wrap_parameters format: [:json] if respond_to?(:wrap_parameters)
8
+ wrap_parameters format: [:json]
11
9
  end
12
10
 
13
11
  # To enable root element in JSON for ActiveRecord objects.
14
12
  # ActiveSupport.on_load(:active_record) do
15
- # self.include_root_in_json = true
13
+ # self.include_root_in_json = true
16
14
  # end
@@ -16,6 +16,16 @@
16
16
  #
17
17
  # This would use the information in config/locales/es.yml.
18
18
  #
19
+ # The following keys must be escaped otherwise they will not be retrieved by
20
+ # the default I18n backend:
21
+ #
22
+ # true, false, on, off, yes, no
23
+ #
24
+ # Instead, surround them with single quotes.
25
+ #
26
+ # en:
27
+ # 'true': 'foo'
28
+ #
19
29
  # To learn more, please read the Rails Internationalization guide
20
30
  # available at http://guides.rubyonrails.org/i18n.html.
21
31
 
@@ -0,0 +1,37 @@
1
+ # Puma can serve each request in a thread from an internal thread pool.
2
+ # The `threads` method setting takes two numbers: a minimum and maximum.
3
+ # Any libraries that use thread pools should be configured to match
4
+ # the maximum value specified for Puma. Default is set to 5 threads for minimum
5
+ # and maximum; this matches the default thread size of Active Record.
6
+ #
7
+ threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 }
8
+ threads threads_count, threads_count
9
+
10
+ # Specifies the `port` that Puma will listen on to receive requests; default is 3000.
11
+ #
12
+ port ENV.fetch("PORT") { 3000 }
13
+
14
+ # Specifies the `environment` that Puma will run in.
15
+ #
16
+ environment ENV.fetch("RAILS_ENV") { "development" }
17
+
18
+ # Specifies the `pidfile` that Puma will use.
19
+ pidfile ENV.fetch("PIDFILE") { "tmp/pids/server.pid" }
20
+
21
+ # Specifies the number of `workers` to boot in clustered mode.
22
+ # Workers are forked webserver processes. If using threads and workers together
23
+ # the concurrency of the application would be max `threads` * `workers`.
24
+ # Workers do not work on JRuby or Windows (both of which do not support
25
+ # processes).
26
+ #
27
+ # workers ENV.fetch("WEB_CONCURRENCY") { 2 }
28
+
29
+ # Use the `preload_app!` method when specifying a `workers` number.
30
+ # This directive tells Puma to first boot the application and load code
31
+ # before forking the application. This takes advantage of Copy On Write
32
+ # process behavior so workers use less memory.
33
+ #
34
+ # preload_app!
35
+
36
+ # Allow puma to be restarted by `rails restart` command.
37
+ plugin :tmp_restart
@@ -1,6 +1,6 @@
1
- # frozen_string_literal: true
2
-
3
1
  Rails.application.routes.draw do
2
+ # For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html
3
+
4
4
  get 'about' => 'dummy#dummy', as: :about
5
5
  get 'about/history' => 'dummy#dummy', as: :history
6
6
 
@@ -0,0 +1,6 @@
1
+ %w[
2
+ .ruby-version
3
+ .rbenv-vars
4
+ tmp/restart.txt
5
+ tmp/caching-dev.txt
6
+ ].each { |path| Spring.watch(path) }
@@ -0,0 +1,34 @@
1
+ test:
2
+ service: Disk
3
+ root: <%= Rails.root.join("tmp/storage") %>
4
+
5
+ local:
6
+ service: Disk
7
+ root: <%= Rails.root.join("storage") %>
8
+
9
+ # Use rails credentials:edit to set the AWS secrets (as aws:access_key_id|secret_access_key)
10
+ # amazon:
11
+ # service: S3
12
+ # access_key_id: <%= Rails.application.credentials.dig(:aws, :access_key_id) %>
13
+ # secret_access_key: <%= Rails.application.credentials.dig(:aws, :secret_access_key) %>
14
+ # region: us-east-1
15
+ # bucket: your_own_bucket
16
+
17
+ # Remember not to checkin your GCS keyfile to a repository
18
+ # google:
19
+ # service: GCS
20
+ # project: your_project
21
+ # credentials: <%= Rails.root.join("path/to/gcs.keyfile") %>
22
+ # bucket: your_own_bucket
23
+
24
+ # Use rails credentials:edit to set the Azure Storage secret (as azure_storage:storage_access_key)
25
+ # microsoft:
26
+ # service: AzureStorage
27
+ # storage_account_name: your_account_name
28
+ # storage_access_key: <%= Rails.application.credentials.dig(:azure_storage, :storage_access_key) %>
29
+ # container: your_container_name
30
+
31
+ # mirror:
32
+ # service: Mirror
33
+ # primary: local
34
+ # mirrors: [ amazon, google, microsoft ]
data/test/dummy/config.ru CHANGED
@@ -1,4 +1,5 @@
1
1
  # This file is used by Rack-based servers to start the application.
2
2
 
3
- require ::File.expand_path('../config/environment', __FILE__)
3
+ require_relative 'config/environment'
4
+
4
5
  run Rails.application
File without changes
Binary file
@@ -0,0 +1,105 @@
1
+ DEPRECATION WARNING: Leaving `ActiveRecord::ConnectionAdapters::SQLite3Adapter.represent_boolean_as_integer`
2
+ set to false is deprecated. SQLite databases have used 't' and 'f' to serialize
3
+ boolean values and must have old data converted to 1 and 0 (its native boolean
4
+ serialization) before setting this flag to true. Conversion can be accomplished
5
+ by setting up a rake task which runs
6
+
7
+ ExampleModel.where("boolean_column = 't'").update_all(boolean_column: 1)
8
+ ExampleModel.where("boolean_column = 'f'").update_all(boolean_column: 0)
9
+
10
+ for all models and all boolean columns, after which the flag must be set to
11
+ true by adding the following to your application.rb file:
12
+
13
+ Rails.application.config.active_record.sqlite3.represent_boolean_as_integer = true
14
+ (called from <main> at bin/rake:4)
15
+  (0.0ms) DROP TABLE IF EXISTS "items"
16
+  (0.0ms) SELECT sqlite_version(*)
17
+  (21.7ms) CREATE TABLE "items" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL)
18
+  (0.1ms) DROP TABLE IF EXISTS "users"
19
+  (22.0ms) CREATE TABLE "users" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL)
20
+  (4.5ms) CREATE TABLE "schema_migrations" ("version" varchar NOT NULL PRIMARY KEY)
21
+  (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC
22
+  (3.2ms) INSERT INTO "schema_migrations" (version) VALUES (20160602144324)
23
+  (3.0ms) INSERT INTO "schema_migrations" (version) VALUES
24
+ (20160602144150);
25
+
26
+ 
27
+  (3.5ms) CREATE TABLE "ar_internal_metadata" ("key" varchar NOT NULL PRIMARY KEY, "value" varchar, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL)
28
+ ActiveRecord::InternalMetadata Load (0.1ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = ? LIMIT ? [["key", "environment"], ["LIMIT", 1]]
29
+  (0.0ms) begin transaction
30
+ ActiveRecord::InternalMetadata Create (0.1ms) INSERT INTO "ar_internal_metadata" ("key", "value", "created_at", "updated_at") VALUES (?, ?, ?, ?) [["key", "environment"], ["value", "development"], ["created_at", "2021-01-16 06:42:28.980182"], ["updated_at", "2021-01-16 06:42:28.980182"]]
31
+  (3.1ms) commit transaction
32
+ ActiveRecord::InternalMetadata Load (0.1ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = ? LIMIT ? [["key", "environment"], ["LIMIT", 1]]
33
+  (0.0ms) begin transaction
34
+ ActiveRecord::InternalMetadata Update (0.1ms) UPDATE "ar_internal_metadata" SET "value" = ?, "updated_at" = ? WHERE "ar_internal_metadata"."key" = ? [["value", "test"], ["updated_at", "2021-01-16 06:42:28.985152"], ["key", "environment"]]
35
+  (3.1ms) commit transaction
36
+ DEPRECATION WARNING: Leaving `ActiveRecord::ConnectionAdapters::SQLite3Adapter.represent_boolean_as_integer`
37
+ set to false is deprecated. SQLite databases have used 't' and 'f' to serialize
38
+ boolean values and must have old data converted to 1 and 0 (its native boolean
39
+ serialization) before setting this flag to true. Conversion can be accomplished
40
+ by setting up a rake task which runs
41
+
42
+ ExampleModel.where("boolean_column = 't'").update_all(boolean_column: 1)
43
+ ExampleModel.where("boolean_column = 'f'").update_all(boolean_column: 0)
44
+
45
+ for all models and all boolean columns, after which the flag must be set to
46
+ true by adding the following to your application.rb file:
47
+
48
+ Rails.application.config.active_record.sqlite3.represent_boolean_as_integer = true
49
+ (called from <main> at bin/rake:4)
50
+  (0.0ms) DROP TABLE IF EXISTS "items"
51
+  (0.0ms) SELECT sqlite_version(*)
52
+  (21.6ms) CREATE TABLE "items" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL)
53
+  (0.0ms) DROP TABLE IF EXISTS "users"
54
+  (22.3ms) CREATE TABLE "users" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL)
55
+  (3.4ms) CREATE TABLE "schema_migrations" ("version" varchar NOT NULL PRIMARY KEY)
56
+  (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC
57
+  (2.9ms) INSERT INTO "schema_migrations" (version) VALUES (20160602144324)
58
+  (2.8ms) INSERT INTO "schema_migrations" (version) VALUES
59
+ (20160602144150);
60
+
61
+ 
62
+  (3.4ms) CREATE TABLE "ar_internal_metadata" ("key" varchar NOT NULL PRIMARY KEY, "value" varchar, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL)
63
+ ActiveRecord::InternalMetadata Load (0.1ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = ? LIMIT ? [["key", "environment"], ["LIMIT", 1]]
64
+  (0.1ms) begin transaction
65
+ ActiveRecord::InternalMetadata Create (0.2ms) INSERT INTO "ar_internal_metadata" ("key", "value", "created_at", "updated_at") VALUES (?, ?, ?, ?) [["key", "environment"], ["value", "development"], ["created_at", "2021-01-16 06:43:45.010142"], ["updated_at", "2021-01-16 06:43:45.010142"]]
66
+  (3.1ms) commit transaction
67
+ ActiveRecord::InternalMetadata Load (0.1ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = ? LIMIT ? [["key", "environment"], ["LIMIT", 1]]
68
+  (0.0ms) begin transaction
69
+ ActiveRecord::InternalMetadata Update (0.1ms) UPDATE "ar_internal_metadata" SET "value" = ?, "updated_at" = ? WHERE "ar_internal_metadata"."key" = ? [["value", "test"], ["updated_at", "2021-01-16 06:43:45.015286"], ["key", "environment"]]
70
+  (3.1ms) commit transaction
71
+ DEPRECATION WARNING: Leaving `ActiveRecord::ConnectionAdapters::SQLite3Adapter.represent_boolean_as_integer`
72
+ set to false is deprecated. SQLite databases have used 't' and 'f' to serialize
73
+ boolean values and must have old data converted to 1 and 0 (its native boolean
74
+ serialization) before setting this flag to true. Conversion can be accomplished
75
+ by setting up a rake task which runs
76
+
77
+ ExampleModel.where("boolean_column = 't'").update_all(boolean_column: 1)
78
+ ExampleModel.where("boolean_column = 'f'").update_all(boolean_column: 0)
79
+
80
+ for all models and all boolean columns, after which the flag must be set to
81
+ true by adding the following to your application.rb file:
82
+
83
+ Rails.application.config.active_record.sqlite3.represent_boolean_as_integer = true
84
+ (called from <main> at bin/rake:4)
85
+  (0.0ms) DROP TABLE IF EXISTS "items"
86
+  (0.0ms) SELECT sqlite_version(*)
87
+  (4.6ms) CREATE TABLE "items" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL)
88
+  (0.0ms) DROP TABLE IF EXISTS "users"
89
+  (3.5ms) CREATE TABLE "users" ("id" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL)
90
+  (3.4ms) CREATE TABLE "schema_migrations" ("version" varchar NOT NULL PRIMARY KEY)
91
+  (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC
92
+  (2.8ms) INSERT INTO "schema_migrations" (version) VALUES (20160602144324)
93
+  (3.4ms) INSERT INTO "schema_migrations" (version) VALUES
94
+ (20160602144150);
95
+
96
+ 
97
+  (3.9ms) CREATE TABLE "ar_internal_metadata" ("key" varchar NOT NULL PRIMARY KEY, "value" varchar, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL)
98
+ ActiveRecord::InternalMetadata Load (0.1ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = ? LIMIT ? [["key", "environment"], ["LIMIT", 1]]
99
+  (0.0ms) begin transaction
100
+ ActiveRecord::InternalMetadata Create (0.1ms) INSERT INTO "ar_internal_metadata" ("key", "value", "created_at", "updated_at") VALUES (?, ?, ?, ?) [["key", "environment"], ["value", "development"], ["created_at", "2021-01-16 06:49:23.447793"], ["updated_at", "2021-01-16 06:49:23.447793"]]
101
+  (2.7ms) commit transaction
102
+ ActiveRecord::InternalMetadata Load (0.0ms) SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = ? LIMIT ? [["key", "environment"], ["LIMIT", 1]]
103
+  (0.0ms) begin transaction
104
+ ActiveRecord::InternalMetadata Update (0.1ms) UPDATE "ar_internal_metadata" SET "value" = ?, "updated_at" = ? WHERE "ar_internal_metadata"."key" = ? [["value", "test"], ["updated_at", "2021-01-16 06:49:23.451712"], ["key", "environment"]]
105
+  (2.7ms) commit transaction