sorbet-rails 0.7.2 → 0.7.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (130) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +1 -1
  3. data/lib/sorbet-rails/config.rb +1 -0
  4. data/lib/sorbet-rails/dependent_gem_rbis/activerecord.rbi +3 -0
  5. data/lib/sorbet-rails/model_plugins/active_record_assoc.rb +17 -5
  6. data/lib/sorbet-rails/model_plugins/active_record_attribute.rb +2 -0
  7. data/lib/sorbet-rails/model_plugins/active_record_serialized_attribute.rb +68 -0
  8. data/lib/sorbet-rails/model_plugins/base.rb +8 -0
  9. data/lib/sorbet-rails/model_plugins/plugins.rb +3 -0
  10. data/lib/sorbet-rails/model_rbi_formatter.rb +3 -3
  11. data/lib/sorbet-rails/rails_mixins/pluck_to_tstruct.rb +39 -2
  12. data/lib/sorbet-rails/routes_rbi_formatter.rb +4 -0
  13. data/lib/sorbet-rails/tasks/rails_rbi.rake +4 -3
  14. data/sorbet-rails.gemspec +1 -1
  15. data/spec/bin/run_spec.sh +1 -1
  16. data/spec/generators/rails-template.rb +16 -0
  17. data/spec/generators/sorbet_test_cases.rb +15 -0
  18. data/spec/pluck_to_tstruct_spec.rb +51 -25
  19. data/spec/sorbet_spec.rb +1 -1
  20. data/spec/support/v5.0/Gemfile.lock +4 -4
  21. data/spec/support/v5.0/app/controllers/application_controller.rb +1 -1
  22. data/spec/support/v5.0/app/models/headmaster.rb +1 -1
  23. data/spec/support/v5.0/app/models/potion.rb +1 -1
  24. data/spec/support/v5.0/app/models/robe.rb +1 -1
  25. data/spec/support/v5.0/app/models/school.rb +1 -1
  26. data/spec/support/v5.0/app/models/spell.rb +1 -1
  27. data/spec/support/v5.0/app/models/subject.rb +1 -1
  28. data/spec/support/v5.0/app/models/wizard.rb +5 -0
  29. data/spec/support/v5.0/config/environments/development.rb +1 -1
  30. data/spec/support/v5.0/config/environments/production.rb +1 -1
  31. data/spec/support/v5.0/config/environments/test.rb +1 -1
  32. data/spec/support/v5.0/config/initializers/wrap_parameters.rb +1 -1
  33. data/spec/support/v5.0/config/routes.rb +1 -1
  34. data/spec/support/v5.0/db/migrate/20190620000015_add_serialized_to_wizards.rb +9 -0
  35. data/spec/support/v5.0/db/schema.rb +8 -4
  36. data/spec/support/v5.0/sorbet_test_cases.rb +15 -0
  37. data/spec/support/v5.1/Gemfile.lock +4 -4
  38. data/spec/support/v5.1/app/controllers/application_controller.rb +1 -1
  39. data/spec/support/v5.1/app/models/headmaster.rb +1 -1
  40. data/spec/support/v5.1/app/models/school.rb +1 -1
  41. data/spec/support/v5.1/app/models/wizard.rb +5 -0
  42. data/spec/support/v5.1/config/environments/production.rb +1 -1
  43. data/spec/support/v5.1/config/initializers/wrap_parameters.rb +1 -1
  44. data/spec/support/v5.1/config/routes.rb +1 -1
  45. data/spec/support/v5.1/db/migrate/20190620000015_add_serialized_to_wizards.rb +9 -0
  46. data/spec/support/v5.1/db/schema.rb +5 -1
  47. data/spec/support/v5.1/sorbet_test_cases.rb +15 -0
  48. data/spec/support/v5.2/Gemfile.lock +4 -4
  49. data/spec/support/v5.2/app/models/headmaster.rb +1 -1
  50. data/spec/support/v5.2/app/models/school.rb +1 -1
  51. data/spec/support/v5.2/app/models/wizard.rb +5 -0
  52. data/spec/support/v5.2/config/environments/development.rb +1 -1
  53. data/spec/support/v5.2/config/environments/production.rb +1 -1
  54. data/spec/support/v5.2/config/environments/test.rb +1 -1
  55. data/spec/support/v5.2/config/initializers/wrap_parameters.rb +1 -1
  56. data/spec/support/v5.2/config/routes.rb +1 -1
  57. data/spec/support/v5.2/db/migrate/20190620000015_add_serialized_to_wizards.rb +9 -0
  58. data/spec/support/v5.2/db/schema.rb +5 -1
  59. data/spec/support/v5.2/sorbet_test_cases.rb +15 -0
  60. data/spec/support/v6.0/Gemfile.lock +4 -4
  61. data/spec/support/v6.0/app/models/wizard.rb +5 -0
  62. data/spec/support/v6.0/config/environments/development.rb +1 -1
  63. data/spec/support/v6.0/config/environments/production.rb +1 -1
  64. data/spec/support/v6.0/config/environments/test.rb +1 -1
  65. data/spec/support/v6.0/config/routes.rb +1 -1
  66. data/spec/support/v6.0/db/migrate/20190620000015_add_serialized_to_wizards.rb +9 -0
  67. data/spec/support/v6.0/db/schema.rb +5 -1
  68. data/spec/support/v6.0/sorbet_test_cases.rb +15 -0
  69. data/spec/test_data/v5.0/expected_headmaster.rbi +6 -0
  70. data/spec/test_data/v5.0/expected_potion.rbi +3 -0
  71. data/spec/test_data/v5.0/expected_robe.rbi +3 -0
  72. data/spec/test_data/v5.0/expected_routes.rbi +4 -0
  73. data/spec/test_data/v5.0/expected_school.rbi +3 -0
  74. data/spec/test_data/v5.0/expected_spell/habtm_spell_books.rbi +6 -0
  75. data/spec/test_data/v5.0/expected_spell_book.rbi +3 -0
  76. data/spec/test_data/v5.0/expected_spell_book/habtm_spells.rbi +6 -0
  77. data/spec/test_data/v5.0/expected_squib.rbi +45 -0
  78. data/spec/test_data/v5.0/expected_subject/habtm_wizards.rbi +6 -0
  79. data/spec/test_data/v5.0/expected_wand.rbi +3 -0
  80. data/spec/test_data/v5.0/expected_wizard.rbi +45 -0
  81. data/spec/test_data/v5.0/expected_wizard/habtm_subjects.rbi +6 -0
  82. data/spec/test_data/v5.0/expected_wizard_wo_spellbook.rbi +45 -0
  83. data/spec/test_data/v5.1/expected_headmaster.rbi +6 -0
  84. data/spec/test_data/v5.1/expected_potion.rbi +3 -0
  85. data/spec/test_data/v5.1/expected_robe.rbi +3 -0
  86. data/spec/test_data/v5.1/expected_routes.rbi +4 -0
  87. data/spec/test_data/v5.1/expected_school.rbi +3 -0
  88. data/spec/test_data/v5.1/expected_spell/habtm_spell_books.rbi +6 -0
  89. data/spec/test_data/v5.1/expected_spell_book.rbi +3 -0
  90. data/spec/test_data/v5.1/expected_spell_book/habtm_spells.rbi +6 -0
  91. data/spec/test_data/v5.1/expected_squib.rbi +45 -0
  92. data/spec/test_data/v5.1/expected_subject/habtm_wizards.rbi +6 -0
  93. data/spec/test_data/v5.1/expected_wand.rbi +3 -0
  94. data/spec/test_data/v5.1/expected_wizard.rbi +45 -0
  95. data/spec/test_data/v5.1/expected_wizard/habtm_subjects.rbi +6 -0
  96. data/spec/test_data/v5.1/expected_wizard_wo_spellbook.rbi +45 -0
  97. data/spec/test_data/v5.2/expected_attachment.rbi +6 -0
  98. data/spec/test_data/v5.2/expected_blob.rbi +6 -0
  99. data/spec/test_data/v5.2/expected_headmaster.rbi +6 -0
  100. data/spec/test_data/v5.2/expected_potion.rbi +3 -0
  101. data/spec/test_data/v5.2/expected_robe.rbi +3 -0
  102. data/spec/test_data/v5.2/expected_routes.rbi +4 -0
  103. data/spec/test_data/v5.2/expected_school.rbi +3 -0
  104. data/spec/test_data/v5.2/expected_spell/habtm_spell_books.rbi +6 -0
  105. data/spec/test_data/v5.2/expected_spell_book.rbi +3 -0
  106. data/spec/test_data/v5.2/expected_spell_book/habtm_spells.rbi +6 -0
  107. data/spec/test_data/v5.2/expected_squib.rbi +51 -0
  108. data/spec/test_data/v5.2/expected_subject/habtm_wizards.rbi +6 -0
  109. data/spec/test_data/v5.2/expected_wand.rbi +3 -0
  110. data/spec/test_data/v5.2/expected_wizard.rbi +51 -0
  111. data/spec/test_data/v5.2/expected_wizard/habtm_subjects.rbi +6 -0
  112. data/spec/test_data/v5.2/expected_wizard_wo_spellbook.rbi +51 -0
  113. data/spec/test_data/v6.0/expected_attachment.rbi +6 -0
  114. data/spec/test_data/v6.0/expected_blob.rbi +6 -0
  115. data/spec/test_data/v6.0/expected_headmaster.rbi +6 -0
  116. data/spec/test_data/v6.0/expected_potion.rbi +3 -0
  117. data/spec/test_data/v6.0/expected_robe.rbi +3 -0
  118. data/spec/test_data/v6.0/expected_routes.rbi +4 -0
  119. data/spec/test_data/v6.0/expected_school.rbi +3 -0
  120. data/spec/test_data/v6.0/expected_spell/habtm_spell_books.rbi +6 -0
  121. data/spec/test_data/v6.0/expected_spell_book.rbi +3 -0
  122. data/spec/test_data/v6.0/expected_spell_book/habtm_spells.rbi +6 -0
  123. data/spec/test_data/v6.0/expected_squib.rbi +51 -0
  124. data/spec/test_data/v6.0/expected_subject/habtm_wizards.rbi +6 -0
  125. data/spec/test_data/v6.0/expected_wand.rbi +3 -0
  126. data/spec/test_data/v6.0/expected_wizard.rbi +51 -0
  127. data/spec/test_data/v6.0/expected_wizard/habtm_subjects.rbi +6 -0
  128. data/spec/test_data/v6.0/expected_wizard_wo_spellbook.rbi +51 -0
  129. data/spec/tstruct_comparable.rb +13 -0
  130. metadata +12 -1
@@ -1,7 +1,7 @@
1
1
  require 'rails_helper'
2
2
  require 'open3'
3
3
 
4
- RSpec.xdescribe 'sorbet' do
4
+ RSpec.describe 'sorbet' do
5
5
  let!(:harry) do
6
6
  Wizard.create!(
7
7
  name: 'Harry Potter',
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ../../..
3
3
  specs:
4
- sorbet-rails (0.7.2)
4
+ sorbet-rails (0.7.3)
5
5
  method_source (>= 0.9.2)
6
6
  parlour (>= 4.0.1)
7
7
  parser (>= 2.7)
@@ -76,12 +76,12 @@ GEM
76
76
  nio4r (2.5.2)
77
77
  nokogiri (1.10.9)
78
78
  mini_portile2 (~> 2.4.0)
79
- parlour (4.0.1)
79
+ parlour (5.0.0)
80
80
  commander (~> 4.5)
81
81
  parser
82
82
  rainbow (~> 3.0)
83
83
  sorbet-runtime (>= 0.5)
84
- parser (2.7.2.0)
84
+ parser (3.0.0.0)
85
85
  ast (~> 2.4.1)
86
86
  polyfill (1.9.0)
87
87
  puma (3.12.6)
@@ -116,7 +116,7 @@ GEM
116
116
  safe_type (1.1.1)
117
117
  sorbet (0.5.5480)
118
118
  sorbet-static (= 0.5.5480)
119
- sorbet-coerce (0.2.7)
119
+ sorbet-coerce (0.3.0)
120
120
  polyfill (~> 1.8)
121
121
  safe_type (~> 1.1, >= 1.1.1)
122
122
  sorbet (>= 0.4.4704)
@@ -1,4 +1,4 @@
1
- # typed: strong
1
+ # typed: strict
2
2
  class ApplicationController < ActionController::Base
3
3
  protect_from_forgery with: :exception
4
4
  end
@@ -1,4 +1,4 @@
1
- # typed: strong
1
+ # typed: strict
2
2
  class Headmaster < ApplicationRecord
3
3
  belongs_to :school, required: false
4
4
  belongs_to :wizard, optional: true
@@ -1,4 +1,4 @@
1
- # typed: strong
1
+ # typed: strict
2
2
  # an abstract class that has no table
3
3
  class Potion < ApplicationRecord
4
4
  self.abstract_class = true
@@ -1,4 +1,4 @@
1
- # typed: strong
1
+ # typed: strict
2
2
  class Robe < ApplicationRecord
3
3
  belongs_to :wizard, required: false
4
4
  end
@@ -1,4 +1,4 @@
1
- # typed: strong
1
+ # typed: strict
2
2
  class School < ApplicationRecord
3
3
  has_one :headmaster
4
4
  validates :headmaster, presence: true
@@ -1,4 +1,4 @@
1
- # typed: strong
1
+ # typed: strict
2
2
  class Spell < ApplicationRecord
3
3
  # habtm enforced at the DB level
4
4
  has_and_belongs_to_many :spell_books
@@ -1,4 +1,4 @@
1
- # typed: strong
1
+ # typed: strict
2
2
  class Subject < ApplicationRecord
3
3
  # habtm which is optional at the db level
4
4
  has_and_belongs_to_many :wizards
@@ -47,6 +47,11 @@ class Wizard < ApplicationRecord
47
47
  blue: 2,
48
48
  }, _prefix: :color, _suffix: :eyes
49
49
 
50
+ serialize :owl_results, Hash
51
+ serialize :newt_subjects # no specific data type, uses the default YAML Object coder
52
+ serialize :pets, Array
53
+ serialize :patronus_characteristics, JSON
54
+
50
55
  has_one :wand
51
56
  has_many :spell_books
52
57
  # habtm which is optional at the db level
@@ -1,4 +1,4 @@
1
- # typed: strict
1
+ # typed: false
2
2
  Rails.application.configure do
3
3
  # Settings specified here will take precedence over those in config/application.rb.
4
4
 
@@ -1,4 +1,4 @@
1
- # typed: strict
1
+ # typed: false
2
2
  Rails.application.configure do
3
3
  # Settings specified here will take precedence over those in config/application.rb.
4
4
 
@@ -1,4 +1,4 @@
1
- # typed: strict
1
+ # typed: false
2
2
  Rails.application.configure do
3
3
  # Settings specified here will take precedence over those in config/application.rb.
4
4
 
@@ -1,4 +1,4 @@
1
- # typed: strict
1
+ # typed: false
2
2
  # Be sure to restart your server when you modify this file.
3
3
 
4
4
  # This file contains settings for ActionController::ParamsWrapper which
@@ -1,4 +1,4 @@
1
- # typed: strict
1
+ # typed: false
2
2
  Rails.application.routes.draw do
3
3
  get 'test/index' => 'test#index'
4
4
  # For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html
@@ -0,0 +1,9 @@
1
+ # typed: false
2
+ class AddSerializedToWizards < ActiveRecord::Migration[5.0]
3
+ def change
4
+ add_column :wizards, :owl_results, :text # Hash
5
+ add_column :wizards, :newt_subjects, :text # generic
6
+ add_column :wizards, :pets, :text # Array
7
+ add_column :wizards, :patronus_characteristics, :text # serialized as JSON, but not a JSON column type
8
+ end
9
+ end
@@ -11,7 +11,7 @@
11
11
  #
12
12
  # It's strongly recommended that you check this file into your version control system.
13
13
 
14
- ActiveRecord::Schema.define(version: 20190620000014) do
14
+ ActiveRecord::Schema.define(version: 20190620000015) do
15
15
 
16
16
  create_table "headmasters", force: :cascade do |t|
17
17
  t.integer "school_id"
@@ -78,15 +78,19 @@ ActiveRecord::Schema.define(version: 20190620000014) do
78
78
  t.integer "professor"
79
79
  t.string "parent_email"
80
80
  t.text "notes"
81
- t.datetime "created_at", null: false
82
- t.datetime "updated_at", null: false
81
+ t.datetime "created_at", null: false
82
+ t.datetime "updated_at", null: false
83
83
  t.string "broom"
84
84
  t.integer "quidditch_position"
85
85
  t.integer "hair_color"
86
86
  t.integer "eye_color"
87
87
  t.integer "hair_length"
88
- t.string "type", default: "Wizard", null: false
88
+ t.string "type", default: "Wizard", null: false
89
89
  t.integer "school_id"
90
+ t.text "owl_results"
91
+ t.text "newt_subjects"
92
+ t.text "pets"
93
+ t.text "patronus_characteristics"
90
94
  end
91
95
 
92
96
  end
@@ -305,6 +305,21 @@ T.assert_type!(Wizard::House::Hufflepuff, Wizard::House)
305
305
  T.assert_type!(Wizard::House::Ravenclaw, Wizard::House)
306
306
  T.assert_type!(Wizard::House::Slytherin, Wizard::House)
307
307
 
308
+ # Serialization
309
+ T.assert_type!(
310
+ wizard.owl_results,
311
+ T.nilable(T::Hash[T.untyped, T.untyped])
312
+ )
313
+ T.assert_type!(
314
+ wizard.newt_subjects,
315
+ T.nilable(T.any(T::Array[T.untyped], T::Boolean, Float, T::Hash[T.untyped, T.untyped], Integer, String))
316
+ )
317
+ T.assert_type!(
318
+ wizard.patronus_characteristics,
319
+ T.nilable(T.any(T::Array[T.untyped], T::Boolean, Float, T::Hash[String, T.untyped], Integer, String))
320
+ )
321
+ T.assert_type!(wizard.pets, T.nilable(T::Array[T.untyped]))
322
+
308
323
  # Mythical plugin
309
324
  T.assert_type!(Wand.mythicals, T::Array[Wand])
310
325
 
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ../../..
3
3
  specs:
4
- sorbet-rails (0.7.2)
4
+ sorbet-rails (0.7.3)
5
5
  method_source (>= 0.9.2)
6
6
  parlour (>= 4.0.1)
7
7
  parser (>= 2.7)
@@ -77,12 +77,12 @@ GEM
77
77
  nio4r (2.5.2)
78
78
  nokogiri (1.10.9)
79
79
  mini_portile2 (~> 2.4.0)
80
- parlour (4.0.1)
80
+ parlour (5.0.0)
81
81
  commander (~> 4.5)
82
82
  parser
83
83
  rainbow (~> 3.0)
84
84
  sorbet-runtime (>= 0.5)
85
- parser (2.7.2.0)
85
+ parser (3.0.0.0)
86
86
  ast (~> 2.4.1)
87
87
  polyfill (1.9.0)
88
88
  puma (3.12.4)
@@ -117,7 +117,7 @@ GEM
117
117
  safe_type (1.1.1)
118
118
  sorbet (0.5.5480)
119
119
  sorbet-static (= 0.5.5480)
120
- sorbet-coerce (0.2.7)
120
+ sorbet-coerce (0.3.0)
121
121
  polyfill (~> 1.8)
122
122
  safe_type (~> 1.1, >= 1.1.1)
123
123
  sorbet (>= 0.4.4704)
@@ -1,4 +1,4 @@
1
- # typed: strong
1
+ # typed: strict
2
2
  class ApplicationController < ActionController::Base
3
3
  protect_from_forgery with: :exception
4
4
  end
@@ -1,4 +1,4 @@
1
- # typed: strong
1
+ # typed: strict
2
2
  class Headmaster < ApplicationRecord
3
3
  belongs_to :school, required: false
4
4
  belongs_to :wizard, optional: true
@@ -1,4 +1,4 @@
1
- # typed: strong
1
+ # typed: strict
2
2
  class School < ApplicationRecord
3
3
  has_one :headmaster
4
4
  validates :headmaster, presence: true
@@ -47,6 +47,11 @@ class Wizard < ApplicationRecord
47
47
  blue: 2,
48
48
  }, _prefix: :color, _suffix: :eyes
49
49
 
50
+ serialize :owl_results, Hash
51
+ serialize :newt_subjects # no specific data type, uses the default YAML Object coder
52
+ serialize :pets, Array
53
+ serialize :patronus_characteristics, JSON
54
+
50
55
  has_one :wand
51
56
  has_many :spell_books
52
57
  # habtm which is optional at the db level
@@ -1,4 +1,4 @@
1
- # typed: strict
1
+ # typed: false
2
2
  Rails.application.configure do
3
3
  # Settings specified here will take precedence over those in config/application.rb.
4
4
 
@@ -1,4 +1,4 @@
1
- # typed: strict
1
+ # typed: false
2
2
  # Be sure to restart your server when you modify this file.
3
3
 
4
4
  # This file contains settings for ActionController::ParamsWrapper which
@@ -1,4 +1,4 @@
1
- # typed: strict
1
+ # typed: false
2
2
  Rails.application.routes.draw do
3
3
  get 'test/index' => 'test#index'
4
4
  # For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html
@@ -0,0 +1,9 @@
1
+ # typed: false
2
+ class AddSerializedToWizards < ActiveRecord::Migration[5.1]
3
+ def change
4
+ add_column :wizards, :owl_results, :text # Hash
5
+ add_column :wizards, :newt_subjects, :text # generic
6
+ add_column :wizards, :pets, :text # Array
7
+ add_column :wizards, :patronus_characteristics, :text # serialized as JSON, but not a JSON column type
8
+ end
9
+ end
@@ -11,7 +11,7 @@
11
11
  #
12
12
  # It's strongly recommended that you check this file into your version control system.
13
13
 
14
- ActiveRecord::Schema.define(version: 20190620000014) do
14
+ ActiveRecord::Schema.define(version: 20190620000015) do
15
15
 
16
16
  create_table "headmasters", force: :cascade do |t|
17
17
  t.integer "school_id"
@@ -87,6 +87,10 @@ ActiveRecord::Schema.define(version: 20190620000014) do
87
87
  t.integer "hair_length"
88
88
  t.string "type", default: "Wizard", null: false
89
89
  t.integer "school_id"
90
+ t.text "owl_results"
91
+ t.text "newt_subjects"
92
+ t.text "pets"
93
+ t.text "patronus_characteristics"
90
94
  end
91
95
 
92
96
  end
@@ -305,6 +305,21 @@ T.assert_type!(Wizard::House::Hufflepuff, Wizard::House)
305
305
  T.assert_type!(Wizard::House::Ravenclaw, Wizard::House)
306
306
  T.assert_type!(Wizard::House::Slytherin, Wizard::House)
307
307
 
308
+ # Serialization
309
+ T.assert_type!(
310
+ wizard.owl_results,
311
+ T.nilable(T::Hash[T.untyped, T.untyped])
312
+ )
313
+ T.assert_type!(
314
+ wizard.newt_subjects,
315
+ T.nilable(T.any(T::Array[T.untyped], T::Boolean, Float, T::Hash[T.untyped, T.untyped], Integer, String))
316
+ )
317
+ T.assert_type!(
318
+ wizard.patronus_characteristics,
319
+ T.nilable(T.any(T::Array[T.untyped], T::Boolean, Float, T::Hash[String, T.untyped], Integer, String))
320
+ )
321
+ T.assert_type!(wizard.pets, T.nilable(T::Array[T.untyped]))
322
+
308
323
  # Mythical plugin
309
324
  T.assert_type!(Wand.mythicals, T::Array[Wand])
310
325
 
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ../../..
3
3
  specs:
4
- sorbet-rails (0.7.2)
4
+ sorbet-rails (0.7.3)
5
5
  method_source (>= 0.9.2)
6
6
  parlour (>= 4.0.1)
7
7
  parser (>= 2.7)
@@ -84,12 +84,12 @@ GEM
84
84
  nio4r (2.5.2)
85
85
  nokogiri (1.10.9)
86
86
  mini_portile2 (~> 2.4.0)
87
- parlour (4.0.1)
87
+ parlour (5.0.0)
88
88
  commander (~> 4.5)
89
89
  parser
90
90
  rainbow (~> 3.0)
91
91
  sorbet-runtime (>= 0.5)
92
- parser (2.7.2.0)
92
+ parser (3.0.0.0)
93
93
  ast (~> 2.4.1)
94
94
  polyfill (1.9.0)
95
95
  puma (3.12.6)
@@ -125,7 +125,7 @@ GEM
125
125
  safe_type (1.1.1)
126
126
  sorbet (0.5.5480)
127
127
  sorbet-static (= 0.5.5480)
128
- sorbet-coerce (0.2.7)
128
+ sorbet-coerce (0.3.0)
129
129
  polyfill (~> 1.8)
130
130
  safe_type (~> 1.1, >= 1.1.1)
131
131
  sorbet (>= 0.4.4704)
@@ -1,4 +1,4 @@
1
- # typed: strong
1
+ # typed: strict
2
2
  class Headmaster < ApplicationRecord
3
3
  belongs_to :school, required: false
4
4
  belongs_to :wizard, optional: true
@@ -1,4 +1,4 @@
1
- # typed: strong
1
+ # typed: strict
2
2
  class School < ApplicationRecord
3
3
  has_one :headmaster
4
4
  validates :headmaster, presence: true
@@ -47,6 +47,11 @@ class Wizard < ApplicationRecord
47
47
  blue: 2,
48
48
  }, _prefix: :color, _suffix: :eyes
49
49
 
50
+ serialize :owl_results, Hash
51
+ serialize :newt_subjects # no specific data type, uses the default YAML Object coder
52
+ serialize :pets, Array
53
+ serialize :patronus_characteristics, JSON
54
+
50
55
  has_one :wand
51
56
  has_many :spell_books
52
57
  # habtm which is optional at the db level
@@ -1,4 +1,4 @@
1
- # typed: strict
1
+ # typed: false
2
2
  Rails.application.configure do
3
3
  # Settings specified here will take precedence over those in config/application.rb.
4
4
 
@@ -1,4 +1,4 @@
1
- # typed: strict
1
+ # typed: false
2
2
  Rails.application.configure do
3
3
  # Settings specified here will take precedence over those in config/application.rb.
4
4
 
@@ -1,4 +1,4 @@
1
- # typed: strict
1
+ # typed: false
2
2
  Rails.application.configure do
3
3
  # Settings specified here will take precedence over those in config/application.rb.
4
4
 
@@ -1,4 +1,4 @@
1
- # typed: strict
1
+ # typed: false
2
2
  # Be sure to restart your server when you modify this file.
3
3
 
4
4
  # This file contains settings for ActionController::ParamsWrapper which
@@ -1,4 +1,4 @@
1
- # typed: strict
1
+ # typed: false
2
2
  Rails.application.routes.draw do
3
3
  get 'test/index' => 'test#index'
4
4
  # For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html
@@ -0,0 +1,9 @@
1
+ # typed: true
2
+ class AddSerializedToWizards < ActiveRecord::Migration[5.2]
3
+ def change
4
+ add_column :wizards, :owl_results, :text # Hash
5
+ add_column :wizards, :newt_subjects, :text # generic
6
+ add_column :wizards, :pets, :text # Array
7
+ add_column :wizards, :patronus_characteristics, :text # serialized as JSON, but not a JSON column type
8
+ end
9
+ end