titleist 0.1.1 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/tests.yml +19 -0
- data/.gitignore +1 -2
- data/.rubocop.yml +26 -1
- data/.ruby-version +1 -1
- data/Gemfile +13 -2
- data/README.md +95 -25
- data/Rakefile +17 -6
- data/docs/index.md +7 -0
- data/lib/generators/titleist/titleist_generator.rb +3 -0
- data/lib/titleist.rb +14 -9
- data/lib/titleist/controller.rb +36 -0
- data/lib/titleist/engine.rb +10 -4
- data/lib/titleist/helper.rb +23 -0
- data/lib/titleist/title.rb +52 -89
- data/lib/titleist/version.rb +5 -1
- data/rbi/sord.rbi +117 -0
- data/sorbet/config +2 -0
- data/sorbet/rbi/gems/actioncable.rbi +318 -0
- data/sorbet/rbi/gems/actionmailbox.rbi +56 -0
- data/sorbet/rbi/gems/actionmailer.rbi +446 -0
- data/sorbet/rbi/gems/actionpack.rbi +3411 -0
- data/sorbet/rbi/gems/actiontext.rbi +79 -0
- data/sorbet/rbi/gems/actionview.rbi +1185 -0
- data/sorbet/rbi/gems/activejob.rbi +362 -0
- data/sorbet/rbi/gems/activemodel.rbi +749 -0
- data/sorbet/rbi/gems/activerecord.rbi +5713 -0
- data/sorbet/rbi/gems/activestorage.rbi +221 -0
- data/sorbet/rbi/gems/activesupport.rbi +2437 -0
- data/sorbet/rbi/gems/addressable.rbi +146 -0
- data/sorbet/rbi/gems/ast.rbi +47 -0
- data/sorbet/rbi/gems/capybara.rbi +1787 -0
- data/sorbet/rbi/gems/childprocess.rbi +106 -0
- data/sorbet/rbi/gems/codeclimate-test-reporter.rbi +125 -0
- data/sorbet/rbi/gems/concurrent-ruby.rbi +1587 -0
- data/sorbet/rbi/gems/crass.rbi +92 -0
- data/sorbet/rbi/gems/docile.rbi +29 -0
- data/sorbet/rbi/gems/erubi.rbi +26 -0
- data/sorbet/rbi/gems/globalid.rbi +98 -0
- data/sorbet/rbi/gems/i18n.rbi +191 -0
- data/sorbet/rbi/gems/jaro_winkler.rbi +14 -0
- data/sorbet/rbi/gems/loofah.rbi +129 -0
- data/sorbet/rbi/gems/mail.rbi +1582 -0
- data/sorbet/rbi/gems/marcel.rbi +12 -0
- data/sorbet/rbi/gems/method_source.rbi +63 -0
- data/sorbet/rbi/gems/mini_mime.rbi +51 -0
- data/sorbet/rbi/gems/minitest.rbi +419 -0
- data/sorbet/rbi/gems/mocha.rbi +794 -0
- data/sorbet/rbi/gems/nio4r.rbi +67 -0
- data/sorbet/rbi/gems/nokogiri.rbi +1010 -0
- data/sorbet/rbi/gems/parallel.rbi +81 -0
- data/sorbet/rbi/gems/parser.rbi +920 -0
- data/sorbet/rbi/gems/public_suffix.rbi +103 -0
- data/sorbet/rbi/gems/puma.rbi +586 -0
- data/sorbet/rbi/gems/rack-test.rbi +161 -0
- data/sorbet/rbi/gems/rack.rbi +634 -0
- data/sorbet/rbi/gems/rails-dom-testing.rbi +67 -0
- data/sorbet/rbi/gems/rails-html-sanitizer.rbi +91 -0
- data/sorbet/rbi/gems/railties.rbi +834 -0
- data/sorbet/rbi/gems/rainbow.rbi +117 -0
- data/sorbet/rbi/gems/rake.rbi +269 -0
- data/sorbet/rbi/gems/regexp_parser.rbi +912 -0
- data/sorbet/rbi/gems/rubocop.rbi +7232 -0
- data/sorbet/rbi/gems/ruby-progressbar.rbi +304 -0
- data/sorbet/rbi/gems/rubyzip.rbi +546 -0
- data/sorbet/rbi/gems/selenium-webdriver.rbi +1450 -0
- data/sorbet/rbi/gems/simplecov-html.rbi +30 -0
- data/sorbet/rbi/gems/simplecov.rbi +189 -0
- data/sorbet/rbi/gems/site_ruby.rbi +265 -0
- data/sorbet/rbi/gems/sprockets-rails.rbi +105 -0
- data/sorbet/rbi/gems/sprockets.rbi +753 -0
- data/sorbet/rbi/gems/sqlite3.rbi +353 -0
- data/sorbet/rbi/gems/thor.rbi +579 -0
- data/sorbet/rbi/gems/thread_safe.rbi +81 -0
- data/sorbet/rbi/gems/tzinfo.rbi +405 -0
- data/sorbet/rbi/gems/unicode-display_width.rbi +16 -0
- data/sorbet/rbi/gems/webdrivers.rbi +155 -0
- data/sorbet/rbi/gems/xpath.rbi +158 -0
- data/sorbet/rbi/gems/yard.rbi +1159 -0
- data/sorbet/rbi/hidden-definitions/errors.txt +14957 -0
- data/sorbet/rbi/hidden-definitions/hidden.rbi +24898 -0
- data/sorbet/rbi/sorbet-typed/lib/actionmailer/all/actionmailer.rbi +13 -0
- data/sorbet/rbi/sorbet-typed/lib/actionpack/all/actionpack.rbi +938 -0
- data/sorbet/rbi/sorbet-typed/lib/actionview/all/actionview.rbi +314 -0
- data/sorbet/rbi/sorbet-typed/lib/activemodel/all/activemodel.rbi +425 -0
- data/sorbet/rbi/sorbet-typed/lib/activerecord/>=5.2/activerecord.rbi +17 -0
- data/sorbet/rbi/sorbet-typed/lib/activerecord/all/activerecord.rbi +1425 -0
- data/sorbet/rbi/sorbet-typed/lib/activerecord/~>6.0.0/activerecord.rbi +475 -0
- data/sorbet/rbi/sorbet-typed/lib/activestorage/>=6.0.0/activestorage.rbi +19 -0
- data/sorbet/rbi/sorbet-typed/lib/activestorage/all/activestorage.rbi +173 -0
- data/sorbet/rbi/sorbet-typed/lib/activesupport/>=6.0.0.rc1/activesupport.rbi +23 -0
- data/sorbet/rbi/sorbet-typed/lib/activesupport/all/activesupport.rbi +858 -0
- data/sorbet/rbi/sorbet-typed/lib/bundler/all/bundler.rbi +8684 -0
- data/sorbet/rbi/sorbet-typed/lib/minitest/all/minitest.rbi +108 -0
- data/sorbet/rbi/sorbet-typed/lib/railties/all/railties.rbi +25 -0
- data/sorbet/rbi/sorbet-typed/lib/rainbow/all/rainbow.rbi +254 -0
- data/sorbet/rbi/sorbet-typed/lib/ruby/all/gem.rbi +4222 -0
- data/sorbet/rbi/sorbet-typed/lib/ruby/all/open3.rbi +111 -0
- data/sorbet/rbi/sorbet-typed/lib/ruby/all/resolv.rbi +543 -0
- data/sorbet/rbi/todo.rbi +20 -0
- data/titleist.gemspec +3 -14
- metadata +96 -155
- data/.travis.yml +0 -45
- data/app/controllers/.keep +0 -0
- data/app/helpers/.keep +0 -0
- data/app/helpers/titleist_helper.rb +0 -47
- data/app/mailers/.keep +0 -0
- data/app/models/.keep +0 -0
- data/app/views/.keep +0 -0
@@ -0,0 +1,17 @@
|
|
1
|
+
# This file is autogenerated. Do not edit it by hand. Regenerate it with:
|
2
|
+
# srb rbi sorbet-typed
|
3
|
+
#
|
4
|
+
# If you would like to make changes to this file, great! Please upstream any changes you make here:
|
5
|
+
#
|
6
|
+
# https://github.com/sorbet/sorbet-typed/edit/master/lib/activerecord/>=5.2/activerecord.rbi
|
7
|
+
#
|
8
|
+
# typed: strong
|
9
|
+
|
10
|
+
class ActiveRecord::Base
|
11
|
+
extend ActiveRecord::Delegation::DelegateCache
|
12
|
+
extend ActiveRecord::CollectionCacheKey
|
13
|
+
include ActiveRecord::DefineCallbacks
|
14
|
+
include ActiveRecord::TouchLater
|
15
|
+
include ActiveRecord::SecureToken
|
16
|
+
include ActiveRecord::Suppressor
|
17
|
+
end
|
@@ -0,0 +1,1425 @@
|
|
1
|
+
# This file is autogenerated. Do not edit it by hand. Regenerate it with:
|
2
|
+
# srb rbi sorbet-typed
|
3
|
+
#
|
4
|
+
# If you would like to make changes to this file, great! Please upstream any changes you make here:
|
5
|
+
#
|
6
|
+
# https://github.com/sorbet/sorbet-typed/edit/master/lib/activerecord/all/activerecord.rbi
|
7
|
+
#
|
8
|
+
# typed: false
|
9
|
+
|
10
|
+
VariadicUntypedFunction = T.type_alias { Proc }
|
11
|
+
AssociationCallback = T.type_alias do
|
12
|
+
# docs in https://api.rubyonrails.org/classes/ActiveRecord/Associations/ClassMethods.html - jump to "Association callbacks"
|
13
|
+
T.nilable(
|
14
|
+
T.any(
|
15
|
+
Symbol, # reference to a method
|
16
|
+
String, # reference to a method? not clear: no string examples in docs
|
17
|
+
T.proc.void, # a lambda that contains the callback
|
18
|
+
Proc, # a proc that contains the callback
|
19
|
+
T::Array[T.any(Symbol, Proc, T.proc.void)] # multiple callbacks
|
20
|
+
)
|
21
|
+
)
|
22
|
+
end
|
23
|
+
|
24
|
+
module ActiveRecord::Associations::ClassMethods
|
25
|
+
sig do
|
26
|
+
params(
|
27
|
+
name: Symbol,
|
28
|
+
scope: T.nilable(T.proc.void),
|
29
|
+
after_add: AssociationCallback,
|
30
|
+
after_remove: AssociationCallback,
|
31
|
+
anonymous_class: T.nilable(T.any(Symbol, String)),
|
32
|
+
as: T.nilable(T.any(Symbol, String)),
|
33
|
+
autosave: T.nilable(T::Boolean),
|
34
|
+
before_add: AssociationCallback,
|
35
|
+
before_remove: AssociationCallback,
|
36
|
+
class_name: T.nilable(T.any(Symbol, String)),
|
37
|
+
counter_cache: T.nilable(T.any(Symbol, String)),
|
38
|
+
dependent: T.nilable(T.any(Symbol, String)),
|
39
|
+
extend: T.nilable(T.any(Module, T::Array[Module])),
|
40
|
+
foreign_key: T.nilable(T.any(Symbol, String)),
|
41
|
+
foreign_type: T.nilable(T.any(Symbol, String)),
|
42
|
+
index_errors: T.nilable(T::Boolean),
|
43
|
+
inverse_of: T.nilable(T.any(Symbol, String)),
|
44
|
+
join_table: T.nilable(T.any(Symbol, String)),
|
45
|
+
primary_key: T.nilable(T.any(Symbol, String)),
|
46
|
+
source: T.nilable(T.any(Symbol, String)),
|
47
|
+
source_type: T.nilable(T.any(Symbol, String)),
|
48
|
+
table_name: T.nilable(T.any(Symbol, String)),
|
49
|
+
through: T.nilable(T.any(Symbol, String)),
|
50
|
+
validate: T.nilable(T::Boolean),
|
51
|
+
blk: T.nilable(T.proc.void)
|
52
|
+
).void
|
53
|
+
end
|
54
|
+
def has_many(
|
55
|
+
name,
|
56
|
+
scope = nil,
|
57
|
+
after_add: nil,
|
58
|
+
after_remove: nil,
|
59
|
+
anonymous_class: nil,
|
60
|
+
as: nil,
|
61
|
+
autosave: nil,
|
62
|
+
before_add: nil,
|
63
|
+
before_remove: nil,
|
64
|
+
class_name: nil,
|
65
|
+
counter_cache: nil,
|
66
|
+
dependent: nil,
|
67
|
+
extend: nil,
|
68
|
+
foreign_key: nil,
|
69
|
+
foreign_type: nil,
|
70
|
+
index_errors: nil,
|
71
|
+
inverse_of: nil,
|
72
|
+
join_table: nil,
|
73
|
+
primary_key: nil,
|
74
|
+
source: nil,
|
75
|
+
source_type: nil,
|
76
|
+
table_name: nil,
|
77
|
+
through: nil,
|
78
|
+
validate: nil,
|
79
|
+
&blk
|
80
|
+
); end
|
81
|
+
|
82
|
+
sig do
|
83
|
+
params(
|
84
|
+
name: Symbol,
|
85
|
+
scope: T.nilable(T.proc.void),
|
86
|
+
anonymous_class: T.nilable(T.any(Symbol, String)),
|
87
|
+
as: T.nilable(T.any(Symbol, String)),
|
88
|
+
autosave: T.nilable(T::Boolean),
|
89
|
+
class_name: T.nilable(T.any(Symbol, String)),
|
90
|
+
dependent: T.nilable(T.any(Symbol, String)),
|
91
|
+
foreign_key: T.nilable(T.any(Symbol, String)),
|
92
|
+
foreign_type: T.nilable(T.any(Symbol, String)),
|
93
|
+
inverse_of: T.nilable(T.any(Symbol, String)),
|
94
|
+
primary_key: T.nilable(T.any(Symbol, String)),
|
95
|
+
required: T.nilable(T::Boolean),
|
96
|
+
source: T.nilable(T.any(Symbol, String)),
|
97
|
+
source_type: T.nilable(T.any(Symbol, String)),
|
98
|
+
through: T.nilable(T.any(Symbol, String)),
|
99
|
+
validate: T.nilable(T::Boolean),
|
100
|
+
blk: T.nilable(T.proc.void)
|
101
|
+
).void
|
102
|
+
end
|
103
|
+
def has_one(
|
104
|
+
name,
|
105
|
+
scope = nil,
|
106
|
+
anonymous_class: nil,
|
107
|
+
as: nil,
|
108
|
+
autosave: nil,
|
109
|
+
class_name: nil,
|
110
|
+
dependent: nil,
|
111
|
+
foreign_key: nil,
|
112
|
+
foreign_type: nil,
|
113
|
+
inverse_of: nil,
|
114
|
+
primary_key: nil,
|
115
|
+
required: nil,
|
116
|
+
source: nil,
|
117
|
+
source_type: nil,
|
118
|
+
through: nil,
|
119
|
+
validate: nil,
|
120
|
+
&blk
|
121
|
+
); end
|
122
|
+
|
123
|
+
sig do
|
124
|
+
params(
|
125
|
+
name: T.nilable(T.any(Symbol, String)),
|
126
|
+
scope: T.nilable(T.proc.void),
|
127
|
+
autosave: T.nilable(T::Boolean),
|
128
|
+
class_name: T.nilable(T.any(Symbol, String)),
|
129
|
+
counter_cache: T.nilable(T::Boolean),
|
130
|
+
dependent: T.nilable(T.any(Symbol, String)),
|
131
|
+
foreign_key: T.nilable(T.any(Symbol, String)),
|
132
|
+
foreign_type: T.nilable(T.any(Symbol, String)),
|
133
|
+
inverse_of: T.nilable(T.any(Symbol, String)),
|
134
|
+
optional: T.nilable(T::Boolean),
|
135
|
+
polymorphic: T.nilable(T::Boolean),
|
136
|
+
primary_key: T.nilable(T.any(Symbol, String)),
|
137
|
+
required: T.nilable(T::Boolean),
|
138
|
+
touch: T.nilable(T.any(T::Boolean, Symbol)),
|
139
|
+
validate: T.nilable(T::Boolean),
|
140
|
+
default: T.nilable(T.proc.returns(T.untyped))
|
141
|
+
).void
|
142
|
+
end
|
143
|
+
def belongs_to(
|
144
|
+
name,
|
145
|
+
scope = nil,
|
146
|
+
autosave: nil,
|
147
|
+
class_name: nil,
|
148
|
+
counter_cache: nil,
|
149
|
+
dependent: nil,
|
150
|
+
foreign_key: nil,
|
151
|
+
foreign_type: nil,
|
152
|
+
inverse_of: nil,
|
153
|
+
optional: nil,
|
154
|
+
polymorphic: nil,
|
155
|
+
primary_key: nil,
|
156
|
+
required: nil,
|
157
|
+
touch: nil,
|
158
|
+
validate: nil,
|
159
|
+
default: nil
|
160
|
+
); end
|
161
|
+
|
162
|
+
sig do
|
163
|
+
params(
|
164
|
+
name: T.nilable(T.any(Symbol, String)),
|
165
|
+
scope: T.nilable(T.proc.void),
|
166
|
+
after_add: AssociationCallback,
|
167
|
+
after_remove: AssociationCallback,
|
168
|
+
association_foreign_key: T.nilable(T.any(Symbol, String)),
|
169
|
+
autosave: T.nilable(T::Boolean),
|
170
|
+
before_add: AssociationCallback,
|
171
|
+
before_remove: AssociationCallback,
|
172
|
+
class_name: T.nilable(T.any(Symbol, String)),
|
173
|
+
extend: T.nilable(T.any(Module, T::Array[Module])),
|
174
|
+
foreign_key: T.nilable(T.any(Symbol, String)),
|
175
|
+
join_table: T.nilable(T.any(Symbol, String)),
|
176
|
+
validate: T.nilable(T::Boolean),
|
177
|
+
blk: T.nilable(T.proc.void)
|
178
|
+
).void
|
179
|
+
end
|
180
|
+
def has_and_belongs_to_many(
|
181
|
+
name,
|
182
|
+
scope = nil,
|
183
|
+
after_add: nil,
|
184
|
+
after_remove: nil,
|
185
|
+
association_foreign_key: nil,
|
186
|
+
autosave: nil,
|
187
|
+
before_add: nil,
|
188
|
+
before_remove: nil,
|
189
|
+
class_name: nil,
|
190
|
+
extend: nil,
|
191
|
+
foreign_key: nil,
|
192
|
+
join_table: nil,
|
193
|
+
validate: nil,
|
194
|
+
&blk
|
195
|
+
); end
|
196
|
+
end
|
197
|
+
|
198
|
+
module ActiveRecord::AttributeMethods
|
199
|
+
include ActiveModel::AttributeMethods
|
200
|
+
end
|
201
|
+
|
202
|
+
module ActiveRecord::AttributeMethods::Serialization::ClassMethods
|
203
|
+
sig { params(attr_name: Symbol, class_name_or_coder: T.untyped).void }
|
204
|
+
def serialize(attr_name, class_name_or_coder = Object); end
|
205
|
+
end
|
206
|
+
|
207
|
+
module ActiveRecord::NestedAttributes::ClassMethods
|
208
|
+
sig do
|
209
|
+
params(
|
210
|
+
attr_names: T.any(T.any(Symbol, String), T::Array[T.any(Symbol, String)]),
|
211
|
+
allow_destroy: T.nilable(T::Boolean),
|
212
|
+
reject_if: T.any(Symbol, T.proc.returns(T::Boolean)),
|
213
|
+
limit: T.any(Integer, Symbol, T.proc.returns(Integer)),
|
214
|
+
update_only: T.nilable(T::Boolean),
|
215
|
+
).void
|
216
|
+
end
|
217
|
+
def accepts_nested_attributes_for(
|
218
|
+
attr_names,
|
219
|
+
allow_destroy: nil,
|
220
|
+
reject_if: nil,
|
221
|
+
limit: nil,
|
222
|
+
update_only: nil
|
223
|
+
); end
|
224
|
+
end
|
225
|
+
|
226
|
+
module ActiveRecord::Scoping::Named::ClassMethods
|
227
|
+
sig do
|
228
|
+
params(
|
229
|
+
name: T.nilable(T.any(Symbol, String)),
|
230
|
+
body: VariadicUntypedFunction,
|
231
|
+
blk: T.nilable(VariadicUntypedFunction)
|
232
|
+
).void
|
233
|
+
end
|
234
|
+
def scope(
|
235
|
+
name,
|
236
|
+
body,
|
237
|
+
&blk
|
238
|
+
); end
|
239
|
+
end
|
240
|
+
|
241
|
+
module ActiveRecord::Scoping::Default::ClassMethods
|
242
|
+
end
|
243
|
+
|
244
|
+
module ActiveRecord::Inheritance
|
245
|
+
mixes_in_class_methods(ActiveRecord::Inheritance::ClassMethods)
|
246
|
+
end
|
247
|
+
|
248
|
+
class ActiveRecord::Base
|
249
|
+
extend ActiveModel::Naming
|
250
|
+
|
251
|
+
extend ActiveSupport::Benchmarkable
|
252
|
+
extend ActiveSupport::DescendantsTracker
|
253
|
+
|
254
|
+
extend ActiveRecord::ConnectionHandling
|
255
|
+
extend ActiveRecord::QueryCache::ClassMethods
|
256
|
+
extend ActiveRecord::Querying
|
257
|
+
extend ActiveRecord::Translation
|
258
|
+
extend ActiveRecord::DynamicMatchers
|
259
|
+
extend ActiveRecord::Explain
|
260
|
+
extend ActiveRecord::Enum
|
261
|
+
|
262
|
+
include ActiveRecord::Core
|
263
|
+
include ActiveRecord::Persistence
|
264
|
+
include ActiveRecord::ReadonlyAttributes
|
265
|
+
include ActiveRecord::ModelSchema
|
266
|
+
include ActiveRecord::Inheritance
|
267
|
+
include ActiveRecord::Scoping
|
268
|
+
include ActiveRecord::Scoping::Default # via ActiveRecord::Scoping#included hook
|
269
|
+
extend ActiveRecord::Scoping::Default::ClassMethods # via ActiveRecord::Scoping::Default Concern inclusion
|
270
|
+
include ActiveRecord::Scoping::Named # via ActiveRecord::Scoping#included hook
|
271
|
+
extend ActiveRecord::Scoping::Named::ClassMethods # via ActiveRecord::Scoping::Named Concern inclusion
|
272
|
+
include ActiveRecord::Sanitization
|
273
|
+
include ActiveRecord::AttributeAssignment
|
274
|
+
include ActiveModel::Conversion
|
275
|
+
include ActiveRecord::Integration
|
276
|
+
include ActiveRecord::Validations
|
277
|
+
include ActiveRecord::CounterCache
|
278
|
+
include ActiveRecord::Attributes
|
279
|
+
include ActiveRecord::AttributeDecorators
|
280
|
+
include ActiveRecord::Locking::Optimistic
|
281
|
+
include ActiveRecord::Locking::Pessimistic
|
282
|
+
include ActiveRecord::AttributeMethods
|
283
|
+
include ActiveRecord::AttributeMethods::Read # via ActiveRecord::AttributeMethods#included hook
|
284
|
+
include ActiveRecord::AttributeMethods::Write # via ActiveRecord::AttributeMethods#included hook
|
285
|
+
include ActiveRecord::AttributeMethods::BeforeTypeCast # via ActiveRecord::AttributeMethods#included hook
|
286
|
+
include ActiveRecord::AttributeMethods::Query # via ActiveRecord::AttributeMethods#included hook
|
287
|
+
include ActiveRecord::AttributeMethods::PrimaryKey # via ActiveRecord::AttributeMethods#included hook
|
288
|
+
include ActiveRecord::AttributeMethods::TimeZoneConversion # via ActiveRecord::AttributeMethods#included hook
|
289
|
+
include ActiveRecord::AttributeMethods::Dirty # via ActiveRecord::AttributeMethods#included hook
|
290
|
+
include ActiveRecord::AttributeMethods::Serialization # via ActiveRecord::AttributeMethods#included hook
|
291
|
+
extend ActiveRecord::AttributeMethods::Serialization::ClassMethods # via ActiveRecord::AttributeMethods::Serialization Concern inclusion
|
292
|
+
include ActiveRecord::Callbacks
|
293
|
+
include ActiveRecord::Timestamp
|
294
|
+
include ActiveRecord::Associations
|
295
|
+
include ActiveModel::SecurePassword
|
296
|
+
include ActiveRecord::AutosaveAssociation
|
297
|
+
include ActiveRecord::NestedAttributes
|
298
|
+
extend ActiveRecord::NestedAttributes::ClassMethods # via ActiveRecord::NestedAttributes Concern inclusion
|
299
|
+
include ActiveRecord::Aggregations
|
300
|
+
include ActiveRecord::Transactions
|
301
|
+
include ActiveRecord::NoTouching
|
302
|
+
include ActiveRecord::Reflection
|
303
|
+
include ActiveRecord::Serialization
|
304
|
+
include ActiveRecord::Store
|
305
|
+
|
306
|
+
sig do
|
307
|
+
params(
|
308
|
+
arg: Symbol,
|
309
|
+
if: T.nilable(T.any(Symbol, Proc, T.proc.params(arg0: T.untyped).returns(T.nilable(T::Boolean)))),
|
310
|
+
on: T.nilable(T.any(Symbol, T::Array[Symbol])),
|
311
|
+
unless: T.nilable(T.any(Symbol, Proc, T.proc.params(arg0: T.untyped).returns(T.nilable(T::Boolean))))
|
312
|
+
).void
|
313
|
+
end
|
314
|
+
def self.after_commit(
|
315
|
+
arg,
|
316
|
+
if: nil,
|
317
|
+
on: nil,
|
318
|
+
unless: nil
|
319
|
+
); end
|
320
|
+
|
321
|
+
sig do
|
322
|
+
params(
|
323
|
+
arg: T.nilable(Symbol),
|
324
|
+
if: T.nilable(T.any(Symbol, Proc, T.proc.params(arg0: T.untyped).returns(T.nilable(T::Boolean)))),
|
325
|
+
unless: T.nilable(T.any(Symbol, Proc, T.proc.params(arg0: T.untyped).returns(T.nilable(T::Boolean))))
|
326
|
+
).void
|
327
|
+
end
|
328
|
+
def self.after_create(
|
329
|
+
arg = nil,
|
330
|
+
if: nil,
|
331
|
+
unless: nil
|
332
|
+
); end
|
333
|
+
|
334
|
+
sig do
|
335
|
+
params(
|
336
|
+
arg: T.nilable(Symbol),
|
337
|
+
if: T.nilable(T.any(Symbol, Proc, T.proc.params(arg0: T.untyped).returns(T.nilable(T::Boolean)))),
|
338
|
+
unless: T.nilable(T.any(Symbol, Proc, T.proc.params(arg0: T.untyped).returns(T.nilable(T::Boolean))))
|
339
|
+
).void
|
340
|
+
end
|
341
|
+
def self.after_destroy(
|
342
|
+
arg = nil,
|
343
|
+
if: nil,
|
344
|
+
unless: nil
|
345
|
+
); end
|
346
|
+
|
347
|
+
sig do
|
348
|
+
params(
|
349
|
+
arg: T.nilable(Symbol),
|
350
|
+
if: T.nilable(T.any(Symbol, Proc, T.proc.params(arg0: T.untyped).returns(T.nilable(T::Boolean)))),
|
351
|
+
unless: T.nilable(T.any(Symbol, Proc, T.proc.params(arg0: T.untyped).returns(T.nilable(T::Boolean))))
|
352
|
+
).void
|
353
|
+
end
|
354
|
+
def self.after_rollback(
|
355
|
+
arg = nil,
|
356
|
+
if: nil,
|
357
|
+
unless: nil
|
358
|
+
); end
|
359
|
+
|
360
|
+
sig do
|
361
|
+
params(
|
362
|
+
arg: T.nilable(Symbol),
|
363
|
+
if: T.nilable(T.any(Symbol, Proc, T.proc.params(arg0: T.untyped).returns(T.nilable(T::Boolean)))),
|
364
|
+
unless: T.nilable(T.any(Symbol, Proc, T.proc.params(arg0: T.untyped).returns(T.nilable(T::Boolean))))
|
365
|
+
).void
|
366
|
+
end
|
367
|
+
def self.after_save(
|
368
|
+
arg = nil,
|
369
|
+
if: nil,
|
370
|
+
unless: nil
|
371
|
+
); end
|
372
|
+
|
373
|
+
sig do
|
374
|
+
params(
|
375
|
+
arg: T.nilable(Symbol),
|
376
|
+
if: T.nilable(T.any(Symbol, Proc, T.proc.params(arg0: T.untyped).returns(T.nilable(T::Boolean)))),
|
377
|
+
unless: T.nilable(T.any(Symbol, Proc, T.proc.params(arg0: T.untyped).returns(T.nilable(T::Boolean))))
|
378
|
+
).void
|
379
|
+
end
|
380
|
+
def self.after_update(
|
381
|
+
arg = nil,
|
382
|
+
if: nil,
|
383
|
+
unless: nil
|
384
|
+
); end
|
385
|
+
|
386
|
+
sig do
|
387
|
+
params(
|
388
|
+
arg: T.nilable(Symbol),
|
389
|
+
if: T.nilable(T.any(Symbol, Proc, T.proc.params(arg0: T.untyped).returns(T.nilable(T::Boolean)))),
|
390
|
+
unless: T.nilable(T.any(Symbol, Proc, T.proc.params(arg0: T.untyped).returns(T.nilable(T::Boolean)))),
|
391
|
+
on: T.nilable(T.any(Symbol, T::Array[Symbol]))
|
392
|
+
).void
|
393
|
+
end
|
394
|
+
def self.after_validation(
|
395
|
+
arg = nil,
|
396
|
+
if: nil,
|
397
|
+
unless: nil,
|
398
|
+
on: nil
|
399
|
+
); end
|
400
|
+
|
401
|
+
sig do
|
402
|
+
params(
|
403
|
+
arg: T.nilable(Symbol),
|
404
|
+
if: T.nilable(T.any(Symbol, Proc, T.proc.params(arg0: T.untyped).returns(T.nilable(T::Boolean)))),
|
405
|
+
unless: T.nilable(T.any(Symbol, Proc, T.proc.params(arg0: T.untyped).returns(T.nilable(T::Boolean))))
|
406
|
+
).void
|
407
|
+
end
|
408
|
+
def self.around_create(
|
409
|
+
arg = nil,
|
410
|
+
if: nil,
|
411
|
+
unless: nil
|
412
|
+
); end
|
413
|
+
|
414
|
+
sig do
|
415
|
+
params(
|
416
|
+
arg: T.nilable(Symbol),
|
417
|
+
if: T.nilable(T.any(Symbol, Proc, T.proc.params(arg0: T.untyped).returns(T.nilable(T::Boolean)))),
|
418
|
+
unless: T.nilable(T.any(Symbol, Proc, T.proc.params(arg0: T.untyped).returns(T.nilable(T::Boolean))))
|
419
|
+
).void
|
420
|
+
end
|
421
|
+
def self.around_destroy(
|
422
|
+
arg = nil,
|
423
|
+
if: nil,
|
424
|
+
unless: nil
|
425
|
+
); end
|
426
|
+
|
427
|
+
sig do
|
428
|
+
params(
|
429
|
+
arg: T.nilable(Symbol),
|
430
|
+
if: T.nilable(T.any(Symbol, Proc, T.proc.params(arg0: T.untyped).returns(T.nilable(T::Boolean)))),
|
431
|
+
unless: T.nilable(T.any(Symbol, Proc, T.proc.params(arg0: T.untyped).returns(T.nilable(T::Boolean))))
|
432
|
+
).void
|
433
|
+
end
|
434
|
+
def self.around_save(
|
435
|
+
arg = nil,
|
436
|
+
if: nil,
|
437
|
+
unless: nil
|
438
|
+
); end
|
439
|
+
|
440
|
+
sig do
|
441
|
+
params(
|
442
|
+
arg: T.nilable(Symbol),
|
443
|
+
if: T.nilable(T.any(Symbol, Proc, T.proc.params(arg0: T.untyped).returns(T.nilable(T::Boolean)))),
|
444
|
+
unless: T.nilable(T.any(Symbol, Proc, T.proc.params(arg0: T.untyped).returns(T.nilable(T::Boolean))))
|
445
|
+
).void
|
446
|
+
end
|
447
|
+
def self.around_update(
|
448
|
+
arg = nil,
|
449
|
+
if: nil,
|
450
|
+
unless: nil
|
451
|
+
); end
|
452
|
+
|
453
|
+
sig do
|
454
|
+
params(
|
455
|
+
arg: T.nilable(Symbol),
|
456
|
+
if: T.nilable(T.any(Symbol, Proc, T.proc.params(arg0: T.untyped).returns(T.nilable(T::Boolean)))),
|
457
|
+
unless: T.nilable(T.any(Symbol, Proc, T.proc.params(arg0: T.untyped).returns(T.nilable(T::Boolean))))
|
458
|
+
).void
|
459
|
+
end
|
460
|
+
def self.before_create(
|
461
|
+
arg = nil,
|
462
|
+
if: nil,
|
463
|
+
unless: nil
|
464
|
+
); end
|
465
|
+
|
466
|
+
sig do
|
467
|
+
params(
|
468
|
+
arg: T.nilable(Symbol),
|
469
|
+
if: T.nilable(T.any(Symbol, Proc, T.proc.params(arg0: T.untyped).returns(T.nilable(T::Boolean)))),
|
470
|
+
unless: T.nilable(T.any(Symbol, Proc, T.proc.params(arg0: T.untyped).returns(T.nilable(T::Boolean))))
|
471
|
+
).void
|
472
|
+
end
|
473
|
+
def self.before_destroy(
|
474
|
+
arg = nil,
|
475
|
+
if: nil,
|
476
|
+
unless: nil
|
477
|
+
); end
|
478
|
+
|
479
|
+
sig do
|
480
|
+
params(
|
481
|
+
arg: T.nilable(Symbol),
|
482
|
+
if: T.nilable(T.any(Symbol, Proc, T.proc.params(arg0: T.untyped).returns(T.nilable(T::Boolean)))),
|
483
|
+
unless: T.nilable(T.any(Symbol, Proc, T.proc.params(arg0: T.untyped).returns(T.nilable(T::Boolean))))
|
484
|
+
).void
|
485
|
+
end
|
486
|
+
def self.before_save(
|
487
|
+
arg = nil,
|
488
|
+
if: nil,
|
489
|
+
unless: nil
|
490
|
+
); end
|
491
|
+
|
492
|
+
sig do
|
493
|
+
params(
|
494
|
+
arg: T.nilable(Symbol),
|
495
|
+
if: T.nilable(T.any(Symbol, Proc, T.proc.params(arg0: T.untyped).returns(T.nilable(T::Boolean)))),
|
496
|
+
unless: T.nilable(T.any(Symbol, Proc, T.proc.params(arg0: T.untyped).returns(T.nilable(T::Boolean))))
|
497
|
+
).void
|
498
|
+
end
|
499
|
+
def self.before_update(
|
500
|
+
arg = nil,
|
501
|
+
if: nil,
|
502
|
+
unless: nil
|
503
|
+
); end
|
504
|
+
|
505
|
+
sig do
|
506
|
+
params(
|
507
|
+
arg: T.nilable(Symbol),
|
508
|
+
if: T.nilable(T.any(Symbol, Proc, T.proc.params(arg0: T.untyped).returns(T.nilable(T::Boolean)))),
|
509
|
+
unless: T.nilable(T.any(Symbol, Proc, T.proc.params(arg0: T.untyped).returns(T.nilable(T::Boolean)))),
|
510
|
+
on: T.nilable(T.any(Symbol, T::Array[Symbol]))
|
511
|
+
).void
|
512
|
+
end
|
513
|
+
def self.before_validation(
|
514
|
+
arg = nil,
|
515
|
+
if: nil,
|
516
|
+
unless: nil,
|
517
|
+
on: nil
|
518
|
+
); end
|
519
|
+
|
520
|
+
sig { params(comparison_object: T.untyped).returns(T::Boolean) }
|
521
|
+
def ==(comparison_object); end
|
522
|
+
end
|
523
|
+
|
524
|
+
module ActiveRecord::Inheritance::ClassMethods
|
525
|
+
sig { params(value: T::Boolean).void }
|
526
|
+
def abstract_class=(value); end
|
527
|
+
|
528
|
+
sig { returns(T::Boolean) }
|
529
|
+
def abstract_class; end
|
530
|
+
end
|
531
|
+
|
532
|
+
module ActiveRecord::Persistence
|
533
|
+
mixes_in_class_methods(ActiveRecord::Persistence::ClassMethods)
|
534
|
+
|
535
|
+
sig { params(klass: Class).returns(T.untyped) }
|
536
|
+
def becomes!(klass); end
|
537
|
+
|
538
|
+
sig { params(klass: Class).returns(T.untyped) }
|
539
|
+
def becomes(klass); end
|
540
|
+
|
541
|
+
sig do
|
542
|
+
params(
|
543
|
+
attribute: T.any(Symbol, String),
|
544
|
+
by: T.nilable(Integer),
|
545
|
+
touch: T.nilable(T::Boolean)
|
546
|
+
).returns(T.self_type)
|
547
|
+
end
|
548
|
+
def decrement!(attribute, by = 1, touch: nil); end
|
549
|
+
|
550
|
+
sig do
|
551
|
+
params(
|
552
|
+
attribute: T.any(Symbol, String),
|
553
|
+
by: T.nilable(Integer)
|
554
|
+
).returns(T.self_type)
|
555
|
+
end
|
556
|
+
def decrement(attribute, by = 1); end
|
557
|
+
|
558
|
+
sig { returns(T::Boolean) }
|
559
|
+
def destroyed?(); end
|
560
|
+
|
561
|
+
sig do
|
562
|
+
params(
|
563
|
+
attribute: T.any(Symbol, String),
|
564
|
+
by: T.nilable(Integer),
|
565
|
+
touch: T.nilable(T::Boolean)
|
566
|
+
).returns(T.self_type)
|
567
|
+
end
|
568
|
+
def increment!(attribute, by = 1, touch: nil); end
|
569
|
+
|
570
|
+
sig do
|
571
|
+
params(
|
572
|
+
attribute: T.any(Symbol, String),
|
573
|
+
by: T.nilable(Integer)
|
574
|
+
).returns(T.self_type)
|
575
|
+
end
|
576
|
+
def increment(attribute, by = 1); end
|
577
|
+
|
578
|
+
sig { returns(T::Boolean) }
|
579
|
+
def new_record?(); end
|
580
|
+
|
581
|
+
sig { returns(T::Boolean) }
|
582
|
+
def persisted?(); end
|
583
|
+
|
584
|
+
sig do
|
585
|
+
params(
|
586
|
+
options: T.nilable({ lock: T.nilable(T::Boolean) })
|
587
|
+
).returns(T.self_type)
|
588
|
+
end
|
589
|
+
def reload(options = nil); end
|
590
|
+
|
591
|
+
sig do
|
592
|
+
params(
|
593
|
+
args: T.untyped,
|
594
|
+
blk: T.nilable(T.proc.void),
|
595
|
+
).returns(TrueClass)
|
596
|
+
end
|
597
|
+
def save!(*args, &blk); end
|
598
|
+
|
599
|
+
sig do
|
600
|
+
params(
|
601
|
+
args: T.untyped,
|
602
|
+
blk: T.nilable(T.proc.void),
|
603
|
+
).returns(T::Boolean)
|
604
|
+
end
|
605
|
+
def save(*args, &blk); end
|
606
|
+
|
607
|
+
sig { params(attribute: T.any(Symbol, String)).returns(TrueClass) }
|
608
|
+
def toggle!(attribute); end
|
609
|
+
|
610
|
+
sig { params(attribute: T.any(Symbol, String)).returns(T.self_type) }
|
611
|
+
def toggle(attribute); end
|
612
|
+
|
613
|
+
sig do
|
614
|
+
params(
|
615
|
+
names: T.any(
|
616
|
+
Symbol,
|
617
|
+
String,
|
618
|
+
T::Array[T.any(Symbol, String)]
|
619
|
+
),
|
620
|
+
time: T.nilable(Time)
|
621
|
+
).returns(T::Boolean)
|
622
|
+
end
|
623
|
+
def touch(*names, time: nil); end
|
624
|
+
|
625
|
+
sig do
|
626
|
+
params(
|
627
|
+
name: T.any(Symbol, String),
|
628
|
+
value: T.untyped,
|
629
|
+
).returns(T::Boolean)
|
630
|
+
end
|
631
|
+
def update_attribute(name, value); end
|
632
|
+
|
633
|
+
sig do
|
634
|
+
params(
|
635
|
+
name: T.any(Symbol, String),
|
636
|
+
value: T.untyped,
|
637
|
+
).returns(T::Boolean)
|
638
|
+
end
|
639
|
+
def update_column(name, value); end
|
640
|
+
|
641
|
+
sig do
|
642
|
+
params(
|
643
|
+
attributes: T::Hash[T.any(Symbol, String), T.untyped]
|
644
|
+
).returns(T::Boolean)
|
645
|
+
end
|
646
|
+
def update_columns(attributes); end
|
647
|
+
|
648
|
+
sig do
|
649
|
+
params(
|
650
|
+
attributes: T.any(
|
651
|
+
T::Hash[T.any(Symbol, String), T.untyped],
|
652
|
+
ActionController::Parameters
|
653
|
+
)
|
654
|
+
).returns(TrueClass)
|
655
|
+
end
|
656
|
+
def update!(attributes); end
|
657
|
+
|
658
|
+
# update_attributes! is an alias of update!
|
659
|
+
sig do
|
660
|
+
params(
|
661
|
+
attributes: T.any(
|
662
|
+
T::Hash[T.any(Symbol, String), T.untyped],
|
663
|
+
ActionController::Parameters
|
664
|
+
)
|
665
|
+
).returns(TrueClass)
|
666
|
+
end
|
667
|
+
def update_attributes!(attributes); end
|
668
|
+
|
669
|
+
sig do
|
670
|
+
params(
|
671
|
+
attributes: T.any(
|
672
|
+
T::Hash[T.any(Symbol, String), T.untyped],
|
673
|
+
ActionController::Parameters
|
674
|
+
)
|
675
|
+
).returns(T::Boolean)
|
676
|
+
end
|
677
|
+
def update(attributes); end
|
678
|
+
|
679
|
+
# update_attributes is an alias of update
|
680
|
+
sig do
|
681
|
+
params(
|
682
|
+
attributes: T.any(
|
683
|
+
T::Hash[T.any(Symbol, String), T.untyped],
|
684
|
+
ActionController::Parameters
|
685
|
+
)
|
686
|
+
).returns(T::Boolean)
|
687
|
+
end
|
688
|
+
def update_attributes(attributes); end
|
689
|
+
end
|
690
|
+
|
691
|
+
module ActiveRecord::Persistence::ClassMethods
|
692
|
+
sig do
|
693
|
+
params(
|
694
|
+
attributes: T.nilable(T.any(
|
695
|
+
T::Hash[T.any(Symbol, String), T.untyped],
|
696
|
+
T::Array[T::Hash[T.any(Symbol, String), T.untyped]]
|
697
|
+
)),
|
698
|
+
blk: T.nilable(T.proc.params(arg0: T.untyped).returns(T.untyped))
|
699
|
+
).returns(T.untyped)
|
700
|
+
end
|
701
|
+
def create!(attributes = nil, &blk); end
|
702
|
+
|
703
|
+
sig do
|
704
|
+
params(
|
705
|
+
attributes: T.nilable(T.any(
|
706
|
+
T::Hash[T.any(Symbol, String), T.untyped],
|
707
|
+
T::Array[T::Hash[T.any(Symbol, String), T.untyped]]
|
708
|
+
)),
|
709
|
+
blk: T.nilable(T.proc.params(arg0: T.untyped).returns(T.untyped))
|
710
|
+
).returns(T.untyped)
|
711
|
+
end
|
712
|
+
def create(attributes = nil, &blk); end
|
713
|
+
|
714
|
+
sig do
|
715
|
+
params(
|
716
|
+
id_or_array: T.any(T.untyped, T::Array[T.untyped])
|
717
|
+
).returns(T.untyped)
|
718
|
+
end
|
719
|
+
def delete(id_or_array); end
|
720
|
+
|
721
|
+
sig do
|
722
|
+
params(
|
723
|
+
id_or_array: T.any(T.untyped, T::Array[T.untyped])
|
724
|
+
).returns(T.untyped)
|
725
|
+
end
|
726
|
+
def destroy!(id_or_array); end
|
727
|
+
|
728
|
+
sig do
|
729
|
+
params(
|
730
|
+
id_or_array: T.any(T.untyped, T::Array[T.untyped])
|
731
|
+
).returns(T.untyped)
|
732
|
+
end
|
733
|
+
def destroy(id_or_array); end
|
734
|
+
|
735
|
+
sig do
|
736
|
+
params(
|
737
|
+
attributes: T::Array[T::Hash[T.any(Symbol, String), T.untyped]],
|
738
|
+
returning: T.nilable(T.any(FalseClass, T::Array[T.any(Symbol, String)]))
|
739
|
+
).returns(ActiveRecord::Result)
|
740
|
+
end
|
741
|
+
def insert_all!(attributes, returning: nil); end
|
742
|
+
|
743
|
+
sig do
|
744
|
+
params(
|
745
|
+
attributes: T::Array[T::Hash[T.any(Symbol, String), T.untyped]],
|
746
|
+
returning: T.nilable(T.any(FalseClass, T::Array[T.any(Symbol, String)])),
|
747
|
+
unique_by: T.nilable(T.untyped)
|
748
|
+
).returns(ActiveRecord::Result)
|
749
|
+
end
|
750
|
+
def insert_all(attributes, returning: nil, unique_by: nil); end
|
751
|
+
|
752
|
+
sig do
|
753
|
+
params(
|
754
|
+
attributes: T::Hash[T.any(Symbol, String), T.untyped],
|
755
|
+
returning: T.nilable(T.any(FalseClass, T::Array[T.any(Symbol, String)])),
|
756
|
+
unique_by: T.nilable(T.untyped)
|
757
|
+
).returns(ActiveRecord::Result)
|
758
|
+
end
|
759
|
+
def insert!(attributes, returning: nil, unique_by: nil); end
|
760
|
+
|
761
|
+
sig do
|
762
|
+
params(
|
763
|
+
attributes: T::Hash[T.any(Symbol, String), T.untyped],
|
764
|
+
returning: T.nilable(T.any(FalseClass, T::Array[T.any(Symbol, String)])),
|
765
|
+
unique_by: T.nilable(T.untyped)
|
766
|
+
).returns(ActiveRecord::Result)
|
767
|
+
end
|
768
|
+
def insert(attributes, returning: nil, unique_by: nil); end
|
769
|
+
|
770
|
+
sig { params(attributes: T.untyped, column_types: T::Hash[T.untyped, T.untyped], blk: T.proc.void).returns(T.untyped) }
|
771
|
+
def instantiate(attributes, column_types = {}, &blk); end
|
772
|
+
|
773
|
+
# The 'attributes' parameter can take either a hash or an array of hashes.
|
774
|
+
sig do
|
775
|
+
params(
|
776
|
+
id: T.any(T.untyped, T::Array[T.untyped], Symbol),
|
777
|
+
attributes: T.any(
|
778
|
+
T::Hash[T.any(Symbol, String), T.untyped],
|
779
|
+
T::Array[T::Hash[T.any(Symbol, String), T.untyped]]
|
780
|
+
)
|
781
|
+
).returns(T.any(T::Array[T.untyped], T.untyped))
|
782
|
+
end
|
783
|
+
def update(id = :all, attributes); end
|
784
|
+
|
785
|
+
sig do
|
786
|
+
params(
|
787
|
+
attributes: T::Array[T::Hash[T.any(Symbol, String), T.untyped]],
|
788
|
+
returning: T.nilable(T.any(FalseClass, T::Array[T.any(Symbol, String)])),
|
789
|
+
unique_by: T.nilable(T.untyped)
|
790
|
+
).returns(ActiveRecord::Result)
|
791
|
+
end
|
792
|
+
def upsert_all(attributes, returning: nil, unique_by: nil); end
|
793
|
+
|
794
|
+
sig do
|
795
|
+
params(
|
796
|
+
attributes: T::Hash[T.any(Symbol, String), T.untyped],
|
797
|
+
returning: T.nilable(T.any(FalseClass, T::Array[T.any(Symbol, String)])),
|
798
|
+
unique_by: T.nilable(T.untyped)
|
799
|
+
).returns(ActiveRecord::Result)
|
800
|
+
end
|
801
|
+
def upsert(attributes, returning: nil, unique_by: nil); end
|
802
|
+
end
|
803
|
+
|
804
|
+
class ActiveRecord::Result; end
|
805
|
+
|
806
|
+
class ActiveRecord::Type::Value
|
807
|
+
extend T::Sig
|
808
|
+
|
809
|
+
sig { params(args: T.untyped).void }
|
810
|
+
def initialize(args); end
|
811
|
+
|
812
|
+
sig { params(value: T.untyped).returns(T.untyped) }
|
813
|
+
def cast(value); end
|
814
|
+
end
|
815
|
+
|
816
|
+
class ActiveRecord::Type::Boolean < ActiveRecord::Type::Value
|
817
|
+
extend T::Sig
|
818
|
+
|
819
|
+
sig { params(args: T.untyped).void }
|
820
|
+
def initialize(args = nil); end
|
821
|
+
|
822
|
+
sig { params(value: T.untyped).returns(T.nilable(T::Boolean)) }
|
823
|
+
def cast(value); end
|
824
|
+
end
|
825
|
+
|
826
|
+
module ActiveRecord
|
827
|
+
class ActiveRecordError < StandardError; end
|
828
|
+
class AdapterNotFound < ActiveRecordError; end
|
829
|
+
class AdapterNotSpecified < ActiveRecordError; end
|
830
|
+
class AmbiguousSourceReflectionForThroughAssociation < ActiveRecordError; end
|
831
|
+
class AssociationNotFoundError < ConfigurationError; end
|
832
|
+
class AssociationTypeMismatch < ActiveRecordError; end
|
833
|
+
class AttributeAssignmentError < ActiveRecordError; end
|
834
|
+
class ConcurrentMigrationError < MigrationError; end
|
835
|
+
class ConfigurationError < ActiveRecordError; end
|
836
|
+
class ConnectionNotEstablished < ActiveRecordError; end
|
837
|
+
class ConnectionTimeoutError < ConnectionNotEstablished; end
|
838
|
+
class DangerousAttributeError < ActiveRecordError; end
|
839
|
+
class Deadlocked < TransactionRollbackError; end
|
840
|
+
class DeleteRestrictionError < ActiveRecordError; end
|
841
|
+
class DuplicateMigrationNameError < MigrationError; end
|
842
|
+
class DuplicateMigrationVersionError < MigrationError; end
|
843
|
+
class EagerLoadPolymorphicError < ActiveRecordError; end
|
844
|
+
class EnvironmentMismatchError < ActiveRecordError; end
|
845
|
+
class ExclusiveConnectionTimeoutError < ConnectionTimeoutError; end
|
846
|
+
class FixtureClassNotFound < ActiveRecordError; end
|
847
|
+
class HasManyThroughAssociationNotFoundError < ActiveRecordError; end
|
848
|
+
class HasManyThroughAssociationPointlessSourceTypeError < ActiveRecordError; end
|
849
|
+
class HasManyThroughAssociationPolymorphicSourceError < ActiveRecordError; end
|
850
|
+
class HasManyThroughAssociationPolymorphicThroughError < ActiveRecordError; end
|
851
|
+
class HasManyThroughCantAssociateThroughHasOneOrManyReflection < ThroughCantAssociateThroughHasOneOrManyReflection; end
|
852
|
+
class HasManyThroughNestedAssociationsAreReadonly < ThroughNestedAssociationsAreReadonly; end
|
853
|
+
class HasManyThroughOrderError < ActiveRecordError; end
|
854
|
+
class HasManyThroughSourceAssociationNotFoundError < ActiveRecordError; end
|
855
|
+
class HasOneAssociationPolymorphicThroughError < ActiveRecordError; end
|
856
|
+
class HasOneThroughCantAssociateThroughCollection < ActiveRecordError; end
|
857
|
+
class HasOneThroughCantAssociateThroughHasOneOrManyReflection < ThroughCantAssociateThroughHasOneOrManyReflection; end
|
858
|
+
class HasOneThroughNestedAssociationsAreReadonly < ThroughNestedAssociationsAreReadonly; end
|
859
|
+
class IllegalMigrationNameError < MigrationError; end
|
860
|
+
class ImmutableRelation < ActiveRecordError; end
|
861
|
+
class InvalidForeignKey < WrappedDatabaseException; end
|
862
|
+
class InverseOfAssociationNotFoundError < ActiveRecordError; end
|
863
|
+
class IrreversibleMigration < MigrationError; end
|
864
|
+
class IrreversibleOrderError < ActiveRecordError; end
|
865
|
+
class LockWaitTimeout < StatementInvalid; end
|
866
|
+
class MigrationError < ActiveRecordError; end
|
867
|
+
class MismatchedForeignKey < StatementInvalid; end
|
868
|
+
class MultiparameterAssignmentErrors < ActiveRecordError; end
|
869
|
+
class NoDatabaseError < StatementInvalid; end
|
870
|
+
class NoEnvironmentInSchemaError < MigrationError; end
|
871
|
+
class NotNullViolation < StatementInvalid; end
|
872
|
+
class PendingMigrationError < MigrationError; end
|
873
|
+
class PreparedStatementCacheExpired < StatementInvalid; end
|
874
|
+
class PreparedStatementInvalid < ActiveRecordError; end
|
875
|
+
class ProtectedEnvironmentError < ActiveRecordError; end
|
876
|
+
class QueryCanceled < StatementInvalid; end
|
877
|
+
class RangeError < StatementInvalid; end
|
878
|
+
class ReadOnlyRecord < ActiveRecordError; end
|
879
|
+
class RecordInvalid < ActiveRecordError; end
|
880
|
+
class RecordNotDestroyed < ActiveRecordError; end
|
881
|
+
class RecordNotFound < ActiveRecordError; end
|
882
|
+
class RecordNotSaved < ActiveRecordError; end
|
883
|
+
class RecordNotUnique < WrappedDatabaseException; end
|
884
|
+
class Rollback < ActiveRecordError; end
|
885
|
+
class SerializationFailure < TransactionRollbackError; end
|
886
|
+
class SerializationTypeMismatch < ActiveRecordError; end
|
887
|
+
class StaleObjectError < ActiveRecordError; end
|
888
|
+
class StatementInvalid < ActiveRecordError; end
|
889
|
+
class StatementTimeout < StatementInvalid; end
|
890
|
+
class SubclassNotFound < ActiveRecordError; end
|
891
|
+
class ThroughCantAssociateThroughHasOneOrManyReflection < ActiveRecordError; end
|
892
|
+
class ThroughNestedAssociationsAreReadonly < ActiveRecordError; end
|
893
|
+
class TransactionIsolationError < ActiveRecordError; end
|
894
|
+
class TransactionRollbackError < StatementInvalid; end
|
895
|
+
class TypeConflictError < StandardError; end
|
896
|
+
class UnknownAttributeError < NoMethodError; end
|
897
|
+
class UnknownAttributeReference < ActiveRecordError; end
|
898
|
+
class UnknownMigrationVersionError < MigrationError; end
|
899
|
+
class UnknownPrimaryKey < ActiveRecordError; end
|
900
|
+
class ValueTooLong < StatementInvalid; end
|
901
|
+
class WrappedDatabaseException < StatementInvalid; end
|
902
|
+
end
|
903
|
+
|
904
|
+
class ActiveRecord::Schema < ActiveRecord::Migration::Current
|
905
|
+
sig {params(info: T::Hash[T.untyped, T.untyped], blk: T.proc.bind(ActiveRecord::Schema).void).void}
|
906
|
+
def self.define(info = nil, &blk); end
|
907
|
+
end
|
908
|
+
|
909
|
+
module ActiveRecord::AttributeMethods::Dirty
|
910
|
+
extend T::Sig
|
911
|
+
sig { params(attr_name: Symbol, options: T.untyped).returns(T::Boolean) }
|
912
|
+
def saved_change_to_attribute?(attr_name, **options); end
|
913
|
+
end
|
914
|
+
|
915
|
+
module ActiveRecord::Associations
|
916
|
+
mixes_in_class_methods(ActiveRecord::Associations::ClassMethods)
|
917
|
+
end
|
918
|
+
|
919
|
+
module ActiveRecord::Validations
|
920
|
+
include ActiveModel::Validations
|
921
|
+
|
922
|
+
mixes_in_class_methods(ActiveModel::Validations::ClassMethods)
|
923
|
+
end
|
924
|
+
|
925
|
+
# Represents the schema of an SQL table in an abstract way. This class
|
926
|
+
# provides methods for manipulating the schema representation.
|
927
|
+
#
|
928
|
+
# Inside migration files, the `t` object in `create_table`
|
929
|
+
# is actually of this type:
|
930
|
+
#
|
931
|
+
# ```ruby
|
932
|
+
# class SomeMigration < ActiveRecord::Migration[5.0]
|
933
|
+
# def up
|
934
|
+
# create_table :foo do |t|
|
935
|
+
# puts t.class # => "ActiveRecord::ConnectionAdapters::TableDefinition"
|
936
|
+
# end
|
937
|
+
# end
|
938
|
+
#
|
939
|
+
# def down
|
940
|
+
# # ...
|
941
|
+
# end
|
942
|
+
# end
|
943
|
+
# ```
|
944
|
+
class ActiveRecord::ConnectionAdapters::TableDefinition
|
945
|
+
include ActiveRecord::ConnectionAdapters::ColumnMethods
|
946
|
+
|
947
|
+
# Returns an array of ColumnDefinition objects for the columns of the table.
|
948
|
+
sig { returns(T::Array[ActiveRecord::ConnectionAdapters::ColumnDefinition]) }
|
949
|
+
def columns; end
|
950
|
+
|
951
|
+
# Returns a ColumnDefinition for the column with name `name`.
|
952
|
+
sig { params(name: T.any(String, Symbol)).returns(ActiveRecord::ConnectionAdapters::ColumnDefinition) }
|
953
|
+
def [](name); end
|
954
|
+
|
955
|
+
sig do
|
956
|
+
params(
|
957
|
+
name: T.any(String, Symbol),
|
958
|
+
type: T.untyped,
|
959
|
+
index: T.any(T::Hash[T.untyped, T.untyped], T::Boolean),
|
960
|
+
default: T.untyped,
|
961
|
+
options: T.untyped
|
962
|
+
).returns(T.self_type)
|
963
|
+
end
|
964
|
+
def column(
|
965
|
+
name,
|
966
|
+
type,
|
967
|
+
index: nil,
|
968
|
+
default: nil,
|
969
|
+
**options
|
970
|
+
); end
|
971
|
+
|
972
|
+
# Remove the column `name` from the table.
|
973
|
+
#
|
974
|
+
# ```ruby
|
975
|
+
# remove_column(:account_id)
|
976
|
+
# ```
|
977
|
+
sig { params(name: T.any(String, Symbol)).void }
|
978
|
+
def remove_column(name); end
|
979
|
+
|
980
|
+
# Adds index options to the indexes hash, keyed by column name
|
981
|
+
# This is primarily used to track indexes that need to be created after the table
|
982
|
+
#
|
983
|
+
# ```ruby
|
984
|
+
# index(:account_id, name: 'index_projects_on_account_id')
|
985
|
+
# ```
|
986
|
+
sig do
|
987
|
+
params(
|
988
|
+
column_name: T.any(String, Symbol, T::Array[T.any(String, Symbol)]),
|
989
|
+
options: T.untyped
|
990
|
+
).void
|
991
|
+
end
|
992
|
+
def index(column_name, options = {}); end
|
993
|
+
|
994
|
+
# Appends `:datetime` columns `:created_at` and
|
995
|
+
# `:updated_at` to the table.
|
996
|
+
#
|
997
|
+
# ```ruby
|
998
|
+
# t.timestamps null: false
|
999
|
+
# ```
|
1000
|
+
sig { params(options: T.untyped).void }
|
1001
|
+
def timestamps(**options); end
|
1002
|
+
|
1003
|
+
# Adds a reference.
|
1004
|
+
#
|
1005
|
+
# ```ruby
|
1006
|
+
# t.references(:user)
|
1007
|
+
# t.belongs_to(:supplier, foreign_key: true)
|
1008
|
+
# t.belongs_to(:supplier, foreign_key: true, type: :integer)
|
1009
|
+
# ```
|
1010
|
+
sig { params(args: T.untyped, options: T.untyped).void }
|
1011
|
+
def references(*args, **options); end
|
1012
|
+
|
1013
|
+
# Adds a reference.
|
1014
|
+
#
|
1015
|
+
# ```ruby
|
1016
|
+
# t.references(:user)
|
1017
|
+
# t.belongs_to(:supplier, foreign_key: true)
|
1018
|
+
# t.belongs_to(:supplier, foreign_key: true, type: :integer)
|
1019
|
+
# ```
|
1020
|
+
sig { params(args: T.untyped, options: T.untyped).void }
|
1021
|
+
def belongs_to(*args, **options); end
|
1022
|
+
end
|
1023
|
+
|
1024
|
+
module ActiveRecord::ConnectionAdapters::ColumnMethods
|
1025
|
+
# Appends a primary key definition to the table definition.
|
1026
|
+
# Can be called multiple times, but this is probably not a good idea.
|
1027
|
+
sig do
|
1028
|
+
params(
|
1029
|
+
name: T.any(String, Symbol),
|
1030
|
+
type: T.any(String, Symbol),
|
1031
|
+
options: T.untyped
|
1032
|
+
).void
|
1033
|
+
end
|
1034
|
+
def primary_key(name, type = :primary_key, **options); end
|
1035
|
+
|
1036
|
+
########
|
1037
|
+
# NOTE: The following methods are all generated dynamically and have the same parameters.
|
1038
|
+
# See https://github.com/rails/rails/blob/v6.0.0/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb#L217
|
1039
|
+
########
|
1040
|
+
|
1041
|
+
sig do
|
1042
|
+
params(
|
1043
|
+
names: T.any(String, Symbol),
|
1044
|
+
index: T.any(T::Hash[T.untyped, T.untyped], T::Boolean),
|
1045
|
+
default: T.untyped,
|
1046
|
+
options: T.untyped
|
1047
|
+
).void
|
1048
|
+
end
|
1049
|
+
def bigint(*names, index: nil, default: nil, **options); end
|
1050
|
+
|
1051
|
+
sig do
|
1052
|
+
params(
|
1053
|
+
names: T.any(String, Symbol),
|
1054
|
+
index: T.any(T::Hash[T.untyped, T.untyped], T::Boolean),
|
1055
|
+
default: T.untyped,
|
1056
|
+
options: T.untyped
|
1057
|
+
).void
|
1058
|
+
end
|
1059
|
+
def binary(*names, index: nil, default: nil, **options); end
|
1060
|
+
|
1061
|
+
sig do
|
1062
|
+
params(
|
1063
|
+
names: T.any(String, Symbol),
|
1064
|
+
index: T.any(T::Hash[T.untyped, T.untyped], T::Boolean),
|
1065
|
+
default: T.untyped,
|
1066
|
+
options: T.untyped
|
1067
|
+
).void
|
1068
|
+
end
|
1069
|
+
def boolean(*names, index: nil, default: nil, **options); end
|
1070
|
+
|
1071
|
+
sig do
|
1072
|
+
params(
|
1073
|
+
names: T.any(String, Symbol),
|
1074
|
+
index: T.any(T::Hash[T.untyped, T.untyped], T::Boolean),
|
1075
|
+
default: T.untyped,
|
1076
|
+
options: T.untyped
|
1077
|
+
).void
|
1078
|
+
end
|
1079
|
+
def date(*names, index: nil, default: nil, **options); end
|
1080
|
+
|
1081
|
+
sig do
|
1082
|
+
params(
|
1083
|
+
names: T.any(String, Symbol),
|
1084
|
+
index: T.any(T::Hash[T.untyped, T.untyped], T::Boolean),
|
1085
|
+
default: T.untyped,
|
1086
|
+
options: T.untyped
|
1087
|
+
).void
|
1088
|
+
end
|
1089
|
+
def datetime(*names, index: nil, default: nil, **options); end
|
1090
|
+
|
1091
|
+
sig do
|
1092
|
+
params(
|
1093
|
+
names: T.any(String, Symbol),
|
1094
|
+
index: T.any(T::Hash[T.untyped, T.untyped], T::Boolean),
|
1095
|
+
default: T.untyped,
|
1096
|
+
options: T.untyped
|
1097
|
+
).void
|
1098
|
+
end
|
1099
|
+
def decimal(*names, index: nil, default: nil, **options); end
|
1100
|
+
|
1101
|
+
sig do
|
1102
|
+
params(
|
1103
|
+
names: T.any(String, Symbol),
|
1104
|
+
index: T.any(T::Hash[T.untyped, T.untyped], T::Boolean),
|
1105
|
+
default: T.untyped,
|
1106
|
+
options: T.untyped
|
1107
|
+
).void
|
1108
|
+
end
|
1109
|
+
def numeric(*names, index: nil, default: nil, **options); end
|
1110
|
+
|
1111
|
+
sig do
|
1112
|
+
params(
|
1113
|
+
names: T.any(String, Symbol),
|
1114
|
+
index: T.any(T::Hash[T.untyped, T.untyped], T::Boolean),
|
1115
|
+
default: T.untyped,
|
1116
|
+
options: T.untyped
|
1117
|
+
).void
|
1118
|
+
end
|
1119
|
+
def float(*names, index: nil, default: nil, **options); end
|
1120
|
+
|
1121
|
+
sig do
|
1122
|
+
params(
|
1123
|
+
names: T.any(String, Symbol),
|
1124
|
+
index: T.any(T::Hash[T.untyped, T.untyped], T::Boolean),
|
1125
|
+
default: T.untyped,
|
1126
|
+
options: T.untyped
|
1127
|
+
).void
|
1128
|
+
end
|
1129
|
+
def integer(*names, index: nil, default: nil, **options); end
|
1130
|
+
|
1131
|
+
sig do
|
1132
|
+
params(
|
1133
|
+
names: T.any(String, Symbol),
|
1134
|
+
index: T.any(T::Hash[T.untyped, T.untyped], T::Boolean),
|
1135
|
+
default: T.untyped,
|
1136
|
+
options: T.untyped
|
1137
|
+
).void
|
1138
|
+
end
|
1139
|
+
def json(*names, index: nil, default: nil, **options); end
|
1140
|
+
|
1141
|
+
sig do
|
1142
|
+
params(
|
1143
|
+
names: T.any(String, Symbol),
|
1144
|
+
index: T.any(T::Hash[T.untyped, T.untyped], T::Boolean),
|
1145
|
+
default: T.untyped,
|
1146
|
+
options: T.untyped
|
1147
|
+
).void
|
1148
|
+
end
|
1149
|
+
def string(*names, index: nil, default: nil, **options); end
|
1150
|
+
|
1151
|
+
sig do
|
1152
|
+
params(
|
1153
|
+
names: T.any(String, Symbol),
|
1154
|
+
index: T.any(T::Hash[T.untyped, T.untyped], T::Boolean),
|
1155
|
+
default: T.untyped,
|
1156
|
+
options: T.untyped
|
1157
|
+
).void
|
1158
|
+
end
|
1159
|
+
def text(*names, index: nil, default: nil, **options); end
|
1160
|
+
|
1161
|
+
sig do
|
1162
|
+
params(
|
1163
|
+
names: T.any(String, Symbol),
|
1164
|
+
index: T.any(T::Hash[T.untyped, T.untyped], T::Boolean),
|
1165
|
+
default: T.untyped,
|
1166
|
+
options: T.untyped
|
1167
|
+
).void
|
1168
|
+
end
|
1169
|
+
def time(*names, index: nil, default: nil, **options); end
|
1170
|
+
|
1171
|
+
sig do
|
1172
|
+
params(
|
1173
|
+
names: T.any(String, Symbol),
|
1174
|
+
index: T.any(T::Hash[T.untyped, T.untyped], T::Boolean),
|
1175
|
+
default: T.untyped,
|
1176
|
+
options: T.untyped
|
1177
|
+
).void
|
1178
|
+
end
|
1179
|
+
def timestamp(*names, index: nil, default: nil, **options); end
|
1180
|
+
|
1181
|
+
sig do
|
1182
|
+
params(
|
1183
|
+
names: T.any(String, Symbol),
|
1184
|
+
index: T.any(T::Hash[T.untyped, T.untyped], T::Boolean),
|
1185
|
+
default: T.untyped,
|
1186
|
+
options: T.untyped
|
1187
|
+
).void
|
1188
|
+
end
|
1189
|
+
def virtual(*names, index: nil, default: nil, **options); end
|
1190
|
+
end
|
1191
|
+
|
1192
|
+
# Represents an SQL table in an abstract way for updating a table.
|
1193
|
+
#
|
1194
|
+
# Available transformations are:
|
1195
|
+
#
|
1196
|
+
# ```ruby
|
1197
|
+
# change_table :table do |t|
|
1198
|
+
# t.primary_key
|
1199
|
+
# t.column
|
1200
|
+
# t.index
|
1201
|
+
# t.rename_index
|
1202
|
+
# t.timestamps
|
1203
|
+
# t.change
|
1204
|
+
# t.change_default
|
1205
|
+
# t.rename
|
1206
|
+
# t.references
|
1207
|
+
# t.belongs_to
|
1208
|
+
# t.string
|
1209
|
+
# t.text
|
1210
|
+
# t.integer
|
1211
|
+
# t.bigint
|
1212
|
+
# t.float
|
1213
|
+
# t.decimal
|
1214
|
+
# t.numeric
|
1215
|
+
# t.datetime
|
1216
|
+
# t.timestamp
|
1217
|
+
# t.time
|
1218
|
+
# t.date
|
1219
|
+
# t.binary
|
1220
|
+
# t.boolean
|
1221
|
+
# t.foreign_key
|
1222
|
+
# t.json
|
1223
|
+
# t.virtual
|
1224
|
+
# t.remove
|
1225
|
+
# t.remove_foreign_key
|
1226
|
+
# t.remove_references
|
1227
|
+
# t.remove_belongs_to
|
1228
|
+
# t.remove_index
|
1229
|
+
# t.remove_timestamps
|
1230
|
+
# end
|
1231
|
+
# ```
|
1232
|
+
class ActiveRecord::ConnectionAdapters::Table
|
1233
|
+
include ActiveRecord::ConnectionAdapters::ColumnMethods
|
1234
|
+
|
1235
|
+
# Adds a new column to the named table.
|
1236
|
+
#
|
1237
|
+
# ```ruby
|
1238
|
+
# t.column(:name, :string)
|
1239
|
+
# ```
|
1240
|
+
sig { params(column_name: T.any(String, Symbol), type: Symbol, options: T.untyped).void }
|
1241
|
+
def column(column_name, type, **options); end
|
1242
|
+
|
1243
|
+
# Checks to see if a column exists.
|
1244
|
+
#
|
1245
|
+
# ```ruby
|
1246
|
+
# t.string(:name) unless t.column_exists?(:name, :string)
|
1247
|
+
# ```
|
1248
|
+
sig { params(column_name: T.any(String, Symbol), type: Symbol, options: T.untyped).returns(T::Boolean) }
|
1249
|
+
def column_exists?(column_name, type = nil, options = {}); end
|
1250
|
+
|
1251
|
+
# Adds a new index to the table. `column_name` can be a single Symbol, or
|
1252
|
+
# an Array of Symbols.
|
1253
|
+
#
|
1254
|
+
# ```ruby
|
1255
|
+
# t.index(:name)
|
1256
|
+
# t.index([:branch_id, :party_id], unique: true)
|
1257
|
+
# t.index([:branch_id, :party_id], unique: true, name: 'by_branch_party')
|
1258
|
+
# ```
|
1259
|
+
sig do
|
1260
|
+
params(
|
1261
|
+
column_name: T.any(String, Symbol, T::Array[T.any(String, Symbol)]),
|
1262
|
+
options: T.untyped
|
1263
|
+
).void
|
1264
|
+
end
|
1265
|
+
def index(column_name, options = {}); end
|
1266
|
+
|
1267
|
+
# Checks to see if an index exists.
|
1268
|
+
#
|
1269
|
+
# ```ruby
|
1270
|
+
# unless t.index_exists?(:branch_id)
|
1271
|
+
# t.index(:branch_id)
|
1272
|
+
# end
|
1273
|
+
# ```
|
1274
|
+
sig { params(column_name: T.any(String, Symbol), options: T.untyped).returns(T::Boolean) }
|
1275
|
+
def index_exists?(column_name, options = {}); end
|
1276
|
+
|
1277
|
+
# Renames the given index on the table.
|
1278
|
+
#
|
1279
|
+
# ```ruby
|
1280
|
+
# t.rename_index(:user_id, :account_id)
|
1281
|
+
# ```
|
1282
|
+
sig { params(index_name: T.any(String, Symbol), new_index_name: T.any(String, Symbol)).void }
|
1283
|
+
def rename_index(index_name, new_index_name); end
|
1284
|
+
|
1285
|
+
# Adds timestamps (`created_at` and `updated_at`) columns to the table.
|
1286
|
+
#
|
1287
|
+
# ```ruby
|
1288
|
+
# t.timestamps(null: false)
|
1289
|
+
# ```
|
1290
|
+
def timestamps(options = {}); end
|
1291
|
+
|
1292
|
+
# Changes the column's definition according to the new options.
|
1293
|
+
#
|
1294
|
+
# ```ruby
|
1295
|
+
# t.change(:name, :string, limit: 80)
|
1296
|
+
# t.change(:description, :text)
|
1297
|
+
# ```
|
1298
|
+
sig { params(column_name: T.any(String, Symbol), type: Symbol, options: T.untyped).void }
|
1299
|
+
def change(column_name, type, options = {}); end
|
1300
|
+
|
1301
|
+
# Sets a new default value for a column.
|
1302
|
+
#
|
1303
|
+
# ```ruby
|
1304
|
+
# t.change_default(:qualification, 'new')
|
1305
|
+
# t.change_default(:authorized, 1)
|
1306
|
+
# t.change_default(:status, from: nil, to: "draft")
|
1307
|
+
# ```
|
1308
|
+
sig { params(column_name: T.any(String, Symbol), default_or_changes: T.untyped).void }
|
1309
|
+
def change_default(column_name, default_or_changes); end
|
1310
|
+
|
1311
|
+
# Removes the column(s) from the table definition.
|
1312
|
+
#
|
1313
|
+
# ```ruby
|
1314
|
+
# t.remove(:qualification)
|
1315
|
+
# t.remove(:qualification, :experience)
|
1316
|
+
# ```
|
1317
|
+
sig { params(column_names: T.any(String, Symbol)).void }
|
1318
|
+
def remove(*column_names); end
|
1319
|
+
|
1320
|
+
# Removes the given index from the table.
|
1321
|
+
#
|
1322
|
+
# ```ruby
|
1323
|
+
# t.remove_index(:branch_id)
|
1324
|
+
# t.remove_index(column: [:branch_id, :party_id])
|
1325
|
+
# t.remove_index(name: :by_branch_party)
|
1326
|
+
# ```
|
1327
|
+
sig { params(options: T.untyped).void }
|
1328
|
+
def remove_index(options = {}); end
|
1329
|
+
|
1330
|
+
# Removes the timestamp columns (`created_at` and `updated_at`) from the table.
|
1331
|
+
#
|
1332
|
+
# ```ruby
|
1333
|
+
# t.remove_timestamps
|
1334
|
+
# ```
|
1335
|
+
sig { params(options: T.untyped).void }
|
1336
|
+
def remove_timestamps(options = {}); end
|
1337
|
+
|
1338
|
+
# Renames a column.
|
1339
|
+
#
|
1340
|
+
# ```ruby
|
1341
|
+
# t.rename(:description, :name)
|
1342
|
+
# ```
|
1343
|
+
sig { params(column_name: T.any(String, Symbol), new_column_name: T.any(String, Symbol)).void }
|
1344
|
+
def rename(column_name, new_column_name); end
|
1345
|
+
|
1346
|
+
# Adds a reference.
|
1347
|
+
#
|
1348
|
+
# ```ruby
|
1349
|
+
# t.references(:user)
|
1350
|
+
# t.belongs_to(:supplier, foreign_key: true)
|
1351
|
+
# ```
|
1352
|
+
sig { params(args: T.untyped, options: T.untyped).void }
|
1353
|
+
def references(*args, **options); end
|
1354
|
+
|
1355
|
+
# Adds a reference.
|
1356
|
+
#
|
1357
|
+
# ```ruby
|
1358
|
+
# t.references(:user)
|
1359
|
+
# t.belongs_to(:supplier, foreign_key: true)
|
1360
|
+
# ```
|
1361
|
+
sig { params(args: T.untyped, options: T.untyped).void }
|
1362
|
+
def belongs_to(*args, **options); end
|
1363
|
+
|
1364
|
+
# Removes a reference. Optionally removes a `type` column.
|
1365
|
+
#
|
1366
|
+
# ```ruby
|
1367
|
+
# t.remove_references(:user)
|
1368
|
+
# t.remove_belongs_to(:supplier, polymorphic: true)
|
1369
|
+
# ```
|
1370
|
+
sig { params(args: T.untyped, options: T.untyped).void }
|
1371
|
+
def remove_references(*args, **options); end
|
1372
|
+
|
1373
|
+
# Removes a reference. Optionally removes a `type` column.
|
1374
|
+
#
|
1375
|
+
# ```ruby
|
1376
|
+
# t.remove_references(:user)
|
1377
|
+
# t.remove_belongs_to(:supplier, polymorphic: true)
|
1378
|
+
# ```
|
1379
|
+
sig { params(args: T.untyped, options: T.untyped).void }
|
1380
|
+
def remove_belongs_to(*args, **options); end
|
1381
|
+
|
1382
|
+
# Adds a foreign key to the table using a supplied table name.
|
1383
|
+
#
|
1384
|
+
# ```ruby
|
1385
|
+
# t.foreign_key(:authors)
|
1386
|
+
# t.foreign_key(:authors, column: :author_id, primary_key: "id")
|
1387
|
+
# ```
|
1388
|
+
sig { params(args: T.untyped).void }
|
1389
|
+
def foreign_key(*args); end
|
1390
|
+
|
1391
|
+
# Removes the given foreign key from the table.
|
1392
|
+
#
|
1393
|
+
# ```ruby
|
1394
|
+
# t.remove_foreign_key(:authors)
|
1395
|
+
# t.remove_foreign_key(column: :author_id)
|
1396
|
+
# ```
|
1397
|
+
sig { params(args: T.untyped).void }
|
1398
|
+
def remove_foreign_key(*args); end
|
1399
|
+
|
1400
|
+
# Checks to see if a foreign key exists.
|
1401
|
+
#
|
1402
|
+
# ```ruby
|
1403
|
+
# t.foreign_key(:authors) unless t.foreign_key_exists?(:authors)
|
1404
|
+
# ```
|
1405
|
+
sig { params(args: T.untyped).returns(T::Boolean) }
|
1406
|
+
def foreign_key_exists?(*args); end
|
1407
|
+
end
|
1408
|
+
|
1409
|
+
module ActiveRecord::Locking::Pessimistic
|
1410
|
+
# Returns `nil` if `ActiveRecord::Rollback` is raised.
|
1411
|
+
sig do
|
1412
|
+
type_parameters(:U)
|
1413
|
+
.params(
|
1414
|
+
lock: T.any(String, TrueClass),
|
1415
|
+
blk: T.proc.returns(T.type_parameter(:U)),
|
1416
|
+
)
|
1417
|
+
.returns(T.nilable(T.type_parameter(:U)))
|
1418
|
+
end
|
1419
|
+
def with_lock(lock = nil, &blk); end
|
1420
|
+
end
|
1421
|
+
|
1422
|
+
class ActiveRecord::Relation
|
1423
|
+
sig { returns(Integer) }
|
1424
|
+
def delete_all; end
|
1425
|
+
end
|