activerecord 4.2.0 → 5.2.8.1
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of activerecord might be problematic. Click here for more details.
- checksums.yaml +5 -5
- data/CHANGELOG.md +640 -928
- data/MIT-LICENSE +2 -2
- data/README.rdoc +10 -11
- data/examples/performance.rb +32 -31
- data/examples/simple.rb +5 -4
- data/lib/active_record/aggregations.rb +264 -247
- data/lib/active_record/association_relation.rb +24 -6
- data/lib/active_record/associations/alias_tracker.rb +29 -35
- data/lib/active_record/associations/association.rb +87 -41
- data/lib/active_record/associations/association_scope.rb +106 -132
- data/lib/active_record/associations/belongs_to_association.rb +55 -36
- data/lib/active_record/associations/belongs_to_polymorphic_association.rb +8 -8
- data/lib/active_record/associations/builder/association.rb +29 -38
- data/lib/active_record/associations/builder/belongs_to.rb +77 -30
- data/lib/active_record/associations/builder/collection_association.rb +14 -23
- data/lib/active_record/associations/builder/has_and_belongs_to_many.rb +50 -39
- data/lib/active_record/associations/builder/has_many.rb +6 -4
- data/lib/active_record/associations/builder/has_one.rb +13 -6
- data/lib/active_record/associations/builder/singular_association.rb +15 -11
- data/lib/active_record/associations/collection_association.rb +145 -266
- data/lib/active_record/associations/collection_proxy.rb +242 -138
- data/lib/active_record/associations/foreign_association.rb +13 -0
- data/lib/active_record/associations/has_many_association.rb +35 -75
- data/lib/active_record/associations/has_many_through_association.rb +51 -69
- data/lib/active_record/associations/has_one_association.rb +39 -24
- data/lib/active_record/associations/has_one_through_association.rb +18 -9
- data/lib/active_record/associations/join_dependency/join_association.rb +40 -81
- data/lib/active_record/associations/join_dependency/join_base.rb +10 -9
- data/lib/active_record/associations/join_dependency/join_part.rb +12 -12
- data/lib/active_record/associations/join_dependency.rb +134 -154
- data/lib/active_record/associations/preloader/association.rb +85 -116
- data/lib/active_record/associations/preloader/through_association.rb +85 -74
- data/lib/active_record/associations/preloader.rb +83 -93
- data/lib/active_record/associations/singular_association.rb +27 -40
- data/lib/active_record/associations/through_association.rb +48 -23
- data/lib/active_record/associations.rb +1732 -1596
- data/lib/active_record/attribute_assignment.rb +58 -182
- data/lib/active_record/attribute_decorators.rb +39 -15
- data/lib/active_record/attribute_methods/before_type_cast.rb +12 -5
- data/lib/active_record/attribute_methods/dirty.rb +94 -125
- data/lib/active_record/attribute_methods/primary_key.rb +86 -71
- data/lib/active_record/attribute_methods/query.rb +4 -2
- data/lib/active_record/attribute_methods/read.rb +45 -63
- data/lib/active_record/attribute_methods/serialization.rb +40 -20
- data/lib/active_record/attribute_methods/time_zone_conversion.rb +62 -36
- data/lib/active_record/attribute_methods/write.rb +31 -46
- data/lib/active_record/attribute_methods.rb +170 -117
- data/lib/active_record/attributes.rb +201 -74
- data/lib/active_record/autosave_association.rb +118 -45
- data/lib/active_record/base.rb +60 -48
- data/lib/active_record/callbacks.rb +97 -57
- data/lib/active_record/coders/json.rb +3 -1
- data/lib/active_record/coders/yaml_column.rb +37 -13
- data/lib/active_record/collection_cache_key.rb +53 -0
- data/lib/active_record/connection_adapters/abstract/connection_pool.rb +712 -284
- data/lib/active_record/connection_adapters/abstract/database_limits.rb +10 -5
- data/lib/active_record/connection_adapters/abstract/database_statements.rb +254 -87
- data/lib/active_record/connection_adapters/abstract/query_cache.rb +72 -22
- data/lib/active_record/connection_adapters/abstract/quoting.rb +119 -52
- data/lib/active_record/connection_adapters/abstract/savepoints.rb +6 -4
- data/lib/active_record/connection_adapters/abstract/schema_creation.rb +67 -46
- data/lib/active_record/connection_adapters/abstract/schema_definitions.rb +328 -217
- data/lib/active_record/connection_adapters/abstract/schema_dumper.rb +81 -36
- data/lib/active_record/connection_adapters/abstract/schema_statements.rb +617 -212
- data/lib/active_record/connection_adapters/abstract/transaction.rb +139 -75
- data/lib/active_record/connection_adapters/abstract_adapter.rb +332 -191
- data/lib/active_record/connection_adapters/abstract_mysql_adapter.rb +567 -563
- data/lib/active_record/connection_adapters/column.rb +50 -41
- data/lib/active_record/connection_adapters/connection_specification.rb +147 -135
- data/lib/active_record/connection_adapters/determine_if_preparable_visitor.rb +33 -0
- data/lib/active_record/connection_adapters/mysql/column.rb +27 -0
- data/lib/active_record/connection_adapters/mysql/database_statements.rb +140 -0
- data/lib/active_record/connection_adapters/mysql/explain_pretty_printer.rb +72 -0
- data/lib/active_record/connection_adapters/mysql/quoting.rb +44 -0
- data/lib/active_record/connection_adapters/mysql/schema_creation.rb +73 -0
- data/lib/active_record/connection_adapters/mysql/schema_definitions.rb +87 -0
- data/lib/active_record/connection_adapters/mysql/schema_dumper.rb +80 -0
- data/lib/active_record/connection_adapters/mysql/schema_statements.rb +148 -0
- data/lib/active_record/connection_adapters/mysql/type_metadata.rb +35 -0
- data/lib/active_record/connection_adapters/mysql2_adapter.rb +42 -195
- data/lib/active_record/connection_adapters/postgresql/column.rb +35 -11
- data/lib/active_record/connection_adapters/postgresql/database_statements.rb +46 -115
- data/lib/active_record/connection_adapters/postgresql/explain_pretty_printer.rb +44 -0
- data/lib/active_record/connection_adapters/postgresql/oid/array.rb +50 -57
- data/lib/active_record/connection_adapters/postgresql/oid/bit.rb +10 -6
- data/lib/active_record/connection_adapters/postgresql/oid/bit_varying.rb +2 -0
- data/lib/active_record/connection_adapters/postgresql/oid/bytea.rb +5 -2
- data/lib/active_record/connection_adapters/postgresql/oid/cidr.rb +5 -1
- data/lib/active_record/connection_adapters/postgresql/oid/date.rb +13 -1
- data/lib/active_record/connection_adapters/postgresql/oid/date_time.rb +9 -13
- data/lib/active_record/connection_adapters/postgresql/oid/decimal.rb +3 -1
- data/lib/active_record/connection_adapters/postgresql/oid/enum.rb +7 -3
- data/lib/active_record/connection_adapters/postgresql/oid/hstore.rb +31 -19
- data/lib/active_record/connection_adapters/postgresql/oid/inet.rb +2 -0
- data/lib/active_record/connection_adapters/postgresql/oid/jsonb.rb +3 -11
- data/lib/active_record/connection_adapters/postgresql/oid/legacy_point.rb +45 -0
- data/lib/active_record/connection_adapters/postgresql/oid/money.rb +7 -9
- data/lib/active_record/connection_adapters/postgresql/oid/{integer.rb → oid.rb} +6 -2
- data/lib/active_record/connection_adapters/postgresql/oid/point.rb +33 -11
- data/lib/active_record/connection_adapters/postgresql/oid/range.rb +52 -34
- data/lib/active_record/connection_adapters/postgresql/oid/specialized_string.rb +4 -1
- data/lib/active_record/connection_adapters/postgresql/oid/type_map_initializer.rb +65 -51
- data/lib/active_record/connection_adapters/postgresql/oid/uuid.rb +5 -3
- data/lib/active_record/connection_adapters/postgresql/oid/vector.rb +3 -1
- data/lib/active_record/connection_adapters/postgresql/oid/xml.rb +3 -1
- data/lib/active_record/connection_adapters/postgresql/oid.rb +23 -25
- data/lib/active_record/connection_adapters/postgresql/quoting.rb +107 -47
- data/lib/active_record/connection_adapters/postgresql/referential_integrity.rb +27 -14
- data/lib/active_record/connection_adapters/postgresql/schema_creation.rb +65 -0
- data/lib/active_record/connection_adapters/postgresql/schema_definitions.rb +144 -90
- data/lib/active_record/connection_adapters/postgresql/schema_dumper.rb +50 -0
- data/lib/active_record/connection_adapters/postgresql/schema_statements.rb +466 -280
- data/lib/active_record/connection_adapters/postgresql/type_metadata.rb +39 -0
- data/lib/active_record/connection_adapters/postgresql/utils.rb +12 -8
- data/lib/active_record/connection_adapters/postgresql_adapter.rb +439 -330
- data/lib/active_record/connection_adapters/schema_cache.rb +48 -24
- data/lib/active_record/connection_adapters/sql_type_metadata.rb +34 -0
- data/lib/active_record/connection_adapters/sqlite3/explain_pretty_printer.rb +21 -0
- data/lib/active_record/connection_adapters/sqlite3/quoting.rb +67 -0
- data/lib/active_record/connection_adapters/sqlite3/schema_creation.rb +17 -0
- data/lib/active_record/connection_adapters/sqlite3/schema_definitions.rb +19 -0
- data/lib/active_record/connection_adapters/sqlite3/schema_dumper.rb +18 -0
- data/lib/active_record/connection_adapters/sqlite3/schema_statements.rb +106 -0
- data/lib/active_record/connection_adapters/sqlite3_adapter.rb +269 -324
- data/lib/active_record/connection_adapters/statement_pool.rb +34 -13
- data/lib/active_record/connection_handling.rb +40 -27
- data/lib/active_record/core.rb +205 -202
- data/lib/active_record/counter_cache.rb +80 -37
- data/lib/active_record/define_callbacks.rb +22 -0
- data/lib/active_record/dynamic_matchers.rb +87 -105
- data/lib/active_record/enum.rb +136 -90
- data/lib/active_record/errors.rb +180 -52
- data/lib/active_record/explain.rb +23 -11
- data/lib/active_record/explain_registry.rb +4 -2
- data/lib/active_record/explain_subscriber.rb +11 -6
- data/lib/active_record/fixture_set/file.rb +35 -9
- data/lib/active_record/fixtures.rb +193 -135
- data/lib/active_record/gem_version.rb +5 -3
- data/lib/active_record/inheritance.rb +148 -112
- data/lib/active_record/integration.rb +70 -28
- data/lib/active_record/internal_metadata.rb +45 -0
- data/lib/active_record/legacy_yaml_adapter.rb +48 -0
- data/lib/active_record/locale/en.yml +3 -2
- data/lib/active_record/locking/optimistic.rb +92 -98
- data/lib/active_record/locking/pessimistic.rb +15 -3
- data/lib/active_record/log_subscriber.rb +95 -33
- data/lib/active_record/migration/command_recorder.rb +133 -90
- data/lib/active_record/migration/compatibility.rb +217 -0
- data/lib/active_record/migration/join_table.rb +8 -6
- data/lib/active_record/migration.rb +594 -267
- data/lib/active_record/model_schema.rb +292 -111
- data/lib/active_record/nested_attributes.rb +266 -214
- data/lib/active_record/no_touching.rb +8 -2
- data/lib/active_record/null_relation.rb +24 -37
- data/lib/active_record/persistence.rb +350 -119
- data/lib/active_record/query_cache.rb +13 -24
- data/lib/active_record/querying.rb +19 -17
- data/lib/active_record/railtie.rb +117 -35
- data/lib/active_record/railties/console_sandbox.rb +2 -0
- data/lib/active_record/railties/controller_runtime.rb +9 -3
- data/lib/active_record/railties/databases.rake +160 -174
- data/lib/active_record/readonly_attributes.rb +5 -4
- data/lib/active_record/reflection.rb +447 -288
- data/lib/active_record/relation/batches/batch_enumerator.rb +69 -0
- data/lib/active_record/relation/batches.rb +204 -55
- data/lib/active_record/relation/calculations.rb +259 -244
- data/lib/active_record/relation/delegation.rb +67 -60
- data/lib/active_record/relation/finder_methods.rb +290 -253
- data/lib/active_record/relation/from_clause.rb +26 -0
- data/lib/active_record/relation/merger.rb +91 -68
- data/lib/active_record/relation/predicate_builder/array_handler.rb +24 -23
- data/lib/active_record/relation/predicate_builder/association_query_value.rb +46 -0
- data/lib/active_record/relation/predicate_builder/base_handler.rb +19 -0
- data/lib/active_record/relation/predicate_builder/basic_object_handler.rb +20 -0
- data/lib/active_record/relation/predicate_builder/polymorphic_array_value.rb +56 -0
- data/lib/active_record/relation/predicate_builder/range_handler.rb +42 -0
- data/lib/active_record/relation/predicate_builder/relation_handler.rb +7 -1
- data/lib/active_record/relation/predicate_builder.rb +118 -92
- data/lib/active_record/relation/query_attribute.rb +45 -0
- data/lib/active_record/relation/query_methods.rb +446 -389
- data/lib/active_record/relation/record_fetch_warning.rb +51 -0
- data/lib/active_record/relation/spawn_methods.rb +18 -16
- data/lib/active_record/relation/where_clause.rb +186 -0
- data/lib/active_record/relation/where_clause_factory.rb +34 -0
- data/lib/active_record/relation.rb +287 -339
- data/lib/active_record/result.rb +54 -36
- data/lib/active_record/runtime_registry.rb +6 -4
- data/lib/active_record/sanitization.rb +155 -124
- data/lib/active_record/schema.rb +30 -24
- data/lib/active_record/schema_dumper.rb +91 -87
- data/lib/active_record/schema_migration.rb +19 -19
- data/lib/active_record/scoping/default.rb +102 -84
- data/lib/active_record/scoping/named.rb +81 -32
- data/lib/active_record/scoping.rb +45 -26
- data/lib/active_record/secure_token.rb +40 -0
- data/lib/active_record/serialization.rb +5 -5
- data/lib/active_record/statement_cache.rb +45 -35
- data/lib/active_record/store.rb +42 -36
- data/lib/active_record/suppressor.rb +61 -0
- data/lib/active_record/table_metadata.rb +82 -0
- data/lib/active_record/tasks/database_tasks.rb +136 -95
- data/lib/active_record/tasks/mysql_database_tasks.rb +59 -89
- data/lib/active_record/tasks/postgresql_database_tasks.rb +84 -31
- data/lib/active_record/tasks/sqlite_database_tasks.rb +44 -16
- data/lib/active_record/timestamp.rb +70 -38
- data/lib/active_record/touch_later.rb +64 -0
- data/lib/active_record/transactions.rb +208 -123
- data/lib/active_record/translation.rb +2 -0
- data/lib/active_record/type/adapter_specific_registry.rb +136 -0
- data/lib/active_record/type/date.rb +4 -41
- data/lib/active_record/type/date_time.rb +4 -38
- data/lib/active_record/type/decimal_without_scale.rb +6 -2
- data/lib/active_record/type/hash_lookup_type_map.rb +13 -5
- data/lib/active_record/type/internal/timezone.rb +17 -0
- data/lib/active_record/type/json.rb +30 -0
- data/lib/active_record/type/serialized.rb +30 -15
- data/lib/active_record/type/text.rb +2 -2
- data/lib/active_record/type/time.rb +11 -16
- data/lib/active_record/type/type_map.rb +15 -17
- data/lib/active_record/type/unsigned_integer.rb +9 -7
- data/lib/active_record/type.rb +79 -23
- data/lib/active_record/type_caster/connection.rb +33 -0
- data/lib/active_record/type_caster/map.rb +23 -0
- data/lib/active_record/type_caster.rb +9 -0
- data/lib/active_record/validations/absence.rb +25 -0
- data/lib/active_record/validations/associated.rb +13 -4
- data/lib/active_record/validations/length.rb +26 -0
- data/lib/active_record/validations/presence.rb +14 -13
- data/lib/active_record/validations/uniqueness.rb +41 -32
- data/lib/active_record/validations.rb +38 -35
- data/lib/active_record/version.rb +3 -1
- data/lib/active_record.rb +36 -21
- data/lib/rails/generators/active_record/application_record/application_record_generator.rb +27 -0
- data/lib/rails/generators/active_record/application_record/templates/application_record.rb.tt +5 -0
- data/lib/rails/generators/active_record/migration/migration_generator.rb +43 -35
- data/lib/rails/generators/active_record/migration/templates/{create_table_migration.rb → create_table_migration.rb.tt} +8 -6
- data/lib/rails/generators/active_record/migration/templates/{migration.rb → migration.rb.tt} +8 -7
- data/lib/rails/generators/active_record/migration.rb +18 -1
- data/lib/rails/generators/active_record/model/model_generator.rb +18 -22
- data/lib/rails/generators/active_record/model/templates/{model.rb → model.rb.tt} +3 -0
- data/lib/rails/generators/active_record.rb +7 -5
- metadata +77 -53
- data/lib/active_record/associations/preloader/belongs_to.rb +0 -17
- data/lib/active_record/associations/preloader/collection_association.rb +0 -24
- data/lib/active_record/associations/preloader/has_many.rb +0 -17
- data/lib/active_record/associations/preloader/has_many_through.rb +0 -19
- data/lib/active_record/associations/preloader/has_one.rb +0 -23
- data/lib/active_record/associations/preloader/has_one_through.rb +0 -9
- data/lib/active_record/associations/preloader/singular_association.rb +0 -21
- data/lib/active_record/attribute.rb +0 -149
- data/lib/active_record/attribute_set/builder.rb +0 -86
- data/lib/active_record/attribute_set.rb +0 -77
- data/lib/active_record/connection_adapters/mysql_adapter.rb +0 -491
- data/lib/active_record/connection_adapters/postgresql/array_parser.rb +0 -93
- data/lib/active_record/connection_adapters/postgresql/oid/float.rb +0 -21
- data/lib/active_record/connection_adapters/postgresql/oid/infinity.rb +0 -13
- data/lib/active_record/connection_adapters/postgresql/oid/json.rb +0 -35
- data/lib/active_record/connection_adapters/postgresql/oid/time.rb +0 -11
- data/lib/active_record/railties/jdbcmysql_error.rb +0 -16
- data/lib/active_record/serializers/xml_serializer.rb +0 -193
- data/lib/active_record/type/big_integer.rb +0 -13
- data/lib/active_record/type/binary.rb +0 -50
- data/lib/active_record/type/boolean.rb +0 -30
- data/lib/active_record/type/decimal.rb +0 -40
- data/lib/active_record/type/decorator.rb +0 -14
- data/lib/active_record/type/float.rb +0 -19
- data/lib/active_record/type/integer.rb +0 -55
- data/lib/active_record/type/mutable.rb +0 -16
- data/lib/active_record/type/numeric.rb +0 -36
- data/lib/active_record/type/string.rb +0 -36
- data/lib/active_record/type/time_value.rb +0 -38
- data/lib/active_record/type/value.rb +0 -101
- /data/lib/rails/generators/active_record/model/templates/{module.rb → module.rb.tt} +0 -0
@@ -1,63 +1,71 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "rails/generators/active_record"
|
2
4
|
|
3
5
|
module ActiveRecord
|
4
6
|
module Generators # :nodoc:
|
5
7
|
class MigrationGenerator < Base # :nodoc:
|
6
|
-
argument :attributes, :
|
8
|
+
argument :attributes, type: :array, default: [], banner: "field[:type][:index] field[:type][:index]"
|
9
|
+
|
10
|
+
class_option :primary_key_type, type: :string, desc: "The type for primary key"
|
7
11
|
|
8
12
|
def create_migration_file
|
9
13
|
set_local_assigns!
|
10
14
|
validate_file_name!
|
11
|
-
migration_template @migration_template, "
|
15
|
+
migration_template @migration_template, File.join(db_migrate_path, "#{file_name}.rb")
|
12
16
|
end
|
13
17
|
|
18
|
+
# TODO Change this to private once we've dropped Ruby 2.2 support.
|
19
|
+
# Workaround for Ruby 2.2 "private attribute?" warning.
|
14
20
|
protected
|
15
|
-
|
21
|
+
attr_reader :migration_action, :join_tables
|
16
22
|
|
17
|
-
|
18
|
-
# depending on the arguments which would be sent out in the command line, the migration template
|
19
|
-
# and the table name instance variables are setup.
|
23
|
+
private
|
20
24
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
@
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
@
|
30
|
-
|
25
|
+
# Sets the default migration template that is being used for the generation of the migration.
|
26
|
+
# Depending on command line arguments, the migration template and the table name instance
|
27
|
+
# variables are set up.
|
28
|
+
def set_local_assigns!
|
29
|
+
@migration_template = "migration.rb"
|
30
|
+
case file_name
|
31
|
+
when /^(add)_.*_to_(.*)/, /^(remove)_.*?_from_(.*)/
|
32
|
+
@migration_action = $1
|
33
|
+
@table_name = normalize_table_name($2)
|
34
|
+
when /join_table/
|
35
|
+
if attributes.length == 2
|
36
|
+
@migration_action = "join"
|
37
|
+
@join_tables = pluralize_table_names? ? attributes.map(&:plural_name) : attributes.map(&:singular_name)
|
31
38
|
|
32
|
-
|
39
|
+
set_index_names
|
40
|
+
end
|
41
|
+
when /^create_(.+)/
|
42
|
+
@table_name = normalize_table_name($1)
|
43
|
+
@migration_template = "create_table_migration.rb"
|
33
44
|
end
|
34
|
-
when /^create_(.+)/
|
35
|
-
@table_name = normalize_table_name($1)
|
36
|
-
@migration_template = "create_table_migration.rb"
|
37
45
|
end
|
38
|
-
end
|
39
46
|
|
40
|
-
|
41
|
-
|
42
|
-
|
47
|
+
def set_index_names
|
48
|
+
attributes.each_with_index do |attr, i|
|
49
|
+
attr.index_name = [attr, attributes[i - 1]].map { |a| index_name_for(a) }
|
50
|
+
end
|
43
51
|
end
|
44
|
-
end
|
45
52
|
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
+
def index_name_for(attribute)
|
54
|
+
if attribute.foreign_key?
|
55
|
+
attribute.name
|
56
|
+
else
|
57
|
+
attribute.name.singularize.foreign_key
|
58
|
+
end.to_sym
|
59
|
+
end
|
53
60
|
|
54
|
-
private
|
55
61
|
def attributes_with_index
|
56
62
|
attributes.select { |a| !a.reference? && a.has_index? }
|
57
63
|
end
|
58
64
|
|
65
|
+
# A migration file name can only contain underscores (_), lowercase characters,
|
66
|
+
# and numbers 0-9. Any other file name will raise an IllegalMigrationNameError.
|
59
67
|
def validate_file_name!
|
60
|
-
unless
|
68
|
+
unless /^[_a-z0-9]+$/.match?(file_name)
|
61
69
|
raise IllegalMigrationNameError.new(file_name)
|
62
70
|
end
|
63
71
|
end
|
@@ -1,22 +1,24 @@
|
|
1
|
-
class <%= migration_class_name %> < ActiveRecord::Migration
|
1
|
+
class <%= migration_class_name %> < ActiveRecord::Migration[<%= ActiveRecord::Migration.current_version %>]
|
2
2
|
def change
|
3
|
-
create_table :<%= table_name %> do |t|
|
3
|
+
create_table :<%= table_name %><%= primary_key_type %> do |t|
|
4
4
|
<% attributes.each do |attribute| -%>
|
5
5
|
<% if attribute.password_digest? -%>
|
6
6
|
t.string :password_digest<%= attribute.inject_options %>
|
7
|
+
<% elsif attribute.token? -%>
|
8
|
+
t.string :<%= attribute.name %><%= attribute.inject_options %>
|
7
9
|
<% else -%>
|
8
10
|
t.<%= attribute.type %> :<%= attribute.name %><%= attribute.inject_options %>
|
9
11
|
<% end -%>
|
10
12
|
<% end -%>
|
11
13
|
<% if options[:timestamps] %>
|
12
|
-
t.timestamps
|
14
|
+
t.timestamps
|
13
15
|
<% end -%>
|
14
16
|
end
|
17
|
+
<% attributes.select(&:token?).each do |attribute| -%>
|
18
|
+
add_index :<%= table_name %>, :<%= attribute.index_name %><%= attribute.inject_index_options %>, unique: true
|
19
|
+
<% end -%>
|
15
20
|
<% attributes_with_index.each do |attribute| -%>
|
16
21
|
add_index :<%= table_name %>, :<%= attribute.index_name %><%= attribute.inject_index_options %>
|
17
|
-
<% end -%>
|
18
|
-
<% attributes.select(&:reference?).reject(&:polymorphic?).each do |attribute| -%>
|
19
|
-
add_foreign_key :<%= table_name %>, :<%= attribute.name.pluralize %>
|
20
22
|
<% end -%>
|
21
23
|
end
|
22
24
|
end
|
data/lib/rails/generators/active_record/migration/templates/{migration.rb → migration.rb.tt}
RENAMED
@@ -1,12 +1,12 @@
|
|
1
|
-
class <%= migration_class_name %> < ActiveRecord::Migration
|
1
|
+
class <%= migration_class_name %> < ActiveRecord::Migration[<%= ActiveRecord::Migration.current_version %>]
|
2
2
|
<%- if migration_action == 'add' -%>
|
3
3
|
def change
|
4
4
|
<% attributes.each do |attribute| -%>
|
5
5
|
<%- if attribute.reference? -%>
|
6
6
|
add_reference :<%= table_name %>, :<%= attribute.name %><%= attribute.inject_options %>
|
7
|
-
|
8
|
-
|
9
|
-
|
7
|
+
<%- elsif attribute.token? -%>
|
8
|
+
add_column :<%= table_name %>, :<%= attribute.name %>, :string<%= attribute.inject_options %>
|
9
|
+
add_index :<%= table_name %>, :<%= attribute.index_name %><%= attribute.inject_index_options %>, unique: true
|
10
10
|
<%- else -%>
|
11
11
|
add_column :<%= table_name %>, :<%= attribute.name %>, :<%= attribute.type %><%= attribute.inject_options %>
|
12
12
|
<%- if attribute.has_index? -%>
|
@@ -19,7 +19,11 @@ class <%= migration_class_name %> < ActiveRecord::Migration
|
|
19
19
|
def change
|
20
20
|
create_join_table :<%= join_tables.first %>, :<%= join_tables.second %> do |t|
|
21
21
|
<%- attributes.each do |attribute| -%>
|
22
|
+
<%- if attribute.reference? -%>
|
23
|
+
t.references :<%= attribute.name %><%= attribute.inject_options %>
|
24
|
+
<%- else -%>
|
22
25
|
<%= '# ' unless attribute.has_index? -%>t.index <%= attribute.index_name %><%= attribute.inject_index_options %>
|
26
|
+
<%- end -%>
|
23
27
|
<%- end -%>
|
24
28
|
end
|
25
29
|
end
|
@@ -29,9 +33,6 @@ class <%= migration_class_name %> < ActiveRecord::Migration
|
|
29
33
|
<%- if migration_action -%>
|
30
34
|
<%- if attribute.reference? -%>
|
31
35
|
remove_reference :<%= table_name %>, :<%= attribute.name %><%= attribute.inject_options %>
|
32
|
-
<%- unless attribute.polymorphic? -%>
|
33
|
-
remove_foreign_key :<%= table_name %>, :<%= attribute.name.pluralize %>
|
34
|
-
<%- end -%>
|
35
36
|
<%- else -%>
|
36
37
|
<%- if attribute.has_index? -%>
|
37
38
|
remove_index :<%= table_name %>, :<%= attribute.index_name %><%= attribute.inject_index_options %>
|
@@ -1,4 +1,6 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "rails/generators/migration"
|
2
4
|
|
3
5
|
module ActiveRecord
|
4
6
|
module Generators # :nodoc:
|
@@ -13,6 +15,21 @@ module ActiveRecord
|
|
13
15
|
ActiveRecord::Migration.next_migration_number(next_migration_number)
|
14
16
|
end
|
15
17
|
end
|
18
|
+
|
19
|
+
private
|
20
|
+
|
21
|
+
def primary_key_type
|
22
|
+
key_type = options[:primary_key_type]
|
23
|
+
", id: :#{key_type}" if key_type
|
24
|
+
end
|
25
|
+
|
26
|
+
def db_migrate_path
|
27
|
+
if defined?(Rails.application) && Rails.application
|
28
|
+
Rails.application.config.paths["db/migrate"].to_ary.first
|
29
|
+
else
|
30
|
+
"db/migrate"
|
31
|
+
end
|
32
|
+
end
|
16
33
|
end
|
17
34
|
end
|
18
35
|
end
|
@@ -1,52 +1,48 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "rails/generators/active_record"
|
2
4
|
|
3
5
|
module ActiveRecord
|
4
6
|
module Generators # :nodoc:
|
5
7
|
class ModelGenerator < Base # :nodoc:
|
6
|
-
argument :attributes, :
|
8
|
+
argument :attributes, type: :array, default: [], banner: "field[:type][:index] field[:type][:index]"
|
7
9
|
|
8
10
|
check_class_collision
|
9
11
|
|
10
|
-
class_option :migration,
|
11
|
-
class_option :timestamps, :
|
12
|
-
class_option :parent,
|
13
|
-
class_option :indexes,
|
12
|
+
class_option :migration, type: :boolean
|
13
|
+
class_option :timestamps, type: :boolean
|
14
|
+
class_option :parent, type: :string, desc: "The parent class for the generated model"
|
15
|
+
class_option :indexes, type: :boolean, default: true, desc: "Add indexes for references and belongs_to columns"
|
16
|
+
class_option :primary_key_type, type: :string, desc: "The type for primary key"
|
14
17
|
|
15
|
-
|
16
18
|
# creates the migration file for the model.
|
17
|
-
|
18
19
|
def create_migration_file
|
19
20
|
return unless options[:migration] && options[:parent].nil?
|
20
21
|
attributes.each { |a| a.attr_options.delete(:index) if a.reference? && !a.has_index? } if options[:indexes] == false
|
21
|
-
migration_template "../../migration/templates/create_table_migration.rb", "
|
22
|
+
migration_template "../../migration/templates/create_table_migration.rb", File.join(db_migrate_path, "create_#{table_name}.rb")
|
22
23
|
end
|
23
24
|
|
24
25
|
def create_model_file
|
25
|
-
template
|
26
|
+
template "model.rb", File.join("app/models", class_path, "#{file_name}.rb")
|
26
27
|
end
|
27
28
|
|
28
29
|
def create_module_file
|
29
30
|
return if regular_class_path.empty?
|
30
|
-
template
|
31
|
-
end
|
32
|
-
|
33
|
-
def attributes_with_index
|
34
|
-
attributes.select { |a| !a.reference? && a.has_index? }
|
35
|
-
end
|
36
|
-
|
37
|
-
def accessible_attributes
|
38
|
-
attributes.reject(&:reference?)
|
31
|
+
template "module.rb", File.join("app/models", "#{class_path.join('/')}.rb") if behavior == :invoke
|
39
32
|
end
|
40
33
|
|
41
34
|
hook_for :test_framework
|
42
35
|
|
43
|
-
|
36
|
+
private
|
37
|
+
|
38
|
+
def attributes_with_index
|
39
|
+
attributes.select { |a| !a.reference? && a.has_index? }
|
40
|
+
end
|
44
41
|
|
45
42
|
# Used by the migration template to determine the parent name of the model
|
46
43
|
def parent_class_name
|
47
|
-
options[:parent] || "
|
44
|
+
options[:parent] || "ApplicationRecord"
|
48
45
|
end
|
49
|
-
|
50
46
|
end
|
51
47
|
end
|
52
48
|
end
|
@@ -3,6 +3,9 @@ class <%= class_name %> < <%= parent_class_name.classify %>
|
|
3
3
|
<% attributes.select(&:reference?).each do |attribute| -%>
|
4
4
|
belongs_to :<%= attribute.name %><%= ', polymorphic: true' if attribute.polymorphic? %><%= ', required: true' if attribute.required? %>
|
5
5
|
<% end -%>
|
6
|
+
<% attributes.select(&:token?).each do |attribute| -%>
|
7
|
+
has_secure_token<% if attribute.name != "token" %> :<%= attribute.name %><% end %>
|
8
|
+
<% end -%>
|
6
9
|
<% if attributes.any?(&:password_digest?) -%>
|
7
10
|
has_secure_password
|
8
11
|
<% end -%>
|
@@ -1,7 +1,9 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
require
|
4
|
-
require
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "rails/generators/named_base"
|
4
|
+
require "rails/generators/active_model"
|
5
|
+
require "rails/generators/active_record/migration"
|
6
|
+
require "active_record"
|
5
7
|
|
6
8
|
module ActiveRecord
|
7
9
|
module Generators # :nodoc:
|
@@ -10,7 +12,7 @@ module ActiveRecord
|
|
10
12
|
|
11
13
|
# Set the current directory as base for the inherited generators.
|
12
14
|
def self.base_root
|
13
|
-
|
15
|
+
__dir__
|
14
16
|
end
|
15
17
|
end
|
16
18
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activerecord
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 5.2.8.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Heinemeier Hansson
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-07-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -16,42 +16,42 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - '='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 5.2.8.1
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - '='
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: 5.2.8.1
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: activemodel
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - '='
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
33
|
+
version: 5.2.8.1
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - '='
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version:
|
40
|
+
version: 5.2.8.1
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: arel
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - "
|
45
|
+
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
47
|
+
version: '9.0'
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - "
|
52
|
+
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
54
|
+
version: '9.0'
|
55
55
|
description: Databases on Rails. Build a persistent domain model by mapping database
|
56
56
|
tables to Ruby classes. Strong conventions for associations, validations, aggregations,
|
57
57
|
migrations, and testing come baked-in.
|
@@ -84,6 +84,7 @@ files:
|
|
84
84
|
- lib/active_record/associations/builder/singular_association.rb
|
85
85
|
- lib/active_record/associations/collection_association.rb
|
86
86
|
- lib/active_record/associations/collection_proxy.rb
|
87
|
+
- lib/active_record/associations/foreign_association.rb
|
87
88
|
- lib/active_record/associations/has_many_association.rb
|
88
89
|
- lib/active_record/associations/has_many_through_association.rb
|
89
90
|
- lib/active_record/associations/has_one_association.rb
|
@@ -94,17 +95,9 @@ files:
|
|
94
95
|
- lib/active_record/associations/join_dependency/join_part.rb
|
95
96
|
- lib/active_record/associations/preloader.rb
|
96
97
|
- lib/active_record/associations/preloader/association.rb
|
97
|
-
- lib/active_record/associations/preloader/belongs_to.rb
|
98
|
-
- lib/active_record/associations/preloader/collection_association.rb
|
99
|
-
- lib/active_record/associations/preloader/has_many.rb
|
100
|
-
- lib/active_record/associations/preloader/has_many_through.rb
|
101
|
-
- lib/active_record/associations/preloader/has_one.rb
|
102
|
-
- lib/active_record/associations/preloader/has_one_through.rb
|
103
|
-
- lib/active_record/associations/preloader/singular_association.rb
|
104
98
|
- lib/active_record/associations/preloader/through_association.rb
|
105
99
|
- lib/active_record/associations/singular_association.rb
|
106
100
|
- lib/active_record/associations/through_association.rb
|
107
|
-
- lib/active_record/attribute.rb
|
108
101
|
- lib/active_record/attribute_assignment.rb
|
109
102
|
- lib/active_record/attribute_decorators.rb
|
110
103
|
- lib/active_record/attribute_methods.rb
|
@@ -116,14 +109,13 @@ files:
|
|
116
109
|
- lib/active_record/attribute_methods/serialization.rb
|
117
110
|
- lib/active_record/attribute_methods/time_zone_conversion.rb
|
118
111
|
- lib/active_record/attribute_methods/write.rb
|
119
|
-
- lib/active_record/attribute_set.rb
|
120
|
-
- lib/active_record/attribute_set/builder.rb
|
121
112
|
- lib/active_record/attributes.rb
|
122
113
|
- lib/active_record/autosave_association.rb
|
123
114
|
- lib/active_record/base.rb
|
124
115
|
- lib/active_record/callbacks.rb
|
125
116
|
- lib/active_record/coders/json.rb
|
126
117
|
- lib/active_record/coders/yaml_column.rb
|
118
|
+
- lib/active_record/collection_cache_key.rb
|
127
119
|
- lib/active_record/connection_adapters/abstract/connection_pool.rb
|
128
120
|
- lib/active_record/connection_adapters/abstract/database_limits.rb
|
129
121
|
- lib/active_record/connection_adapters/abstract/database_statements.rb
|
@@ -139,11 +131,20 @@ files:
|
|
139
131
|
- lib/active_record/connection_adapters/abstract_mysql_adapter.rb
|
140
132
|
- lib/active_record/connection_adapters/column.rb
|
141
133
|
- lib/active_record/connection_adapters/connection_specification.rb
|
134
|
+
- lib/active_record/connection_adapters/determine_if_preparable_visitor.rb
|
135
|
+
- lib/active_record/connection_adapters/mysql/column.rb
|
136
|
+
- lib/active_record/connection_adapters/mysql/database_statements.rb
|
137
|
+
- lib/active_record/connection_adapters/mysql/explain_pretty_printer.rb
|
138
|
+
- lib/active_record/connection_adapters/mysql/quoting.rb
|
139
|
+
- lib/active_record/connection_adapters/mysql/schema_creation.rb
|
140
|
+
- lib/active_record/connection_adapters/mysql/schema_definitions.rb
|
141
|
+
- lib/active_record/connection_adapters/mysql/schema_dumper.rb
|
142
|
+
- lib/active_record/connection_adapters/mysql/schema_statements.rb
|
143
|
+
- lib/active_record/connection_adapters/mysql/type_metadata.rb
|
142
144
|
- lib/active_record/connection_adapters/mysql2_adapter.rb
|
143
|
-
- lib/active_record/connection_adapters/mysql_adapter.rb
|
144
|
-
- lib/active_record/connection_adapters/postgresql/array_parser.rb
|
145
145
|
- lib/active_record/connection_adapters/postgresql/column.rb
|
146
146
|
- lib/active_record/connection_adapters/postgresql/database_statements.rb
|
147
|
+
- lib/active_record/connection_adapters/postgresql/explain_pretty_printer.rb
|
147
148
|
- lib/active_record/connection_adapters/postgresql/oid.rb
|
148
149
|
- lib/active_record/connection_adapters/postgresql/oid/array.rb
|
149
150
|
- lib/active_record/connection_adapters/postgresql/oid/bit.rb
|
@@ -154,34 +155,42 @@ files:
|
|
154
155
|
- lib/active_record/connection_adapters/postgresql/oid/date_time.rb
|
155
156
|
- lib/active_record/connection_adapters/postgresql/oid/decimal.rb
|
156
157
|
- lib/active_record/connection_adapters/postgresql/oid/enum.rb
|
157
|
-
- lib/active_record/connection_adapters/postgresql/oid/float.rb
|
158
158
|
- lib/active_record/connection_adapters/postgresql/oid/hstore.rb
|
159
159
|
- lib/active_record/connection_adapters/postgresql/oid/inet.rb
|
160
|
-
- lib/active_record/connection_adapters/postgresql/oid/infinity.rb
|
161
|
-
- lib/active_record/connection_adapters/postgresql/oid/integer.rb
|
162
|
-
- lib/active_record/connection_adapters/postgresql/oid/json.rb
|
163
160
|
- lib/active_record/connection_adapters/postgresql/oid/jsonb.rb
|
161
|
+
- lib/active_record/connection_adapters/postgresql/oid/legacy_point.rb
|
164
162
|
- lib/active_record/connection_adapters/postgresql/oid/money.rb
|
163
|
+
- lib/active_record/connection_adapters/postgresql/oid/oid.rb
|
165
164
|
- lib/active_record/connection_adapters/postgresql/oid/point.rb
|
166
165
|
- lib/active_record/connection_adapters/postgresql/oid/range.rb
|
167
166
|
- lib/active_record/connection_adapters/postgresql/oid/specialized_string.rb
|
168
|
-
- lib/active_record/connection_adapters/postgresql/oid/time.rb
|
169
167
|
- lib/active_record/connection_adapters/postgresql/oid/type_map_initializer.rb
|
170
168
|
- lib/active_record/connection_adapters/postgresql/oid/uuid.rb
|
171
169
|
- lib/active_record/connection_adapters/postgresql/oid/vector.rb
|
172
170
|
- lib/active_record/connection_adapters/postgresql/oid/xml.rb
|
173
171
|
- lib/active_record/connection_adapters/postgresql/quoting.rb
|
174
172
|
- lib/active_record/connection_adapters/postgresql/referential_integrity.rb
|
173
|
+
- lib/active_record/connection_adapters/postgresql/schema_creation.rb
|
175
174
|
- lib/active_record/connection_adapters/postgresql/schema_definitions.rb
|
175
|
+
- lib/active_record/connection_adapters/postgresql/schema_dumper.rb
|
176
176
|
- lib/active_record/connection_adapters/postgresql/schema_statements.rb
|
177
|
+
- lib/active_record/connection_adapters/postgresql/type_metadata.rb
|
177
178
|
- lib/active_record/connection_adapters/postgresql/utils.rb
|
178
179
|
- lib/active_record/connection_adapters/postgresql_adapter.rb
|
179
180
|
- lib/active_record/connection_adapters/schema_cache.rb
|
181
|
+
- lib/active_record/connection_adapters/sql_type_metadata.rb
|
182
|
+
- lib/active_record/connection_adapters/sqlite3/explain_pretty_printer.rb
|
183
|
+
- lib/active_record/connection_adapters/sqlite3/quoting.rb
|
184
|
+
- lib/active_record/connection_adapters/sqlite3/schema_creation.rb
|
185
|
+
- lib/active_record/connection_adapters/sqlite3/schema_definitions.rb
|
186
|
+
- lib/active_record/connection_adapters/sqlite3/schema_dumper.rb
|
187
|
+
- lib/active_record/connection_adapters/sqlite3/schema_statements.rb
|
180
188
|
- lib/active_record/connection_adapters/sqlite3_adapter.rb
|
181
189
|
- lib/active_record/connection_adapters/statement_pool.rb
|
182
190
|
- lib/active_record/connection_handling.rb
|
183
191
|
- lib/active_record/core.rb
|
184
192
|
- lib/active_record/counter_cache.rb
|
193
|
+
- lib/active_record/define_callbacks.rb
|
185
194
|
- lib/active_record/dynamic_matchers.rb
|
186
195
|
- lib/active_record/enum.rb
|
187
196
|
- lib/active_record/errors.rb
|
@@ -193,12 +202,15 @@ files:
|
|
193
202
|
- lib/active_record/gem_version.rb
|
194
203
|
- lib/active_record/inheritance.rb
|
195
204
|
- lib/active_record/integration.rb
|
205
|
+
- lib/active_record/internal_metadata.rb
|
206
|
+
- lib/active_record/legacy_yaml_adapter.rb
|
196
207
|
- lib/active_record/locale/en.yml
|
197
208
|
- lib/active_record/locking/optimistic.rb
|
198
209
|
- lib/active_record/locking/pessimistic.rb
|
199
210
|
- lib/active_record/log_subscriber.rb
|
200
211
|
- lib/active_record/migration.rb
|
201
212
|
- lib/active_record/migration/command_recorder.rb
|
213
|
+
- lib/active_record/migration/compatibility.rb
|
202
214
|
- lib/active_record/migration/join_table.rb
|
203
215
|
- lib/active_record/model_schema.rb
|
204
216
|
- lib/active_record/nested_attributes.rb
|
@@ -211,20 +223,30 @@ files:
|
|
211
223
|
- lib/active_record/railties/console_sandbox.rb
|
212
224
|
- lib/active_record/railties/controller_runtime.rb
|
213
225
|
- lib/active_record/railties/databases.rake
|
214
|
-
- lib/active_record/railties/jdbcmysql_error.rb
|
215
226
|
- lib/active_record/readonly_attributes.rb
|
216
227
|
- lib/active_record/reflection.rb
|
217
228
|
- lib/active_record/relation.rb
|
218
229
|
- lib/active_record/relation/batches.rb
|
230
|
+
- lib/active_record/relation/batches/batch_enumerator.rb
|
219
231
|
- lib/active_record/relation/calculations.rb
|
220
232
|
- lib/active_record/relation/delegation.rb
|
221
233
|
- lib/active_record/relation/finder_methods.rb
|
234
|
+
- lib/active_record/relation/from_clause.rb
|
222
235
|
- lib/active_record/relation/merger.rb
|
223
236
|
- lib/active_record/relation/predicate_builder.rb
|
224
237
|
- lib/active_record/relation/predicate_builder/array_handler.rb
|
238
|
+
- lib/active_record/relation/predicate_builder/association_query_value.rb
|
239
|
+
- lib/active_record/relation/predicate_builder/base_handler.rb
|
240
|
+
- lib/active_record/relation/predicate_builder/basic_object_handler.rb
|
241
|
+
- lib/active_record/relation/predicate_builder/polymorphic_array_value.rb
|
242
|
+
- lib/active_record/relation/predicate_builder/range_handler.rb
|
225
243
|
- lib/active_record/relation/predicate_builder/relation_handler.rb
|
244
|
+
- lib/active_record/relation/query_attribute.rb
|
226
245
|
- lib/active_record/relation/query_methods.rb
|
246
|
+
- lib/active_record/relation/record_fetch_warning.rb
|
227
247
|
- lib/active_record/relation/spawn_methods.rb
|
248
|
+
- lib/active_record/relation/where_clause.rb
|
249
|
+
- lib/active_record/relation/where_clause_factory.rb
|
228
250
|
- lib/active_record/result.rb
|
229
251
|
- lib/active_record/runtime_registry.rb
|
230
252
|
- lib/active_record/sanitization.rb
|
@@ -234,57 +256,60 @@ files:
|
|
234
256
|
- lib/active_record/scoping.rb
|
235
257
|
- lib/active_record/scoping/default.rb
|
236
258
|
- lib/active_record/scoping/named.rb
|
259
|
+
- lib/active_record/secure_token.rb
|
237
260
|
- lib/active_record/serialization.rb
|
238
|
-
- lib/active_record/serializers/xml_serializer.rb
|
239
261
|
- lib/active_record/statement_cache.rb
|
240
262
|
- lib/active_record/store.rb
|
263
|
+
- lib/active_record/suppressor.rb
|
264
|
+
- lib/active_record/table_metadata.rb
|
241
265
|
- lib/active_record/tasks/database_tasks.rb
|
242
266
|
- lib/active_record/tasks/mysql_database_tasks.rb
|
243
267
|
- lib/active_record/tasks/postgresql_database_tasks.rb
|
244
268
|
- lib/active_record/tasks/sqlite_database_tasks.rb
|
245
269
|
- lib/active_record/timestamp.rb
|
270
|
+
- lib/active_record/touch_later.rb
|
246
271
|
- lib/active_record/transactions.rb
|
247
272
|
- lib/active_record/translation.rb
|
248
273
|
- lib/active_record/type.rb
|
249
|
-
- lib/active_record/type/
|
250
|
-
- lib/active_record/type/binary.rb
|
251
|
-
- lib/active_record/type/boolean.rb
|
274
|
+
- lib/active_record/type/adapter_specific_registry.rb
|
252
275
|
- lib/active_record/type/date.rb
|
253
276
|
- lib/active_record/type/date_time.rb
|
254
|
-
- lib/active_record/type/decimal.rb
|
255
277
|
- lib/active_record/type/decimal_without_scale.rb
|
256
|
-
- lib/active_record/type/decorator.rb
|
257
|
-
- lib/active_record/type/float.rb
|
258
278
|
- lib/active_record/type/hash_lookup_type_map.rb
|
259
|
-
- lib/active_record/type/
|
260
|
-
- lib/active_record/type/
|
261
|
-
- lib/active_record/type/numeric.rb
|
279
|
+
- lib/active_record/type/internal/timezone.rb
|
280
|
+
- lib/active_record/type/json.rb
|
262
281
|
- lib/active_record/type/serialized.rb
|
263
|
-
- lib/active_record/type/string.rb
|
264
282
|
- lib/active_record/type/text.rb
|
265
283
|
- lib/active_record/type/time.rb
|
266
|
-
- lib/active_record/type/time_value.rb
|
267
284
|
- lib/active_record/type/type_map.rb
|
268
285
|
- lib/active_record/type/unsigned_integer.rb
|
269
|
-
- lib/active_record/
|
286
|
+
- lib/active_record/type_caster.rb
|
287
|
+
- lib/active_record/type_caster/connection.rb
|
288
|
+
- lib/active_record/type_caster/map.rb
|
270
289
|
- lib/active_record/validations.rb
|
290
|
+
- lib/active_record/validations/absence.rb
|
271
291
|
- lib/active_record/validations/associated.rb
|
292
|
+
- lib/active_record/validations/length.rb
|
272
293
|
- lib/active_record/validations/presence.rb
|
273
294
|
- lib/active_record/validations/uniqueness.rb
|
274
295
|
- lib/active_record/version.rb
|
275
296
|
- lib/rails/generators/active_record.rb
|
297
|
+
- lib/rails/generators/active_record/application_record/application_record_generator.rb
|
298
|
+
- lib/rails/generators/active_record/application_record/templates/application_record.rb.tt
|
276
299
|
- lib/rails/generators/active_record/migration.rb
|
277
300
|
- lib/rails/generators/active_record/migration/migration_generator.rb
|
278
|
-
- lib/rails/generators/active_record/migration/templates/create_table_migration.rb
|
279
|
-
- lib/rails/generators/active_record/migration/templates/migration.rb
|
301
|
+
- lib/rails/generators/active_record/migration/templates/create_table_migration.rb.tt
|
302
|
+
- lib/rails/generators/active_record/migration/templates/migration.rb.tt
|
280
303
|
- lib/rails/generators/active_record/model/model_generator.rb
|
281
|
-
- lib/rails/generators/active_record/model/templates/model.rb
|
282
|
-
- lib/rails/generators/active_record/model/templates/module.rb
|
283
|
-
homepage: http://
|
304
|
+
- lib/rails/generators/active_record/model/templates/model.rb.tt
|
305
|
+
- lib/rails/generators/active_record/model/templates/module.rb.tt
|
306
|
+
homepage: http://rubyonrails.org
|
284
307
|
licenses:
|
285
308
|
- MIT
|
286
|
-
metadata:
|
287
|
-
|
309
|
+
metadata:
|
310
|
+
source_code_uri: https://github.com/rails/rails/tree/v5.2.8.1/activerecord
|
311
|
+
changelog_uri: https://github.com/rails/rails/blob/v5.2.8.1/activerecord/CHANGELOG.md
|
312
|
+
post_install_message:
|
288
313
|
rdoc_options:
|
289
314
|
- "--main"
|
290
315
|
- README.rdoc
|
@@ -294,16 +319,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
294
319
|
requirements:
|
295
320
|
- - ">="
|
296
321
|
- !ruby/object:Gem::Version
|
297
|
-
version:
|
322
|
+
version: 2.2.2
|
298
323
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
299
324
|
requirements:
|
300
325
|
- - ">="
|
301
326
|
- !ruby/object:Gem::Version
|
302
327
|
version: '0'
|
303
328
|
requirements: []
|
304
|
-
|
305
|
-
|
306
|
-
signing_key:
|
329
|
+
rubygems_version: 3.3.3
|
330
|
+
signing_key:
|
307
331
|
specification_version: 4
|
308
332
|
summary: Object-relational mapper framework (part of Rails).
|
309
333
|
test_files: []
|