activerecord 5.2.3
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 +7 -0
- data/CHANGELOG.md +937 -0
- data/MIT-LICENSE +20 -0
- data/README.rdoc +217 -0
- data/examples/performance.rb +185 -0
- data/examples/simple.rb +15 -0
- data/lib/active_record.rb +188 -0
- data/lib/active_record/aggregations.rb +283 -0
- data/lib/active_record/association_relation.rb +40 -0
- data/lib/active_record/associations.rb +1860 -0
- data/lib/active_record/associations/alias_tracker.rb +81 -0
- data/lib/active_record/associations/association.rb +299 -0
- data/lib/active_record/associations/association_scope.rb +168 -0
- data/lib/active_record/associations/belongs_to_association.rb +130 -0
- data/lib/active_record/associations/belongs_to_polymorphic_association.rb +40 -0
- data/lib/active_record/associations/builder/association.rb +140 -0
- data/lib/active_record/associations/builder/belongs_to.rb +163 -0
- data/lib/active_record/associations/builder/collection_association.rb +82 -0
- data/lib/active_record/associations/builder/has_and_belongs_to_many.rb +135 -0
- data/lib/active_record/associations/builder/has_many.rb +17 -0
- data/lib/active_record/associations/builder/has_one.rb +30 -0
- data/lib/active_record/associations/builder/singular_association.rb +42 -0
- data/lib/active_record/associations/collection_association.rb +513 -0
- data/lib/active_record/associations/collection_proxy.rb +1131 -0
- data/lib/active_record/associations/foreign_association.rb +13 -0
- data/lib/active_record/associations/has_many_association.rb +144 -0
- data/lib/active_record/associations/has_many_through_association.rb +227 -0
- data/lib/active_record/associations/has_one_association.rb +120 -0
- data/lib/active_record/associations/has_one_through_association.rb +45 -0
- data/lib/active_record/associations/join_dependency.rb +262 -0
- data/lib/active_record/associations/join_dependency/join_association.rb +60 -0
- data/lib/active_record/associations/join_dependency/join_base.rb +23 -0
- data/lib/active_record/associations/join_dependency/join_part.rb +71 -0
- data/lib/active_record/associations/preloader.rb +193 -0
- data/lib/active_record/associations/preloader/association.rb +131 -0
- data/lib/active_record/associations/preloader/through_association.rb +107 -0
- data/lib/active_record/associations/singular_association.rb +73 -0
- data/lib/active_record/associations/through_association.rb +121 -0
- data/lib/active_record/attribute_assignment.rb +88 -0
- data/lib/active_record/attribute_decorators.rb +90 -0
- data/lib/active_record/attribute_methods.rb +492 -0
- data/lib/active_record/attribute_methods/before_type_cast.rb +78 -0
- data/lib/active_record/attribute_methods/dirty.rb +150 -0
- data/lib/active_record/attribute_methods/primary_key.rb +143 -0
- data/lib/active_record/attribute_methods/query.rb +42 -0
- data/lib/active_record/attribute_methods/read.rb +85 -0
- data/lib/active_record/attribute_methods/serialization.rb +90 -0
- data/lib/active_record/attribute_methods/time_zone_conversion.rb +91 -0
- data/lib/active_record/attribute_methods/write.rb +68 -0
- data/lib/active_record/attributes.rb +266 -0
- data/lib/active_record/autosave_association.rb +498 -0
- data/lib/active_record/base.rb +329 -0
- data/lib/active_record/callbacks.rb +353 -0
- data/lib/active_record/coders/json.rb +15 -0
- data/lib/active_record/coders/yaml_column.rb +50 -0
- data/lib/active_record/collection_cache_key.rb +53 -0
- data/lib/active_record/connection_adapters/abstract/connection_pool.rb +1068 -0
- data/lib/active_record/connection_adapters/abstract/database_limits.rb +72 -0
- data/lib/active_record/connection_adapters/abstract/database_statements.rb +540 -0
- data/lib/active_record/connection_adapters/abstract/query_cache.rb +145 -0
- data/lib/active_record/connection_adapters/abstract/quoting.rb +200 -0
- data/lib/active_record/connection_adapters/abstract/savepoints.rb +23 -0
- data/lib/active_record/connection_adapters/abstract/schema_creation.rb +146 -0
- data/lib/active_record/connection_adapters/abstract/schema_definitions.rb +685 -0
- data/lib/active_record/connection_adapters/abstract/schema_dumper.rb +95 -0
- data/lib/active_record/connection_adapters/abstract/schema_statements.rb +1396 -0
- data/lib/active_record/connection_adapters/abstract/transaction.rb +283 -0
- data/lib/active_record/connection_adapters/abstract_adapter.rb +628 -0
- data/lib/active_record/connection_adapters/abstract_mysql_adapter.rb +887 -0
- data/lib/active_record/connection_adapters/column.rb +91 -0
- data/lib/active_record/connection_adapters/connection_specification.rb +287 -0
- 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 +129 -0
- data/lib/active_record/connection_adapters/postgresql/column.rb +44 -0
- data/lib/active_record/connection_adapters/postgresql/database_statements.rb +163 -0
- data/lib/active_record/connection_adapters/postgresql/explain_pretty_printer.rb +44 -0
- data/lib/active_record/connection_adapters/postgresql/oid.rb +34 -0
- data/lib/active_record/connection_adapters/postgresql/oid/array.rb +92 -0
- data/lib/active_record/connection_adapters/postgresql/oid/bit.rb +56 -0
- data/lib/active_record/connection_adapters/postgresql/oid/bit_varying.rb +15 -0
- data/lib/active_record/connection_adapters/postgresql/oid/bytea.rb +17 -0
- data/lib/active_record/connection_adapters/postgresql/oid/cidr.rb +50 -0
- data/lib/active_record/connection_adapters/postgresql/oid/date.rb +23 -0
- data/lib/active_record/connection_adapters/postgresql/oid/date_time.rb +23 -0
- data/lib/active_record/connection_adapters/postgresql/oid/decimal.rb +15 -0
- data/lib/active_record/connection_adapters/postgresql/oid/enum.rb +21 -0
- data/lib/active_record/connection_adapters/postgresql/oid/hstore.rb +71 -0
- data/lib/active_record/connection_adapters/postgresql/oid/inet.rb +15 -0
- data/lib/active_record/connection_adapters/postgresql/oid/jsonb.rb +15 -0
- data/lib/active_record/connection_adapters/postgresql/oid/legacy_point.rb +45 -0
- data/lib/active_record/connection_adapters/postgresql/oid/money.rb +41 -0
- data/lib/active_record/connection_adapters/postgresql/oid/oid.rb +15 -0
- data/lib/active_record/connection_adapters/postgresql/oid/point.rb +65 -0
- data/lib/active_record/connection_adapters/postgresql/oid/range.rb +97 -0
- data/lib/active_record/connection_adapters/postgresql/oid/specialized_string.rb +18 -0
- data/lib/active_record/connection_adapters/postgresql/oid/type_map_initializer.rb +111 -0
- data/lib/active_record/connection_adapters/postgresql/oid/uuid.rb +23 -0
- data/lib/active_record/connection_adapters/postgresql/oid/vector.rb +28 -0
- data/lib/active_record/connection_adapters/postgresql/oid/xml.rb +30 -0
- data/lib/active_record/connection_adapters/postgresql/quoting.rb +168 -0
- data/lib/active_record/connection_adapters/postgresql/referential_integrity.rb +43 -0
- data/lib/active_record/connection_adapters/postgresql/schema_creation.rb +65 -0
- data/lib/active_record/connection_adapters/postgresql/schema_definitions.rb +206 -0
- data/lib/active_record/connection_adapters/postgresql/schema_dumper.rb +50 -0
- data/lib/active_record/connection_adapters/postgresql/schema_statements.rb +774 -0
- data/lib/active_record/connection_adapters/postgresql/type_metadata.rb +39 -0
- data/lib/active_record/connection_adapters/postgresql/utils.rb +81 -0
- data/lib/active_record/connection_adapters/postgresql_adapter.rb +863 -0
- data/lib/active_record/connection_adapters/schema_cache.rb +118 -0
- 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 +573 -0
- data/lib/active_record/connection_adapters/statement_pool.rb +61 -0
- data/lib/active_record/connection_handling.rb +145 -0
- data/lib/active_record/core.rb +559 -0
- data/lib/active_record/counter_cache.rb +218 -0
- data/lib/active_record/define_callbacks.rb +22 -0
- data/lib/active_record/dynamic_matchers.rb +122 -0
- data/lib/active_record/enum.rb +244 -0
- data/lib/active_record/errors.rb +380 -0
- data/lib/active_record/explain.rb +50 -0
- data/lib/active_record/explain_registry.rb +32 -0
- data/lib/active_record/explain_subscriber.rb +34 -0
- data/lib/active_record/fixture_set/file.rb +82 -0
- data/lib/active_record/fixtures.rb +1065 -0
- data/lib/active_record/gem_version.rb +17 -0
- data/lib/active_record/inheritance.rb +283 -0
- data/lib/active_record/integration.rb +155 -0
- 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 +48 -0
- data/lib/active_record/locking/optimistic.rb +198 -0
- data/lib/active_record/locking/pessimistic.rb +89 -0
- data/lib/active_record/log_subscriber.rb +137 -0
- data/lib/active_record/migration.rb +1378 -0
- data/lib/active_record/migration/command_recorder.rb +240 -0
- data/lib/active_record/migration/compatibility.rb +217 -0
- data/lib/active_record/migration/join_table.rb +17 -0
- data/lib/active_record/model_schema.rb +521 -0
- data/lib/active_record/nested_attributes.rb +600 -0
- data/lib/active_record/no_touching.rb +58 -0
- data/lib/active_record/null_relation.rb +68 -0
- data/lib/active_record/persistence.rb +763 -0
- data/lib/active_record/query_cache.rb +45 -0
- data/lib/active_record/querying.rb +70 -0
- data/lib/active_record/railtie.rb +226 -0
- data/lib/active_record/railties/console_sandbox.rb +7 -0
- data/lib/active_record/railties/controller_runtime.rb +56 -0
- data/lib/active_record/railties/databases.rake +377 -0
- data/lib/active_record/readonly_attributes.rb +24 -0
- data/lib/active_record/reflection.rb +1044 -0
- data/lib/active_record/relation.rb +629 -0
- data/lib/active_record/relation/batches.rb +287 -0
- data/lib/active_record/relation/batches/batch_enumerator.rb +69 -0
- data/lib/active_record/relation/calculations.rb +417 -0
- data/lib/active_record/relation/delegation.rb +147 -0
- data/lib/active_record/relation/finder_methods.rb +565 -0
- data/lib/active_record/relation/from_clause.rb +26 -0
- data/lib/active_record/relation/merger.rb +193 -0
- data/lib/active_record/relation/predicate_builder.rb +152 -0
- data/lib/active_record/relation/predicate_builder/array_handler.rb +48 -0
- 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 +19 -0
- data/lib/active_record/relation/query_attribute.rb +45 -0
- data/lib/active_record/relation/query_methods.rb +1231 -0
- data/lib/active_record/relation/record_fetch_warning.rb +51 -0
- data/lib/active_record/relation/spawn_methods.rb +77 -0
- 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/result.rb +149 -0
- data/lib/active_record/runtime_registry.rb +24 -0
- data/lib/active_record/sanitization.rb +222 -0
- data/lib/active_record/schema.rb +70 -0
- data/lib/active_record/schema_dumper.rb +255 -0
- data/lib/active_record/schema_migration.rb +56 -0
- data/lib/active_record/scoping.rb +106 -0
- data/lib/active_record/scoping/default.rb +152 -0
- data/lib/active_record/scoping/named.rb +213 -0
- data/lib/active_record/secure_token.rb +40 -0
- data/lib/active_record/serialization.rb +22 -0
- data/lib/active_record/statement_cache.rb +121 -0
- data/lib/active_record/store.rb +211 -0
- 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 +337 -0
- data/lib/active_record/tasks/mysql_database_tasks.rb +115 -0
- data/lib/active_record/tasks/postgresql_database_tasks.rb +143 -0
- data/lib/active_record/tasks/sqlite_database_tasks.rb +83 -0
- data/lib/active_record/timestamp.rb +153 -0
- data/lib/active_record/touch_later.rb +64 -0
- data/lib/active_record/transactions.rb +502 -0
- data/lib/active_record/translation.rb +24 -0
- data/lib/active_record/type.rb +79 -0
- data/lib/active_record/type/adapter_specific_registry.rb +136 -0
- data/lib/active_record/type/date.rb +9 -0
- data/lib/active_record/type/date_time.rb +9 -0
- data/lib/active_record/type/decimal_without_scale.rb +15 -0
- data/lib/active_record/type/hash_lookup_type_map.rb +25 -0
- 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 +71 -0
- data/lib/active_record/type/text.rb +11 -0
- data/lib/active_record/type/time.rb +21 -0
- data/lib/active_record/type/type_map.rb +62 -0
- data/lib/active_record/type/unsigned_integer.rb +17 -0
- data/lib/active_record/type_caster.rb +9 -0
- data/lib/active_record/type_caster/connection.rb +33 -0
- data/lib/active_record/type_caster/map.rb +23 -0
- data/lib/active_record/validations.rb +93 -0
- data/lib/active_record/validations/absence.rb +25 -0
- data/lib/active_record/validations/associated.rb +60 -0
- data/lib/active_record/validations/length.rb +26 -0
- data/lib/active_record/validations/presence.rb +68 -0
- data/lib/active_record/validations/uniqueness.rb +238 -0
- data/lib/active_record/version.rb +10 -0
- data/lib/rails/generators/active_record.rb +19 -0
- 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.rb +35 -0
- data/lib/rails/generators/active_record/migration/migration_generator.rb +78 -0
- data/lib/rails/generators/active_record/migration/templates/create_table_migration.rb.tt +24 -0
- data/lib/rails/generators/active_record/migration/templates/migration.rb.tt +46 -0
- data/lib/rails/generators/active_record/model/model_generator.rb +48 -0
- data/lib/rails/generators/active_record/model/templates/model.rb.tt +13 -0
- data/lib/rails/generators/active_record/model/templates/module.rb.tt +7 -0
- metadata +333 -0
@@ -0,0 +1,19 @@
|
|
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"
|
7
|
+
|
8
|
+
module ActiveRecord
|
9
|
+
module Generators # :nodoc:
|
10
|
+
class Base < Rails::Generators::NamedBase # :nodoc:
|
11
|
+
include ActiveRecord::Generators::Migration
|
12
|
+
|
13
|
+
# Set the current directory as base for the inherited generators.
|
14
|
+
def self.base_root
|
15
|
+
__dir__
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "rails/generators/active_record"
|
4
|
+
|
5
|
+
module ActiveRecord
|
6
|
+
module Generators # :nodoc:
|
7
|
+
class ApplicationRecordGenerator < ::Rails::Generators::Base # :nodoc:
|
8
|
+
source_root File.expand_path("templates", __dir__)
|
9
|
+
|
10
|
+
# FIXME: Change this file to a symlink once RubyGems 2.5.0 is required.
|
11
|
+
def create_application_record
|
12
|
+
template "application_record.rb", application_record_file_name
|
13
|
+
end
|
14
|
+
|
15
|
+
private
|
16
|
+
|
17
|
+
def application_record_file_name
|
18
|
+
@application_record_file_name ||=
|
19
|
+
if namespaced?
|
20
|
+
"app/models/#{namespaced_path}/application_record.rb"
|
21
|
+
else
|
22
|
+
"app/models/application_record.rb"
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "rails/generators/migration"
|
4
|
+
|
5
|
+
module ActiveRecord
|
6
|
+
module Generators # :nodoc:
|
7
|
+
module Migration
|
8
|
+
extend ActiveSupport::Concern
|
9
|
+
include Rails::Generators::Migration
|
10
|
+
|
11
|
+
module ClassMethods
|
12
|
+
# Implement the required interface for Rails::Generators::Migration.
|
13
|
+
def next_migration_number(dirname)
|
14
|
+
next_migration_number = current_migration_number(dirname) + 1
|
15
|
+
ActiveRecord::Migration.next_migration_number(next_migration_number)
|
16
|
+
end
|
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
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,78 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "rails/generators/active_record"
|
4
|
+
|
5
|
+
module ActiveRecord
|
6
|
+
module Generators # :nodoc:
|
7
|
+
class MigrationGenerator < Base # :nodoc:
|
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"
|
11
|
+
|
12
|
+
def create_migration_file
|
13
|
+
set_local_assigns!
|
14
|
+
validate_file_name!
|
15
|
+
migration_template @migration_template, File.join(db_migrate_path, "#{file_name}.rb")
|
16
|
+
end
|
17
|
+
|
18
|
+
# TODO Change this to private once we've dropped Ruby 2.2 support.
|
19
|
+
# Workaround for Ruby 2.2 "private attribute?" warning.
|
20
|
+
protected
|
21
|
+
attr_reader :migration_action, :join_tables
|
22
|
+
|
23
|
+
private
|
24
|
+
|
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)
|
38
|
+
|
39
|
+
set_index_names
|
40
|
+
end
|
41
|
+
when /^create_(.+)/
|
42
|
+
@table_name = normalize_table_name($1)
|
43
|
+
@migration_template = "create_table_migration.rb"
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
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
|
51
|
+
end
|
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
|
60
|
+
|
61
|
+
def attributes_with_index
|
62
|
+
attributes.select { |a| !a.reference? && a.has_index? }
|
63
|
+
end
|
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.
|
67
|
+
def validate_file_name!
|
68
|
+
unless /^[_a-z0-9]+$/.match?(file_name)
|
69
|
+
raise IllegalMigrationNameError.new(file_name)
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
def normalize_table_name(_table_name)
|
74
|
+
pluralize_table_names? ? _table_name.pluralize : _table_name.singularize
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
class <%= migration_class_name %> < ActiveRecord::Migration[<%= ActiveRecord::Migration.current_version %>]
|
2
|
+
def change
|
3
|
+
create_table :<%= table_name %><%= primary_key_type %> do |t|
|
4
|
+
<% attributes.each do |attribute| -%>
|
5
|
+
<% if attribute.password_digest? -%>
|
6
|
+
t.string :password_digest<%= attribute.inject_options %>
|
7
|
+
<% elsif attribute.token? -%>
|
8
|
+
t.string :<%= attribute.name %><%= attribute.inject_options %>
|
9
|
+
<% else -%>
|
10
|
+
t.<%= attribute.type %> :<%= attribute.name %><%= attribute.inject_options %>
|
11
|
+
<% end -%>
|
12
|
+
<% end -%>
|
13
|
+
<% if options[:timestamps] %>
|
14
|
+
t.timestamps
|
15
|
+
<% end -%>
|
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 -%>
|
20
|
+
<% attributes_with_index.each do |attribute| -%>
|
21
|
+
add_index :<%= table_name %>, :<%= attribute.index_name %><%= attribute.inject_index_options %>
|
22
|
+
<% end -%>
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
class <%= migration_class_name %> < ActiveRecord::Migration[<%= ActiveRecord::Migration.current_version %>]
|
2
|
+
<%- if migration_action == 'add' -%>
|
3
|
+
def change
|
4
|
+
<% attributes.each do |attribute| -%>
|
5
|
+
<%- if attribute.reference? -%>
|
6
|
+
add_reference :<%= table_name %>, :<%= attribute.name %><%= attribute.inject_options %>
|
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
|
+
<%- else -%>
|
11
|
+
add_column :<%= table_name %>, :<%= attribute.name %>, :<%= attribute.type %><%= attribute.inject_options %>
|
12
|
+
<%- if attribute.has_index? -%>
|
13
|
+
add_index :<%= table_name %>, :<%= attribute.index_name %><%= attribute.inject_index_options %>
|
14
|
+
<%- end -%>
|
15
|
+
<%- end -%>
|
16
|
+
<%- end -%>
|
17
|
+
end
|
18
|
+
<%- elsif migration_action == 'join' -%>
|
19
|
+
def change
|
20
|
+
create_join_table :<%= join_tables.first %>, :<%= join_tables.second %> do |t|
|
21
|
+
<%- attributes.each do |attribute| -%>
|
22
|
+
<%- if attribute.reference? -%>
|
23
|
+
t.references :<%= attribute.name %><%= attribute.inject_options %>
|
24
|
+
<%- else -%>
|
25
|
+
<%= '# ' unless attribute.has_index? -%>t.index <%= attribute.index_name %><%= attribute.inject_index_options %>
|
26
|
+
<%- end -%>
|
27
|
+
<%- end -%>
|
28
|
+
end
|
29
|
+
end
|
30
|
+
<%- else -%>
|
31
|
+
def change
|
32
|
+
<% attributes.each do |attribute| -%>
|
33
|
+
<%- if migration_action -%>
|
34
|
+
<%- if attribute.reference? -%>
|
35
|
+
remove_reference :<%= table_name %>, :<%= attribute.name %><%= attribute.inject_options %>
|
36
|
+
<%- else -%>
|
37
|
+
<%- if attribute.has_index? -%>
|
38
|
+
remove_index :<%= table_name %>, :<%= attribute.index_name %><%= attribute.inject_index_options %>
|
39
|
+
<%- end -%>
|
40
|
+
remove_column :<%= table_name %>, :<%= attribute.name %>, :<%= attribute.type %><%= attribute.inject_options %>
|
41
|
+
<%- end -%>
|
42
|
+
<%- end -%>
|
43
|
+
<%- end -%>
|
44
|
+
end
|
45
|
+
<%- end -%>
|
46
|
+
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "rails/generators/active_record"
|
4
|
+
|
5
|
+
module ActiveRecord
|
6
|
+
module Generators # :nodoc:
|
7
|
+
class ModelGenerator < Base # :nodoc:
|
8
|
+
argument :attributes, type: :array, default: [], banner: "field[:type][:index] field[:type][:index]"
|
9
|
+
|
10
|
+
check_class_collision
|
11
|
+
|
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"
|
17
|
+
|
18
|
+
# creates the migration file for the model.
|
19
|
+
def create_migration_file
|
20
|
+
return unless options[:migration] && options[:parent].nil?
|
21
|
+
attributes.each { |a| a.attr_options.delete(:index) if a.reference? && !a.has_index? } if options[:indexes] == false
|
22
|
+
migration_template "../../migration/templates/create_table_migration.rb", File.join(db_migrate_path, "create_#{table_name}.rb")
|
23
|
+
end
|
24
|
+
|
25
|
+
def create_model_file
|
26
|
+
template "model.rb", File.join("app/models", class_path, "#{file_name}.rb")
|
27
|
+
end
|
28
|
+
|
29
|
+
def create_module_file
|
30
|
+
return if regular_class_path.empty?
|
31
|
+
template "module.rb", File.join("app/models", "#{class_path.join('/')}.rb") if behavior == :invoke
|
32
|
+
end
|
33
|
+
|
34
|
+
hook_for :test_framework
|
35
|
+
|
36
|
+
private
|
37
|
+
|
38
|
+
def attributes_with_index
|
39
|
+
attributes.select { |a| !a.reference? && a.has_index? }
|
40
|
+
end
|
41
|
+
|
42
|
+
# Used by the migration template to determine the parent name of the model
|
43
|
+
def parent_class_name
|
44
|
+
options[:parent] || "ApplicationRecord"
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
<% module_namespacing do -%>
|
2
|
+
class <%= class_name %> < <%= parent_class_name.classify %>
|
3
|
+
<% attributes.select(&:reference?).each do |attribute| -%>
|
4
|
+
belongs_to :<%= attribute.name %><%= ', polymorphic: true' if attribute.polymorphic? %><%= ', required: true' if attribute.required? %>
|
5
|
+
<% end -%>
|
6
|
+
<% attributes.select(&:token?).each do |attribute| -%>
|
7
|
+
has_secure_token<% if attribute.name != "token" %> :<%= attribute.name %><% end %>
|
8
|
+
<% end -%>
|
9
|
+
<% if attributes.any?(&:password_digest?) -%>
|
10
|
+
has_secure_password
|
11
|
+
<% end -%>
|
12
|
+
end
|
13
|
+
<% end -%>
|
metadata
ADDED
@@ -0,0 +1,333 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: activerecord
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 5.2.3
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- David Heinemeier Hansson
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2019-03-28 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: activesupport
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - '='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 5.2.3
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - '='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 5.2.3
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: activemodel
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - '='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 5.2.3
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - '='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 5.2.3
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: arel
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '9.0'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '9.0'
|
55
|
+
description: Databases on Rails. Build a persistent domain model by mapping database
|
56
|
+
tables to Ruby classes. Strong conventions for associations, validations, aggregations,
|
57
|
+
migrations, and testing come baked-in.
|
58
|
+
email: david@loudthinking.com
|
59
|
+
executables: []
|
60
|
+
extensions: []
|
61
|
+
extra_rdoc_files:
|
62
|
+
- README.rdoc
|
63
|
+
files:
|
64
|
+
- CHANGELOG.md
|
65
|
+
- MIT-LICENSE
|
66
|
+
- README.rdoc
|
67
|
+
- examples/performance.rb
|
68
|
+
- examples/simple.rb
|
69
|
+
- lib/active_record.rb
|
70
|
+
- lib/active_record/aggregations.rb
|
71
|
+
- lib/active_record/association_relation.rb
|
72
|
+
- lib/active_record/associations.rb
|
73
|
+
- lib/active_record/associations/alias_tracker.rb
|
74
|
+
- lib/active_record/associations/association.rb
|
75
|
+
- lib/active_record/associations/association_scope.rb
|
76
|
+
- lib/active_record/associations/belongs_to_association.rb
|
77
|
+
- lib/active_record/associations/belongs_to_polymorphic_association.rb
|
78
|
+
- lib/active_record/associations/builder/association.rb
|
79
|
+
- lib/active_record/associations/builder/belongs_to.rb
|
80
|
+
- lib/active_record/associations/builder/collection_association.rb
|
81
|
+
- lib/active_record/associations/builder/has_and_belongs_to_many.rb
|
82
|
+
- lib/active_record/associations/builder/has_many.rb
|
83
|
+
- lib/active_record/associations/builder/has_one.rb
|
84
|
+
- lib/active_record/associations/builder/singular_association.rb
|
85
|
+
- lib/active_record/associations/collection_association.rb
|
86
|
+
- lib/active_record/associations/collection_proxy.rb
|
87
|
+
- lib/active_record/associations/foreign_association.rb
|
88
|
+
- lib/active_record/associations/has_many_association.rb
|
89
|
+
- lib/active_record/associations/has_many_through_association.rb
|
90
|
+
- lib/active_record/associations/has_one_association.rb
|
91
|
+
- lib/active_record/associations/has_one_through_association.rb
|
92
|
+
- lib/active_record/associations/join_dependency.rb
|
93
|
+
- lib/active_record/associations/join_dependency/join_association.rb
|
94
|
+
- lib/active_record/associations/join_dependency/join_base.rb
|
95
|
+
- lib/active_record/associations/join_dependency/join_part.rb
|
96
|
+
- lib/active_record/associations/preloader.rb
|
97
|
+
- lib/active_record/associations/preloader/association.rb
|
98
|
+
- lib/active_record/associations/preloader/through_association.rb
|
99
|
+
- lib/active_record/associations/singular_association.rb
|
100
|
+
- lib/active_record/associations/through_association.rb
|
101
|
+
- lib/active_record/attribute_assignment.rb
|
102
|
+
- lib/active_record/attribute_decorators.rb
|
103
|
+
- lib/active_record/attribute_methods.rb
|
104
|
+
- lib/active_record/attribute_methods/before_type_cast.rb
|
105
|
+
- lib/active_record/attribute_methods/dirty.rb
|
106
|
+
- lib/active_record/attribute_methods/primary_key.rb
|
107
|
+
- lib/active_record/attribute_methods/query.rb
|
108
|
+
- lib/active_record/attribute_methods/read.rb
|
109
|
+
- lib/active_record/attribute_methods/serialization.rb
|
110
|
+
- lib/active_record/attribute_methods/time_zone_conversion.rb
|
111
|
+
- lib/active_record/attribute_methods/write.rb
|
112
|
+
- lib/active_record/attributes.rb
|
113
|
+
- lib/active_record/autosave_association.rb
|
114
|
+
- lib/active_record/base.rb
|
115
|
+
- lib/active_record/callbacks.rb
|
116
|
+
- lib/active_record/coders/json.rb
|
117
|
+
- lib/active_record/coders/yaml_column.rb
|
118
|
+
- lib/active_record/collection_cache_key.rb
|
119
|
+
- lib/active_record/connection_adapters/abstract/connection_pool.rb
|
120
|
+
- lib/active_record/connection_adapters/abstract/database_limits.rb
|
121
|
+
- lib/active_record/connection_adapters/abstract/database_statements.rb
|
122
|
+
- lib/active_record/connection_adapters/abstract/query_cache.rb
|
123
|
+
- lib/active_record/connection_adapters/abstract/quoting.rb
|
124
|
+
- lib/active_record/connection_adapters/abstract/savepoints.rb
|
125
|
+
- lib/active_record/connection_adapters/abstract/schema_creation.rb
|
126
|
+
- lib/active_record/connection_adapters/abstract/schema_definitions.rb
|
127
|
+
- lib/active_record/connection_adapters/abstract/schema_dumper.rb
|
128
|
+
- lib/active_record/connection_adapters/abstract/schema_statements.rb
|
129
|
+
- lib/active_record/connection_adapters/abstract/transaction.rb
|
130
|
+
- lib/active_record/connection_adapters/abstract_adapter.rb
|
131
|
+
- lib/active_record/connection_adapters/abstract_mysql_adapter.rb
|
132
|
+
- lib/active_record/connection_adapters/column.rb
|
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
|
144
|
+
- lib/active_record/connection_adapters/mysql2_adapter.rb
|
145
|
+
- lib/active_record/connection_adapters/postgresql/column.rb
|
146
|
+
- lib/active_record/connection_adapters/postgresql/database_statements.rb
|
147
|
+
- lib/active_record/connection_adapters/postgresql/explain_pretty_printer.rb
|
148
|
+
- lib/active_record/connection_adapters/postgresql/oid.rb
|
149
|
+
- lib/active_record/connection_adapters/postgresql/oid/array.rb
|
150
|
+
- lib/active_record/connection_adapters/postgresql/oid/bit.rb
|
151
|
+
- lib/active_record/connection_adapters/postgresql/oid/bit_varying.rb
|
152
|
+
- lib/active_record/connection_adapters/postgresql/oid/bytea.rb
|
153
|
+
- lib/active_record/connection_adapters/postgresql/oid/cidr.rb
|
154
|
+
- lib/active_record/connection_adapters/postgresql/oid/date.rb
|
155
|
+
- lib/active_record/connection_adapters/postgresql/oid/date_time.rb
|
156
|
+
- lib/active_record/connection_adapters/postgresql/oid/decimal.rb
|
157
|
+
- lib/active_record/connection_adapters/postgresql/oid/enum.rb
|
158
|
+
- lib/active_record/connection_adapters/postgresql/oid/hstore.rb
|
159
|
+
- lib/active_record/connection_adapters/postgresql/oid/inet.rb
|
160
|
+
- lib/active_record/connection_adapters/postgresql/oid/jsonb.rb
|
161
|
+
- lib/active_record/connection_adapters/postgresql/oid/legacy_point.rb
|
162
|
+
- lib/active_record/connection_adapters/postgresql/oid/money.rb
|
163
|
+
- lib/active_record/connection_adapters/postgresql/oid/oid.rb
|
164
|
+
- lib/active_record/connection_adapters/postgresql/oid/point.rb
|
165
|
+
- lib/active_record/connection_adapters/postgresql/oid/range.rb
|
166
|
+
- lib/active_record/connection_adapters/postgresql/oid/specialized_string.rb
|
167
|
+
- lib/active_record/connection_adapters/postgresql/oid/type_map_initializer.rb
|
168
|
+
- lib/active_record/connection_adapters/postgresql/oid/uuid.rb
|
169
|
+
- lib/active_record/connection_adapters/postgresql/oid/vector.rb
|
170
|
+
- lib/active_record/connection_adapters/postgresql/oid/xml.rb
|
171
|
+
- lib/active_record/connection_adapters/postgresql/quoting.rb
|
172
|
+
- lib/active_record/connection_adapters/postgresql/referential_integrity.rb
|
173
|
+
- lib/active_record/connection_adapters/postgresql/schema_creation.rb
|
174
|
+
- lib/active_record/connection_adapters/postgresql/schema_definitions.rb
|
175
|
+
- lib/active_record/connection_adapters/postgresql/schema_dumper.rb
|
176
|
+
- lib/active_record/connection_adapters/postgresql/schema_statements.rb
|
177
|
+
- lib/active_record/connection_adapters/postgresql/type_metadata.rb
|
178
|
+
- lib/active_record/connection_adapters/postgresql/utils.rb
|
179
|
+
- lib/active_record/connection_adapters/postgresql_adapter.rb
|
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
|
188
|
+
- lib/active_record/connection_adapters/sqlite3_adapter.rb
|
189
|
+
- lib/active_record/connection_adapters/statement_pool.rb
|
190
|
+
- lib/active_record/connection_handling.rb
|
191
|
+
- lib/active_record/core.rb
|
192
|
+
- lib/active_record/counter_cache.rb
|
193
|
+
- lib/active_record/define_callbacks.rb
|
194
|
+
- lib/active_record/dynamic_matchers.rb
|
195
|
+
- lib/active_record/enum.rb
|
196
|
+
- lib/active_record/errors.rb
|
197
|
+
- lib/active_record/explain.rb
|
198
|
+
- lib/active_record/explain_registry.rb
|
199
|
+
- lib/active_record/explain_subscriber.rb
|
200
|
+
- lib/active_record/fixture_set/file.rb
|
201
|
+
- lib/active_record/fixtures.rb
|
202
|
+
- lib/active_record/gem_version.rb
|
203
|
+
- lib/active_record/inheritance.rb
|
204
|
+
- lib/active_record/integration.rb
|
205
|
+
- lib/active_record/internal_metadata.rb
|
206
|
+
- lib/active_record/legacy_yaml_adapter.rb
|
207
|
+
- lib/active_record/locale/en.yml
|
208
|
+
- lib/active_record/locking/optimistic.rb
|
209
|
+
- lib/active_record/locking/pessimistic.rb
|
210
|
+
- lib/active_record/log_subscriber.rb
|
211
|
+
- lib/active_record/migration.rb
|
212
|
+
- lib/active_record/migration/command_recorder.rb
|
213
|
+
- lib/active_record/migration/compatibility.rb
|
214
|
+
- lib/active_record/migration/join_table.rb
|
215
|
+
- lib/active_record/model_schema.rb
|
216
|
+
- lib/active_record/nested_attributes.rb
|
217
|
+
- lib/active_record/no_touching.rb
|
218
|
+
- lib/active_record/null_relation.rb
|
219
|
+
- lib/active_record/persistence.rb
|
220
|
+
- lib/active_record/query_cache.rb
|
221
|
+
- lib/active_record/querying.rb
|
222
|
+
- lib/active_record/railtie.rb
|
223
|
+
- lib/active_record/railties/console_sandbox.rb
|
224
|
+
- lib/active_record/railties/controller_runtime.rb
|
225
|
+
- lib/active_record/railties/databases.rake
|
226
|
+
- lib/active_record/readonly_attributes.rb
|
227
|
+
- lib/active_record/reflection.rb
|
228
|
+
- lib/active_record/relation.rb
|
229
|
+
- lib/active_record/relation/batches.rb
|
230
|
+
- lib/active_record/relation/batches/batch_enumerator.rb
|
231
|
+
- lib/active_record/relation/calculations.rb
|
232
|
+
- lib/active_record/relation/delegation.rb
|
233
|
+
- lib/active_record/relation/finder_methods.rb
|
234
|
+
- lib/active_record/relation/from_clause.rb
|
235
|
+
- lib/active_record/relation/merger.rb
|
236
|
+
- lib/active_record/relation/predicate_builder.rb
|
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
|
243
|
+
- lib/active_record/relation/predicate_builder/relation_handler.rb
|
244
|
+
- lib/active_record/relation/query_attribute.rb
|
245
|
+
- lib/active_record/relation/query_methods.rb
|
246
|
+
- lib/active_record/relation/record_fetch_warning.rb
|
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
|
250
|
+
- lib/active_record/result.rb
|
251
|
+
- lib/active_record/runtime_registry.rb
|
252
|
+
- lib/active_record/sanitization.rb
|
253
|
+
- lib/active_record/schema.rb
|
254
|
+
- lib/active_record/schema_dumper.rb
|
255
|
+
- lib/active_record/schema_migration.rb
|
256
|
+
- lib/active_record/scoping.rb
|
257
|
+
- lib/active_record/scoping/default.rb
|
258
|
+
- lib/active_record/scoping/named.rb
|
259
|
+
- lib/active_record/secure_token.rb
|
260
|
+
- lib/active_record/serialization.rb
|
261
|
+
- lib/active_record/statement_cache.rb
|
262
|
+
- lib/active_record/store.rb
|
263
|
+
- lib/active_record/suppressor.rb
|
264
|
+
- lib/active_record/table_metadata.rb
|
265
|
+
- lib/active_record/tasks/database_tasks.rb
|
266
|
+
- lib/active_record/tasks/mysql_database_tasks.rb
|
267
|
+
- lib/active_record/tasks/postgresql_database_tasks.rb
|
268
|
+
- lib/active_record/tasks/sqlite_database_tasks.rb
|
269
|
+
- lib/active_record/timestamp.rb
|
270
|
+
- lib/active_record/touch_later.rb
|
271
|
+
- lib/active_record/transactions.rb
|
272
|
+
- lib/active_record/translation.rb
|
273
|
+
- lib/active_record/type.rb
|
274
|
+
- lib/active_record/type/adapter_specific_registry.rb
|
275
|
+
- lib/active_record/type/date.rb
|
276
|
+
- lib/active_record/type/date_time.rb
|
277
|
+
- lib/active_record/type/decimal_without_scale.rb
|
278
|
+
- lib/active_record/type/hash_lookup_type_map.rb
|
279
|
+
- lib/active_record/type/internal/timezone.rb
|
280
|
+
- lib/active_record/type/json.rb
|
281
|
+
- lib/active_record/type/serialized.rb
|
282
|
+
- lib/active_record/type/text.rb
|
283
|
+
- lib/active_record/type/time.rb
|
284
|
+
- lib/active_record/type/type_map.rb
|
285
|
+
- lib/active_record/type/unsigned_integer.rb
|
286
|
+
- lib/active_record/type_caster.rb
|
287
|
+
- lib/active_record/type_caster/connection.rb
|
288
|
+
- lib/active_record/type_caster/map.rb
|
289
|
+
- lib/active_record/validations.rb
|
290
|
+
- lib/active_record/validations/absence.rb
|
291
|
+
- lib/active_record/validations/associated.rb
|
292
|
+
- lib/active_record/validations/length.rb
|
293
|
+
- lib/active_record/validations/presence.rb
|
294
|
+
- lib/active_record/validations/uniqueness.rb
|
295
|
+
- lib/active_record/version.rb
|
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
|
299
|
+
- lib/rails/generators/active_record/migration.rb
|
300
|
+
- lib/rails/generators/active_record/migration/migration_generator.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
|
303
|
+
- lib/rails/generators/active_record/model/model_generator.rb
|
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
|
307
|
+
licenses:
|
308
|
+
- MIT
|
309
|
+
metadata:
|
310
|
+
source_code_uri: https://github.com/rails/rails/tree/v5.2.3/activerecord
|
311
|
+
changelog_uri: https://github.com/rails/rails/blob/v5.2.3/activerecord/CHANGELOG.md
|
312
|
+
post_install_message:
|
313
|
+
rdoc_options:
|
314
|
+
- "--main"
|
315
|
+
- README.rdoc
|
316
|
+
require_paths:
|
317
|
+
- lib
|
318
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
319
|
+
requirements:
|
320
|
+
- - ">="
|
321
|
+
- !ruby/object:Gem::Version
|
322
|
+
version: 2.2.2
|
323
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
324
|
+
requirements:
|
325
|
+
- - ">="
|
326
|
+
- !ruby/object:Gem::Version
|
327
|
+
version: '0'
|
328
|
+
requirements: []
|
329
|
+
rubygems_version: 3.0.1
|
330
|
+
signing_key:
|
331
|
+
specification_version: 4
|
332
|
+
summary: Object-relational mapper framework (part of Rails).
|
333
|
+
test_files: []
|