nullifyable 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +8 -0
- data/.travis.yml +5 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +6 -0
- data/Gemfile.lock +52 -0
- data/LICENSE.txt +21 -0
- data/README.md +53 -0
- data/Rakefile +10 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/lib/nullifyable.rb +27 -0
- data/lib/nullifyable/version.rb +3 -0
- data/nullifyable.gemspec +31 -0
- data/vendor/bundle/bin/rake +27 -0
- data/vendor/bundle/cache/activemodel-5.2.2.gem +0 -0
- data/vendor/bundle/cache/activerecord-5.2.2.gem +0 -0
- data/vendor/bundle/cache/activesupport-5.2.2.gem +0 -0
- data/vendor/bundle/cache/ansi-1.5.0.gem +0 -0
- data/vendor/bundle/cache/arel-9.0.0.gem +0 -0
- data/vendor/bundle/cache/builder-3.2.3.gem +0 -0
- data/vendor/bundle/cache/concurrent-ruby-1.1.4.gem +0 -0
- data/vendor/bundle/cache/i18n-1.3.0.gem +0 -0
- data/vendor/bundle/cache/minitest-5.11.3.gem +0 -0
- data/vendor/bundle/cache/minitest-reporters-1.3.5.gem +0 -0
- data/vendor/bundle/cache/rake-10.5.0.gem +0 -0
- data/vendor/bundle/cache/ruby-progressbar-1.10.0.gem +0 -0
- data/vendor/bundle/cache/sqlite3-1.3.13.gem +0 -0
- data/vendor/bundle/cache/thread_safe-0.3.6.gem +0 -0
- data/vendor/bundle/cache/tzinfo-1.2.5.gem +0 -0
- data/vendor/bundle/extensions/x86_64-darwin-14/2.3.0-static/sqlite3-1.3.13/gem.build_complete +0 -0
- data/vendor/bundle/extensions/x86_64-darwin-14/2.3.0-static/sqlite3-1.3.13/gem_make.out +33 -0
- data/vendor/bundle/extensions/x86_64-darwin-14/2.3.0-static/sqlite3-1.3.13/mkmf.log +529 -0
- data/vendor/bundle/extensions/x86_64-darwin-14/2.3.0-static/sqlite3-1.3.13/sqlite3/sqlite3_native.bundle +0 -0
- data/vendor/bundle/gems/activemodel-5.2.2/CHANGELOG.md +84 -0
- data/vendor/bundle/gems/activemodel-5.2.2/MIT-LICENSE +21 -0
- data/vendor/bundle/gems/activemodel-5.2.2/README.rdoc +264 -0
- data/vendor/bundle/gems/activemodel-5.2.2/lib/active_model.rb +77 -0
- data/vendor/bundle/gems/activemodel-5.2.2/lib/active_model/attribute.rb +248 -0
- data/vendor/bundle/gems/activemodel-5.2.2/lib/active_model/attribute/user_provided_default.rb +52 -0
- data/vendor/bundle/gems/activemodel-5.2.2/lib/active_model/attribute_assignment.rb +57 -0
- data/vendor/bundle/gems/activemodel-5.2.2/lib/active_model/attribute_methods.rb +478 -0
- data/vendor/bundle/gems/activemodel-5.2.2/lib/active_model/attribute_mutation_tracker.rb +124 -0
- data/vendor/bundle/gems/activemodel-5.2.2/lib/active_model/attribute_set.rb +114 -0
- data/vendor/bundle/gems/activemodel-5.2.2/lib/active_model/attribute_set/builder.rb +126 -0
- data/vendor/bundle/gems/activemodel-5.2.2/lib/active_model/attribute_set/yaml_encoder.rb +41 -0
- data/vendor/bundle/gems/activemodel-5.2.2/lib/active_model/attributes.rb +111 -0
- data/vendor/bundle/gems/activemodel-5.2.2/lib/active_model/callbacks.rb +153 -0
- data/vendor/bundle/gems/activemodel-5.2.2/lib/active_model/conversion.rb +111 -0
- data/vendor/bundle/gems/activemodel-5.2.2/lib/active_model/dirty.rb +343 -0
- data/vendor/bundle/gems/activemodel-5.2.2/lib/active_model/errors.rb +517 -0
- data/vendor/bundle/gems/activemodel-5.2.2/lib/active_model/forbidden_attributes_protection.rb +31 -0
- data/vendor/bundle/gems/activemodel-5.2.2/lib/active_model/gem_version.rb +17 -0
- data/vendor/bundle/gems/activemodel-5.2.2/lib/active_model/lint.rb +118 -0
- data/vendor/bundle/gems/activemodel-5.2.2/lib/active_model/locale/en.yml +36 -0
- data/vendor/bundle/gems/activemodel-5.2.2/lib/active_model/model.rb +99 -0
- data/vendor/bundle/gems/activemodel-5.2.2/lib/active_model/naming.rb +318 -0
- data/vendor/bundle/gems/activemodel-5.2.2/lib/active_model/railtie.rb +14 -0
- data/vendor/bundle/gems/activemodel-5.2.2/lib/active_model/secure_password.rb +129 -0
- data/vendor/bundle/gems/activemodel-5.2.2/lib/active_model/serialization.rb +192 -0
- data/vendor/bundle/gems/activemodel-5.2.2/lib/active_model/serializers/json.rb +146 -0
- data/vendor/bundle/gems/activemodel-5.2.2/lib/active_model/translation.rb +70 -0
- data/vendor/bundle/gems/activemodel-5.2.2/lib/active_model/type.rb +53 -0
- data/vendor/bundle/gems/activemodel-5.2.2/lib/active_model/type/big_integer.rb +15 -0
- data/vendor/bundle/gems/activemodel-5.2.2/lib/active_model/type/binary.rb +52 -0
- data/vendor/bundle/gems/activemodel-5.2.2/lib/active_model/type/boolean.rb +38 -0
- data/vendor/bundle/gems/activemodel-5.2.2/lib/active_model/type/date.rb +56 -0
- data/vendor/bundle/gems/activemodel-5.2.2/lib/active_model/type/date_time.rb +50 -0
- data/vendor/bundle/gems/activemodel-5.2.2/lib/active_model/type/decimal.rb +70 -0
- data/vendor/bundle/gems/activemodel-5.2.2/lib/active_model/type/float.rb +36 -0
- data/vendor/bundle/gems/activemodel-5.2.2/lib/active_model/type/helpers.rb +6 -0
- data/vendor/bundle/gems/activemodel-5.2.2/lib/active_model/type/helpers/accepts_multiparameter_time.rb +41 -0
- data/vendor/bundle/gems/activemodel-5.2.2/lib/active_model/type/helpers/mutable.rb +20 -0
- data/vendor/bundle/gems/activemodel-5.2.2/lib/active_model/type/helpers/numeric.rb +37 -0
- data/vendor/bundle/gems/activemodel-5.2.2/lib/active_model/type/helpers/time_value.rb +80 -0
- data/vendor/bundle/gems/activemodel-5.2.2/lib/active_model/type/immutable_string.rb +32 -0
- data/vendor/bundle/gems/activemodel-5.2.2/lib/active_model/type/integer.rb +70 -0
- data/vendor/bundle/gems/activemodel-5.2.2/lib/active_model/type/registry.rb +70 -0
- data/vendor/bundle/gems/activemodel-5.2.2/lib/active_model/type/string.rb +26 -0
- data/vendor/bundle/gems/activemodel-5.2.2/lib/active_model/type/time.rb +46 -0
- data/vendor/bundle/gems/activemodel-5.2.2/lib/active_model/type/value.rb +126 -0
- data/vendor/bundle/gems/activemodel-5.2.2/lib/active_model/validations.rb +439 -0
- data/vendor/bundle/gems/activemodel-5.2.2/lib/active_model/validations/absence.rb +33 -0
- data/vendor/bundle/gems/activemodel-5.2.2/lib/active_model/validations/acceptance.rb +106 -0
- data/vendor/bundle/gems/activemodel-5.2.2/lib/active_model/validations/callbacks.rb +122 -0
- data/vendor/bundle/gems/activemodel-5.2.2/lib/active_model/validations/clusivity.rb +54 -0
- data/vendor/bundle/gems/activemodel-5.2.2/lib/active_model/validations/confirmation.rb +80 -0
- data/vendor/bundle/gems/activemodel-5.2.2/lib/active_model/validations/exclusion.rb +49 -0
- data/vendor/bundle/gems/activemodel-5.2.2/lib/active_model/validations/format.rb +114 -0
- data/vendor/bundle/gems/activemodel-5.2.2/lib/active_model/validations/helper_methods.rb +15 -0
- data/vendor/bundle/gems/activemodel-5.2.2/lib/active_model/validations/inclusion.rb +47 -0
- data/vendor/bundle/gems/activemodel-5.2.2/lib/active_model/validations/length.rb +129 -0
- data/vendor/bundle/gems/activemodel-5.2.2/lib/active_model/validations/numericality.rb +180 -0
- data/vendor/bundle/gems/activemodel-5.2.2/lib/active_model/validations/presence.rb +39 -0
- data/vendor/bundle/gems/activemodel-5.2.2/lib/active_model/validations/validates.rb +174 -0
- data/vendor/bundle/gems/activemodel-5.2.2/lib/active_model/validations/with.rb +147 -0
- data/vendor/bundle/gems/activemodel-5.2.2/lib/active_model/validator.rb +183 -0
- data/vendor/bundle/gems/activemodel-5.2.2/lib/active_model/version.rb +10 -0
- data/vendor/bundle/gems/activerecord-5.2.2/CHANGELOG.md +895 -0
- data/vendor/bundle/gems/activerecord-5.2.2/MIT-LICENSE +20 -0
- data/vendor/bundle/gems/activerecord-5.2.2/README.rdoc +217 -0
- data/vendor/bundle/gems/activerecord-5.2.2/examples/performance.rb +185 -0
- data/vendor/bundle/gems/activerecord-5.2.2/examples/simple.rb +15 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record.rb +188 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/aggregations.rb +283 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/association_relation.rb +40 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/associations.rb +1860 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/associations/alias_tracker.rb +81 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/associations/association.rb +299 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/associations/association_scope.rb +168 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/associations/belongs_to_association.rb +130 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/associations/belongs_to_polymorphic_association.rb +40 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/associations/builder/association.rb +140 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/associations/builder/belongs_to.rb +163 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/associations/builder/collection_association.rb +82 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/associations/builder/has_and_belongs_to_many.rb +135 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/associations/builder/has_many.rb +17 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/associations/builder/has_one.rb +30 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/associations/builder/singular_association.rb +42 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/associations/collection_association.rb +514 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/associations/collection_proxy.rb +1157 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/associations/foreign_association.rb +13 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/associations/has_many_association.rb +143 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/associations/has_many_through_association.rb +225 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/associations/has_one_association.rb +120 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/associations/has_one_through_association.rb +45 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/associations/join_dependency.rb +262 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/associations/join_dependency/join_association.rb +60 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/associations/join_dependency/join_base.rb +23 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/associations/join_dependency/join_part.rb +71 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/associations/preloader.rb +193 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/associations/preloader/association.rb +131 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/associations/preloader/through_association.rb +107 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/associations/singular_association.rb +73 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/associations/through_association.rb +121 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/attribute_assignment.rb +88 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/attribute_decorators.rb +90 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/attribute_methods.rb +492 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/attribute_methods/before_type_cast.rb +78 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/attribute_methods/dirty.rb +150 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/attribute_methods/primary_key.rb +143 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/attribute_methods/query.rb +42 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/attribute_methods/read.rb +85 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/attribute_methods/serialization.rb +90 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/attribute_methods/time_zone_conversion.rb +91 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/attribute_methods/write.rb +68 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/attributes.rb +266 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/autosave_association.rb +498 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/base.rb +329 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/callbacks.rb +353 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/coders/json.rb +15 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/coders/yaml_column.rb +50 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/collection_cache_key.rb +53 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/connection_adapters/abstract/connection_pool.rb +1064 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/connection_adapters/abstract/database_limits.rb +72 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/connection_adapters/abstract/database_statements.rb +532 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/connection_adapters/abstract/query_cache.rb +140 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/connection_adapters/abstract/quoting.rb +200 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/connection_adapters/abstract/savepoints.rb +23 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/connection_adapters/abstract/schema_creation.rb +146 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/connection_adapters/abstract/schema_definitions.rb +685 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/connection_adapters/abstract/schema_dumper.rb +95 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/connection_adapters/abstract/schema_statements.rb +1396 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/connection_adapters/abstract/transaction.rb +283 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/connection_adapters/abstract_adapter.rb +626 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/connection_adapters/abstract_mysql_adapter.rb +877 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/connection_adapters/column.rb +91 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/connection_adapters/connection_specification.rb +287 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/connection_adapters/determine_if_preparable_visitor.rb +33 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/connection_adapters/mysql/column.rb +27 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/connection_adapters/mysql/database_statements.rb +140 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/connection_adapters/mysql/explain_pretty_printer.rb +72 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/connection_adapters/mysql/quoting.rb +44 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/connection_adapters/mysql/schema_creation.rb +73 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/connection_adapters/mysql/schema_definitions.rb +87 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/connection_adapters/mysql/schema_dumper.rb +80 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/connection_adapters/mysql/schema_statements.rb +148 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/connection_adapters/mysql/type_metadata.rb +35 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/connection_adapters/mysql2_adapter.rb +129 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/connection_adapters/postgresql/column.rb +44 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/connection_adapters/postgresql/database_statements.rb +163 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/connection_adapters/postgresql/explain_pretty_printer.rb +44 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/connection_adapters/postgresql/oid.rb +34 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/connection_adapters/postgresql/oid/array.rb +92 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/connection_adapters/postgresql/oid/bit.rb +56 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/connection_adapters/postgresql/oid/bit_varying.rb +15 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/connection_adapters/postgresql/oid/bytea.rb +17 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/connection_adapters/postgresql/oid/cidr.rb +50 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/connection_adapters/postgresql/oid/date.rb +23 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/connection_adapters/postgresql/oid/date_time.rb +23 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/connection_adapters/postgresql/oid/decimal.rb +15 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/connection_adapters/postgresql/oid/enum.rb +21 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/connection_adapters/postgresql/oid/hstore.rb +71 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/connection_adapters/postgresql/oid/inet.rb +15 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/connection_adapters/postgresql/oid/jsonb.rb +15 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/connection_adapters/postgresql/oid/legacy_point.rb +45 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/connection_adapters/postgresql/oid/money.rb +41 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/connection_adapters/postgresql/oid/oid.rb +15 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/connection_adapters/postgresql/oid/point.rb +65 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/connection_adapters/postgresql/oid/range.rb +97 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/connection_adapters/postgresql/oid/specialized_string.rb +18 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/connection_adapters/postgresql/oid/type_map_initializer.rb +111 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/connection_adapters/postgresql/oid/uuid.rb +23 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/connection_adapters/postgresql/oid/vector.rb +28 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/connection_adapters/postgresql/oid/xml.rb +30 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/connection_adapters/postgresql/quoting.rb +168 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/connection_adapters/postgresql/referential_integrity.rb +43 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/connection_adapters/postgresql/schema_creation.rb +29 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/connection_adapters/postgresql/schema_definitions.rb +206 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/connection_adapters/postgresql/schema_dumper.rb +50 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/connection_adapters/postgresql/schema_statements.rb +792 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/connection_adapters/postgresql/type_metadata.rb +39 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/connection_adapters/postgresql/utils.rb +81 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/connection_adapters/postgresql_adapter.rb +863 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/connection_adapters/schema_cache.rb +118 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/connection_adapters/sql_type_metadata.rb +34 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/connection_adapters/sqlite3/explain_pretty_printer.rb +21 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/connection_adapters/sqlite3/quoting.rb +63 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/connection_adapters/sqlite3/schema_creation.rb +17 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/connection_adapters/sqlite3/schema_definitions.rb +19 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/connection_adapters/sqlite3/schema_dumper.rb +18 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/connection_adapters/sqlite3/schema_statements.rb +106 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/connection_adapters/sqlite3_adapter.rb +573 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/connection_adapters/statement_pool.rb +61 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/connection_handling.rb +145 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/core.rb +558 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/counter_cache.rb +218 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/define_callbacks.rb +22 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/dynamic_matchers.rb +122 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/enum.rb +244 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/errors.rb +374 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/explain.rb +50 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/explain_registry.rb +32 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/explain_subscriber.rb +34 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/fixture_set/file.rb +82 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/fixtures.rb +1065 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/gem_version.rb +17 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/inheritance.rb +283 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/integration.rb +155 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/internal_metadata.rb +45 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/legacy_yaml_adapter.rb +48 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/locale/en.yml +48 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/locking/optimistic.rb +198 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/locking/pessimistic.rb +89 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/log_subscriber.rb +137 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/migration.rb +1378 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/migration/command_recorder.rb +240 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/migration/compatibility.rb +217 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/migration/join_table.rb +17 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/model_schema.rb +521 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/nested_attributes.rb +600 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/no_touching.rb +58 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/null_relation.rb +68 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/persistence.rb +761 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/query_cache.rb +45 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/querying.rb +71 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/railtie.rb +226 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/railties/console_sandbox.rb +7 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/railties/controller_runtime.rb +56 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/railties/databases.rake +377 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/readonly_attributes.rb +24 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/reflection.rb +1044 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/relation.rb +629 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/relation/batches.rb +287 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/relation/batches/batch_enumerator.rb +69 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/relation/calculations.rb +414 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/relation/delegation.rb +147 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/relation/finder_methods.rb +561 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/relation/from_clause.rb +26 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/relation/merger.rb +190 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/relation/predicate_builder.rb +147 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/relation/predicate_builder/array_handler.rb +48 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/relation/predicate_builder/association_query_value.rb +46 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/relation/predicate_builder/base_handler.rb +19 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/relation/predicate_builder/basic_object_handler.rb +20 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/relation/predicate_builder/polymorphic_array_value.rb +56 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/relation/predicate_builder/range_handler.rb +42 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/relation/predicate_builder/relation_handler.rb +19 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/relation/query_attribute.rb +43 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/relation/query_methods.rb +1208 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/relation/record_fetch_warning.rb +51 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/relation/spawn_methods.rb +77 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/relation/where_clause.rb +186 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/relation/where_clause_factory.rb +34 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/result.rb +149 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/runtime_registry.rb +24 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/sanitization.rb +222 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/schema.rb +70 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/schema_dumper.rb +255 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/schema_migration.rb +56 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/scoping.rb +106 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/scoping/default.rb +152 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/scoping/named.rb +213 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/secure_token.rb +40 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/serialization.rb +22 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/statement_cache.rb +121 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/store.rb +211 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/suppressor.rb +61 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/table_metadata.rb +82 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/tasks/database_tasks.rb +337 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/tasks/mysql_database_tasks.rb +115 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/tasks/postgresql_database_tasks.rb +143 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/tasks/sqlite_database_tasks.rb +83 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/timestamp.rb +153 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/touch_later.rb +64 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/transactions.rb +502 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/translation.rb +24 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/type.rb +79 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/type/adapter_specific_registry.rb +136 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/type/date.rb +9 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/type/date_time.rb +9 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/type/decimal_without_scale.rb +15 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/type/hash_lookup_type_map.rb +25 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/type/internal/timezone.rb +17 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/type/json.rb +30 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/type/serialized.rb +71 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/type/text.rb +11 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/type/time.rb +21 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/type/type_map.rb +62 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/type/unsigned_integer.rb +17 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/type_caster.rb +9 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/type_caster/connection.rb +33 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/type_caster/map.rb +23 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/validations.rb +93 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/validations/absence.rb +25 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/validations/associated.rb +60 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/validations/length.rb +26 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/validations/presence.rb +68 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/validations/uniqueness.rb +238 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/active_record/version.rb +10 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/rails/generators/active_record.rb +19 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/rails/generators/active_record/application_record/application_record_generator.rb +27 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/rails/generators/active_record/application_record/templates/application_record.rb.tt +5 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/rails/generators/active_record/migration.rb +35 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/rails/generators/active_record/migration/migration_generator.rb +78 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/rails/generators/active_record/migration/templates/create_table_migration.rb.tt +24 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/rails/generators/active_record/migration/templates/migration.rb.tt +46 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/rails/generators/active_record/model/model_generator.rb +48 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/rails/generators/active_record/model/templates/model.rb.tt +13 -0
- data/vendor/bundle/gems/activerecord-5.2.2/lib/rails/generators/active_record/model/templates/module.rb.tt +7 -0
- data/vendor/bundle/gems/activesupport-5.2.2/CHANGELOG.md +572 -0
- data/vendor/bundle/gems/activesupport-5.2.2/MIT-LICENSE +20 -0
- data/vendor/bundle/gems/activesupport-5.2.2/README.rdoc +39 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support.rb +95 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/all.rb +5 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/array_inquirer.rb +48 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/backtrace_cleaner.rb +105 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/benchmarkable.rb +51 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/builder.rb +8 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/cache.rb +808 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/cache/file_store.rb +196 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/cache/mem_cache_store.rb +207 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/cache/memory_store.rb +169 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/cache/null_store.rb +43 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/cache/redis_cache_store.rb +461 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/cache/strategy/local_cache.rb +194 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/cache/strategy/local_cache_middleware.rb +45 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/callbacks.rb +845 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/concern.rb +144 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/concurrency/load_interlock_aware_monitor.rb +17 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/concurrency/share_lock.rb +227 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/configurable.rb +150 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/core_ext.rb +5 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/core_ext/array.rb +9 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/core_ext/array/access.rb +92 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/core_ext/array/conversions.rb +213 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/core_ext/array/extract_options.rb +31 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/core_ext/array/grouping.rb +109 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/core_ext/array/inquiry.rb +19 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/core_ext/array/prepend_and_append.rb +9 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/core_ext/array/wrap.rb +48 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/core_ext/benchmark.rb +16 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/core_ext/big_decimal.rb +3 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/core_ext/big_decimal/conversions.rb +14 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/core_ext/class.rb +4 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/core_ext/class/attribute.rb +146 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/core_ext/class/attribute_accessors.rb +6 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/core_ext/class/subclasses.rb +54 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/core_ext/date.rb +7 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/core_ext/date/acts_like.rb +10 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/core_ext/date/blank.rb +14 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/core_ext/date/calculations.rb +145 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/core_ext/date/conversions.rb +96 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/core_ext/date/zones.rb +8 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/core_ext/date_and_time/calculations.rb +374 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/core_ext/date_and_time/compatibility.rb +16 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/core_ext/date_and_time/zones.rb +41 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/core_ext/date_time.rb +7 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/core_ext/date_time/acts_like.rb +16 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/core_ext/date_time/blank.rb +14 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/core_ext/date_time/calculations.rb +211 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/core_ext/date_time/compatibility.rb +18 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/core_ext/date_time/conversions.rb +107 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/core_ext/digest/uuid.rb +53 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/core_ext/enumerable.rb +164 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/core_ext/file.rb +3 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/core_ext/file/atomic.rb +70 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/core_ext/hash.rb +11 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/core_ext/hash/compact.rb +29 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/core_ext/hash/conversions.rb +263 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/core_ext/hash/deep_merge.rb +34 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/core_ext/hash/except.rb +24 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/core_ext/hash/indifferent_access.rb +24 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/core_ext/hash/keys.rb +172 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/core_ext/hash/reverse_merge.rb +25 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/core_ext/hash/slice.rb +48 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/core_ext/hash/transform_values.rb +32 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/core_ext/integer.rb +5 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/core_ext/integer/inflections.rb +31 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/core_ext/integer/multiple.rb +12 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/core_ext/integer/time.rb +22 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/core_ext/kernel.rb +6 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/core_ext/kernel/agnostics.rb +13 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/core_ext/kernel/concern.rb +14 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/core_ext/kernel/reporting.rb +45 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/core_ext/kernel/singleton_class.rb +8 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/core_ext/load_error.rb +9 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/core_ext/marshal.rb +24 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/core_ext/module.rb +14 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/core_ext/module/aliasing.rb +31 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/core_ext/module/anonymous.rb +30 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/core_ext/module/attr_internal.rb +38 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/core_ext/module/attribute_accessors.rb +215 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/core_ext/module/attribute_accessors_per_thread.rb +150 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/core_ext/module/concerning.rb +134 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/core_ext/module/delegation.rb +287 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/core_ext/module/deprecation.rb +25 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/core_ext/module/introspection.rb +62 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/core_ext/module/reachable.rb +11 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/core_ext/module/redefine_method.rb +49 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/core_ext/module/remove_method.rb +17 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/core_ext/name_error.rb +38 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/core_ext/numeric.rb +6 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/core_ext/numeric/bytes.rb +66 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/core_ext/numeric/conversions.rb +140 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/core_ext/numeric/inquiry.rb +28 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/core_ext/numeric/time.rb +66 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/core_ext/object.rb +16 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/core_ext/object/acts_like.rb +21 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/core_ext/object/blank.rb +156 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/core_ext/object/conversions.rb +6 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/core_ext/object/deep_dup.rb +55 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/core_ext/object/duplicable.rb +156 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/core_ext/object/inclusion.rb +29 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/core_ext/object/instance_variables.rb +30 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/core_ext/object/json.rb +227 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/core_ext/object/to_param.rb +3 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/core_ext/object/to_query.rb +89 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/core_ext/object/try.rb +148 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/core_ext/object/with_options.rb +82 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/core_ext/range.rb +7 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/core_ext/range/conversions.rb +39 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/core_ext/range/each.rb +25 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/core_ext/range/include_range.rb +25 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/core_ext/range/include_time_with_zone.rb +23 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/core_ext/range/overlaps.rb +10 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/core_ext/regexp.rb +11 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/core_ext/securerandom.rb +25 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/core_ext/string.rb +15 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/core_ext/string/access.rb +106 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/core_ext/string/behavior.rb +8 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/core_ext/string/conversions.rb +59 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/core_ext/string/exclude.rb +13 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/core_ext/string/filters.rb +104 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/core_ext/string/indent.rb +45 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/core_ext/string/inflections.rb +254 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/core_ext/string/inquiry.rb +15 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/core_ext/string/multibyte.rb +57 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/core_ext/string/output_safety.rb +258 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/core_ext/string/starts_ends_with.rb +6 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/core_ext/string/strip.rb +25 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/core_ext/string/zones.rb +16 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/core_ext/time.rb +7 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/core_ext/time/acts_like.rb +10 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/core_ext/time/calculations.rb +315 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/core_ext/time/compatibility.rb +16 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/core_ext/time/conversions.rb +72 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/core_ext/time/zones.rb +113 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/core_ext/uri.rb +24 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/current_attributes.rb +195 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/dependencies.rb +753 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/dependencies/autoload.rb +79 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/dependencies/interlock.rb +57 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/deprecation.rb +46 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/deprecation/behaviors.rb +109 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/deprecation/constant_accessor.rb +52 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/deprecation/instance_delegator.rb +39 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/deprecation/method_wrappers.rb +80 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/deprecation/proxy_wrappers.rb +154 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/deprecation/reporting.rb +114 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/descendants_tracker.rb +62 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/digest.rb +20 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/duration.rb +432 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/duration/iso8601_parser.rb +125 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/duration/iso8601_serializer.rb +55 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/encrypted_configuration.rb +49 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/encrypted_file.rb +99 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/evented_file_update_checker.rb +205 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/execution_wrapper.rb +128 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/executor.rb +8 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/file_update_checker.rb +163 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/gem_version.rb +17 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/gzip.rb +38 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/hash_with_indifferent_access.rb +382 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/i18n.rb +15 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/i18n_railtie.rb +118 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/inflections.rb +72 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/inflector.rb +9 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/inflector/inflections.rb +260 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/inflector/methods.rb +408 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/inflector/transliterate.rb +118 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/json.rb +4 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/json/decoding.rb +76 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/json/encoding.rb +130 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/key_generator.rb +73 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/lazy_load_hooks.rb +78 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/locale/en.yml +135 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/log_subscriber.rb +112 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/log_subscriber/test_helper.rb +106 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/logger.rb +108 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/logger_silence.rb +29 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/logger_thread_safe_level.rb +33 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/message_encryptor.rb +229 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/message_verifier.rb +205 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/messages/metadata.rb +71 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/messages/rotation_configuration.rb +22 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/messages/rotator.rb +56 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/multibyte.rb +23 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/multibyte/chars.rb +235 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/multibyte/unicode.rb +394 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/notifications.rb +216 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/notifications/fanout.rb +159 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/notifications/instrumenter.rb +93 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/number_helper.rb +371 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/number_helper/number_converter.rb +184 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/number_helper/number_to_currency_converter.rb +46 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/number_helper/number_to_delimited_converter.rb +29 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/number_helper/number_to_human_converter.rb +68 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/number_helper/number_to_human_size_converter.rb +59 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/number_helper/number_to_percentage_converter.rb +14 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/number_helper/number_to_phone_converter.rb +58 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/number_helper/number_to_rounded_converter.rb +54 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/number_helper/rounding_helper.rb +66 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/option_merger.rb +27 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/ordered_hash.rb +50 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/ordered_options.rb +85 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/per_thread_registry.rb +60 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/proxy_object.rb +15 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/rails.rb +35 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/railtie.rb +80 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/reloader.rb +131 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/rescuable.rb +174 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/security_utils.rb +31 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/string_inquirer.rb +34 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/subscriber.rb +130 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/tagged_logging.rb +79 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/test_case.rb +72 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/testing/assertions.rb +214 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/testing/autorun.rb +7 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/testing/constant_lookup.rb +51 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/testing/declarative.rb +28 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/testing/deprecation.rb +39 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/testing/file_fixtures.rb +36 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/testing/isolation.rb +110 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/testing/method_call_assertions.rb +43 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/testing/setup_and_teardown.rb +55 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/testing/stream.rb +44 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/testing/tagged_logging.rb +27 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/testing/time_helpers.rb +200 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/time.rb +20 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/time_with_zone.rb +551 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/values/time_zone.rb +565 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/values/unicode_tables.dat +0 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/version.rb +10 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/xml_mini.rb +209 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/xml_mini/jdom.rb +183 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/xml_mini/libxml.rb +80 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/xml_mini/libxmlsax.rb +83 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/xml_mini/nokogiri.rb +83 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/xml_mini/nokogirisax.rb +86 -0
- data/vendor/bundle/gems/activesupport-5.2.2/lib/active_support/xml_mini/rexml.rb +130 -0
- data/vendor/bundle/gems/ansi-1.5.0/.index +77 -0
- data/vendor/bundle/gems/ansi-1.5.0/.yardopts +8 -0
- data/vendor/bundle/gems/ansi-1.5.0/DEMO.md +451 -0
- data/vendor/bundle/gems/ansi-1.5.0/HISTORY.md +217 -0
- data/vendor/bundle/gems/ansi-1.5.0/LICENSE.txt +23 -0
- data/vendor/bundle/gems/ansi-1.5.0/NOTICE.md +170 -0
- data/vendor/bundle/gems/ansi-1.5.0/README.md +91 -0
- data/vendor/bundle/gems/ansi-1.5.0/demo/01_ansicode.md +65 -0
- data/vendor/bundle/gems/ansi-1.5.0/demo/02_core.md +11 -0
- data/vendor/bundle/gems/ansi-1.5.0/demo/03_logger.md +30 -0
- data/vendor/bundle/gems/ansi-1.5.0/demo/04_progressbar.md +62 -0
- data/vendor/bundle/gems/ansi-1.5.0/demo/05_mixin.md +37 -0
- data/vendor/bundle/gems/ansi-1.5.0/demo/06_string.md +56 -0
- data/vendor/bundle/gems/ansi-1.5.0/demo/07_columns.md +89 -0
- data/vendor/bundle/gems/ansi-1.5.0/demo/08_table.md +28 -0
- data/vendor/bundle/gems/ansi-1.5.0/demo/09_diff.md +47 -0
- data/vendor/bundle/gems/ansi-1.5.0/demo/10_bbcode.md +24 -0
- data/vendor/bundle/gems/ansi-1.5.0/demo/11_terminal.md +8 -0
- data/vendor/bundle/gems/ansi-1.5.0/demo/applique/ae.rb +1 -0
- data/vendor/bundle/gems/ansi-1.5.0/demo/applique/output.rb +5 -0
- data/vendor/bundle/gems/ansi-1.5.0/lib/ansi.rb +22 -0
- data/vendor/bundle/gems/ansi-1.5.0/lib/ansi.yml +77 -0
- data/vendor/bundle/gems/ansi-1.5.0/lib/ansi/bbcode.rb +334 -0
- data/vendor/bundle/gems/ansi-1.5.0/lib/ansi/chain.rb +50 -0
- data/vendor/bundle/gems/ansi-1.5.0/lib/ansi/chart.rb +100 -0
- data/vendor/bundle/gems/ansi-1.5.0/lib/ansi/code.rb +349 -0
- data/vendor/bundle/gems/ansi-1.5.0/lib/ansi/columns.rb +197 -0
- data/vendor/bundle/gems/ansi-1.5.0/lib/ansi/constants.rb +25 -0
- data/vendor/bundle/gems/ansi-1.5.0/lib/ansi/core.rb +30 -0
- data/vendor/bundle/gems/ansi-1.5.0/lib/ansi/diff.rb +215 -0
- data/vendor/bundle/gems/ansi-1.5.0/lib/ansi/hexdump.rb +122 -0
- data/vendor/bundle/gems/ansi-1.5.0/lib/ansi/logger.rb +211 -0
- data/vendor/bundle/gems/ansi-1.5.0/lib/ansi/mixin.rb +121 -0
- data/vendor/bundle/gems/ansi-1.5.0/lib/ansi/progressbar.rb +292 -0
- data/vendor/bundle/gems/ansi-1.5.0/lib/ansi/string.rb +254 -0
- data/vendor/bundle/gems/ansi-1.5.0/lib/ansi/table.rb +179 -0
- data/vendor/bundle/gems/ansi-1.5.0/lib/ansi/terminal.rb +44 -0
- data/vendor/bundle/gems/ansi-1.5.0/lib/ansi/terminal/curses.rb +26 -0
- data/vendor/bundle/gems/ansi-1.5.0/lib/ansi/terminal/stty.rb +62 -0
- data/vendor/bundle/gems/ansi-1.5.0/lib/ansi/terminal/termios.rb +68 -0
- data/vendor/bundle/gems/ansi-1.5.0/lib/ansi/terminal/win32.rb +107 -0
- data/vendor/bundle/gems/ansi-1.5.0/lib/ansi/version.rb +15 -0
- data/vendor/bundle/gems/ansi-1.5.0/test/case_ansicode.rb +43 -0
- data/vendor/bundle/gems/ansi-1.5.0/test/case_bbcode.rb +35 -0
- data/vendor/bundle/gems/ansi-1.5.0/test/case_mixin.rb +35 -0
- data/vendor/bundle/gems/ansi-1.5.0/test/case_progressbar.rb +21 -0
- data/vendor/bundle/gems/ansi-1.5.0/test/test_helper.rb +3 -0
- data/vendor/bundle/gems/arel-9.0.0/History.txt +332 -0
- data/vendor/bundle/gems/arel-9.0.0/MIT-LICENSE.txt +21 -0
- data/vendor/bundle/gems/arel-9.0.0/README.md +295 -0
- data/vendor/bundle/gems/arel-9.0.0/lib/arel.rb +38 -0
- data/vendor/bundle/gems/arel-9.0.0/lib/arel/alias_predication.rb +8 -0
- data/vendor/bundle/gems/arel-9.0.0/lib/arel/attributes.rb +21 -0
- data/vendor/bundle/gems/arel-9.0.0/lib/arel/attributes/attribute.rb +36 -0
- data/vendor/bundle/gems/arel-9.0.0/lib/arel/collectors/bind.rb +24 -0
- data/vendor/bundle/gems/arel-9.0.0/lib/arel/collectors/composite.rb +32 -0
- data/vendor/bundle/gems/arel-9.0.0/lib/arel/collectors/plain_string.rb +19 -0
- data/vendor/bundle/gems/arel-9.0.0/lib/arel/collectors/sql_string.rb +24 -0
- data/vendor/bundle/gems/arel-9.0.0/lib/arel/collectors/substitute_binds.rb +28 -0
- data/vendor/bundle/gems/arel-9.0.0/lib/arel/compatibility/wheres.rb +34 -0
- data/vendor/bundle/gems/arel-9.0.0/lib/arel/crud.rb +42 -0
- data/vendor/bundle/gems/arel-9.0.0/lib/arel/delete_manager.rb +24 -0
- data/vendor/bundle/gems/arel-9.0.0/lib/arel/errors.rb +8 -0
- data/vendor/bundle/gems/arel-9.0.0/lib/arel/expressions.rb +29 -0
- data/vendor/bundle/gems/arel-9.0.0/lib/arel/factory_methods.rb +44 -0
- data/vendor/bundle/gems/arel-9.0.0/lib/arel/insert_manager.rb +48 -0
- data/vendor/bundle/gems/arel-9.0.0/lib/arel/math.rb +44 -0
- data/vendor/bundle/gems/arel-9.0.0/lib/arel/nodes.rb +65 -0
- data/vendor/bundle/gems/arel-9.0.0/lib/arel/nodes/and.rb +31 -0
- data/vendor/bundle/gems/arel-9.0.0/lib/arel/nodes/ascending.rb +24 -0
- data/vendor/bundle/gems/arel-9.0.0/lib/arel/nodes/binary.rb +51 -0
- data/vendor/bundle/gems/arel-9.0.0/lib/arel/nodes/bind_param.rb +27 -0
- data/vendor/bundle/gems/arel-9.0.0/lib/arel/nodes/case.rb +58 -0
- data/vendor/bundle/gems/arel-9.0.0/lib/arel/nodes/casted.rb +45 -0
- data/vendor/bundle/gems/arel-9.0.0/lib/arel/nodes/count.rb +13 -0
- data/vendor/bundle/gems/arel-9.0.0/lib/arel/nodes/delete_statement.rb +22 -0
- data/vendor/bundle/gems/arel-9.0.0/lib/arel/nodes/descending.rb +24 -0
- data/vendor/bundle/gems/arel-9.0.0/lib/arel/nodes/equality.rb +10 -0
- data/vendor/bundle/gems/arel-9.0.0/lib/arel/nodes/extract.rb +26 -0
- data/vendor/bundle/gems/arel-9.0.0/lib/arel/nodes/false.rb +15 -0
- data/vendor/bundle/gems/arel-9.0.0/lib/arel/nodes/full_outer_join.rb +7 -0
- data/vendor/bundle/gems/arel-9.0.0/lib/arel/nodes/function.rb +46 -0
- data/vendor/bundle/gems/arel-9.0.0/lib/arel/nodes/grouping.rb +8 -0
- data/vendor/bundle/gems/arel-9.0.0/lib/arel/nodes/in.rb +7 -0
- data/vendor/bundle/gems/arel-9.0.0/lib/arel/nodes/infix_operation.rb +80 -0
- data/vendor/bundle/gems/arel-9.0.0/lib/arel/nodes/inner_join.rb +7 -0
- data/vendor/bundle/gems/arel-9.0.0/lib/arel/nodes/insert_statement.rb +36 -0
- data/vendor/bundle/gems/arel-9.0.0/lib/arel/nodes/join_source.rb +19 -0
- data/vendor/bundle/gems/arel-9.0.0/lib/arel/nodes/matches.rb +17 -0
- data/vendor/bundle/gems/arel-9.0.0/lib/arel/nodes/named_function.rb +22 -0
- data/vendor/bundle/gems/arel-9.0.0/lib/arel/nodes/node.rb +61 -0
- data/vendor/bundle/gems/arel-9.0.0/lib/arel/nodes/outer_join.rb +7 -0
- data/vendor/bundle/gems/arel-9.0.0/lib/arel/nodes/over.rb +16 -0
- data/vendor/bundle/gems/arel-9.0.0/lib/arel/nodes/regexp.rb +15 -0
- data/vendor/bundle/gems/arel-9.0.0/lib/arel/nodes/right_outer_join.rb +7 -0
- data/vendor/bundle/gems/arel-9.0.0/lib/arel/nodes/select_core.rb +64 -0
- data/vendor/bundle/gems/arel-9.0.0/lib/arel/nodes/select_statement.rb +40 -0
- data/vendor/bundle/gems/arel-9.0.0/lib/arel/nodes/sql_literal.rb +15 -0
- data/vendor/bundle/gems/arel-9.0.0/lib/arel/nodes/string_join.rb +10 -0
- data/vendor/bundle/gems/arel-9.0.0/lib/arel/nodes/table_alias.rb +26 -0
- data/vendor/bundle/gems/arel-9.0.0/lib/arel/nodes/terminal.rb +15 -0
- data/vendor/bundle/gems/arel-9.0.0/lib/arel/nodes/true.rb +15 -0
- data/vendor/bundle/gems/arel-9.0.0/lib/arel/nodes/unary.rb +43 -0
- data/vendor/bundle/gems/arel-9.0.0/lib/arel/nodes/unary_operation.rb +26 -0
- data/vendor/bundle/gems/arel-9.0.0/lib/arel/nodes/unqualified_column.rb +21 -0
- data/vendor/bundle/gems/arel-9.0.0/lib/arel/nodes/update_statement.rb +39 -0
- data/vendor/bundle/gems/arel-9.0.0/lib/arel/nodes/values.rb +15 -0
- data/vendor/bundle/gems/arel-9.0.0/lib/arel/nodes/values_list.rb +23 -0
- data/vendor/bundle/gems/arel-9.0.0/lib/arel/nodes/window.rb +125 -0
- data/vendor/bundle/gems/arel-9.0.0/lib/arel/nodes/with.rb +11 -0
- data/vendor/bundle/gems/arel-9.0.0/lib/arel/order_predications.rb +14 -0
- data/vendor/bundle/gems/arel-9.0.0/lib/arel/predications.rb +240 -0
- data/vendor/bundle/gems/arel-9.0.0/lib/arel/select_manager.rb +269 -0
- data/vendor/bundle/gems/arel-9.0.0/lib/arel/table.rb +110 -0
- data/vendor/bundle/gems/arel-9.0.0/lib/arel/tree_manager.rb +39 -0
- data/vendor/bundle/gems/arel-9.0.0/lib/arel/update_manager.rb +58 -0
- data/vendor/bundle/gems/arel-9.0.0/lib/arel/visitors.rb +19 -0
- data/vendor/bundle/gems/arel-9.0.0/lib/arel/visitors/depth_first.rb +198 -0
- data/vendor/bundle/gems/arel-9.0.0/lib/arel/visitors/dot.rb +291 -0
- data/vendor/bundle/gems/arel-9.0.0/lib/arel/visitors/ibm_db.rb +15 -0
- data/vendor/bundle/gems/arel-9.0.0/lib/arel/visitors/informix.rb +55 -0
- data/vendor/bundle/gems/arel-9.0.0/lib/arel/visitors/mssql.rb +124 -0
- data/vendor/bundle/gems/arel-9.0.0/lib/arel/visitors/mysql.rb +86 -0
- data/vendor/bundle/gems/arel-9.0.0/lib/arel/visitors/oracle.rb +153 -0
- data/vendor/bundle/gems/arel-9.0.0/lib/arel/visitors/oracle12.rb +60 -0
- data/vendor/bundle/gems/arel-9.0.0/lib/arel/visitors/postgresql.rb +85 -0
- data/vendor/bundle/gems/arel-9.0.0/lib/arel/visitors/reduce.rb +27 -0
- data/vendor/bundle/gems/arel-9.0.0/lib/arel/visitors/sqlite.rb +27 -0
- data/vendor/bundle/gems/arel-9.0.0/lib/arel/visitors/to_sql.rb +850 -0
- data/vendor/bundle/gems/arel-9.0.0/lib/arel/visitors/visitor.rb +43 -0
- data/vendor/bundle/gems/arel-9.0.0/lib/arel/visitors/where_sql.rb +22 -0
- data/vendor/bundle/gems/arel-9.0.0/lib/arel/window_predications.rb +10 -0
- data/vendor/bundle/gems/builder-3.2.3/CHANGES +107 -0
- data/vendor/bundle/gems/builder-3.2.3/MIT-LICENSE +20 -0
- data/vendor/bundle/gems/builder-3.2.3/README.md +258 -0
- data/vendor/bundle/gems/builder-3.2.3/Rakefile +195 -0
- data/vendor/bundle/gems/builder-3.2.3/doc/jamis.rb +591 -0
- data/vendor/bundle/gems/builder-3.2.3/doc/releases/builder-1.2.4.rdoc +31 -0
- data/vendor/bundle/gems/builder-3.2.3/doc/releases/builder-2.0.0.rdoc +46 -0
- data/vendor/bundle/gems/builder-3.2.3/doc/releases/builder-2.1.1.rdoc +58 -0
- data/vendor/bundle/gems/builder-3.2.3/lib/blankslate.rb +137 -0
- data/vendor/bundle/gems/builder-3.2.3/lib/builder.rb +13 -0
- data/vendor/bundle/gems/builder-3.2.3/lib/builder/blankslate.rb +23 -0
- data/vendor/bundle/gems/builder-3.2.3/lib/builder/version.rb +8 -0
- data/vendor/bundle/gems/builder-3.2.3/lib/builder/xchar.rb +197 -0
- data/vendor/bundle/gems/builder-3.2.3/lib/builder/xmlbase.rb +199 -0
- data/vendor/bundle/gems/builder-3.2.3/lib/builder/xmlevents.rb +63 -0
- data/vendor/bundle/gems/builder-3.2.3/lib/builder/xmlmarkup.rb +339 -0
- data/vendor/bundle/gems/builder-3.2.3/rakelib/publish.rake +20 -0
- data/vendor/bundle/gems/builder-3.2.3/rakelib/tags.rake +62 -0
- data/vendor/bundle/gems/builder-3.2.3/rakelib/testing.rake +7 -0
- data/vendor/bundle/gems/builder-3.2.3/test/helper.rb +12 -0
- data/vendor/bundle/gems/builder-3.2.3/test/performance.rb +41 -0
- data/vendor/bundle/gems/builder-3.2.3/test/preload.rb +39 -0
- data/vendor/bundle/gems/builder-3.2.3/test/test_blankslate.rb +213 -0
- data/vendor/bundle/gems/builder-3.2.3/test/test_eventbuilder.rb +150 -0
- data/vendor/bundle/gems/builder-3.2.3/test/test_markupbuilder.rb +611 -0
- data/vendor/bundle/gems/builder-3.2.3/test/test_method_caching.rb +62 -0
- data/vendor/bundle/gems/builder-3.2.3/test/test_namecollision.rb +39 -0
- data/vendor/bundle/gems/builder-3.2.3/test/test_xchar.rb +78 -0
- data/vendor/bundle/gems/concurrent-ruby-1.1.4/CHANGELOG.md +465 -0
- data/vendor/bundle/gems/concurrent-ruby-1.1.4/Gemfile +39 -0
- data/vendor/bundle/gems/concurrent-ruby-1.1.4/LICENSE.md +23 -0
- data/vendor/bundle/gems/concurrent-ruby-1.1.4/README.md +349 -0
- data/vendor/bundle/gems/concurrent-ruby-1.1.4/Rakefile +346 -0
- data/vendor/bundle/gems/concurrent-ruby-1.1.4/ext/concurrent-ruby/ConcurrentRubyService.java +17 -0
- data/vendor/bundle/gems/concurrent-ruby-1.1.4/ext/concurrent-ruby/com/concurrent_ruby/ext/AtomicReferenceLibrary.java +175 -0
- data/vendor/bundle/gems/concurrent-ruby-1.1.4/ext/concurrent-ruby/com/concurrent_ruby/ext/JRubyMapBackendLibrary.java +248 -0
- data/vendor/bundle/gems/concurrent-ruby-1.1.4/ext/concurrent-ruby/com/concurrent_ruby/ext/JavaAtomicBooleanLibrary.java +93 -0
- data/vendor/bundle/gems/concurrent-ruby-1.1.4/ext/concurrent-ruby/com/concurrent_ruby/ext/JavaAtomicFixnumLibrary.java +113 -0
- data/vendor/bundle/gems/concurrent-ruby-1.1.4/ext/concurrent-ruby/com/concurrent_ruby/ext/JavaSemaphoreLibrary.java +159 -0
- data/vendor/bundle/gems/concurrent-ruby-1.1.4/ext/concurrent-ruby/com/concurrent_ruby/ext/SynchronizationLibrary.java +306 -0
- data/vendor/bundle/gems/concurrent-ruby-1.1.4/ext/concurrent-ruby/com/concurrent_ruby/ext/jsr166e/ConcurrentHashMap.java +31 -0
- data/vendor/bundle/gems/concurrent-ruby-1.1.4/ext/concurrent-ruby/com/concurrent_ruby/ext/jsr166e/ConcurrentHashMapV8.java +3863 -0
- data/vendor/bundle/gems/concurrent-ruby-1.1.4/ext/concurrent-ruby/com/concurrent_ruby/ext/jsr166e/LongAdder.java +203 -0
- data/vendor/bundle/gems/concurrent-ruby-1.1.4/ext/concurrent-ruby/com/concurrent_ruby/ext/jsr166e/Striped64.java +342 -0
- data/vendor/bundle/gems/concurrent-ruby-1.1.4/ext/concurrent-ruby/com/concurrent_ruby/ext/jsr166e/nounsafe/ConcurrentHashMapV8.java +3800 -0
- data/vendor/bundle/gems/concurrent-ruby-1.1.4/ext/concurrent-ruby/com/concurrent_ruby/ext/jsr166e/nounsafe/LongAdder.java +204 -0
- data/vendor/bundle/gems/concurrent-ruby-1.1.4/ext/concurrent-ruby/com/concurrent_ruby/ext/jsr166e/nounsafe/Striped64.java +291 -0
- data/vendor/bundle/gems/concurrent-ruby-1.1.4/ext/concurrent-ruby/com/concurrent_ruby/ext/jsr166y/ThreadLocalRandom.java +199 -0
- data/vendor/bundle/gems/concurrent-ruby-1.1.4/lib/concurrent-ruby.rb +1 -0
- data/vendor/bundle/gems/concurrent-ruby-1.1.4/lib/concurrent.rb +134 -0
- data/vendor/bundle/gems/concurrent-ruby-1.1.4/lib/concurrent/agent.rb +587 -0
- data/vendor/bundle/gems/concurrent-ruby-1.1.4/lib/concurrent/array.rb +66 -0
- data/vendor/bundle/gems/concurrent-ruby-1.1.4/lib/concurrent/async.rb +445 -0
- data/vendor/bundle/gems/concurrent-ruby-1.1.4/lib/concurrent/atom.rb +222 -0
- data/vendor/bundle/gems/concurrent-ruby-1.1.4/lib/concurrent/atomic/abstract_thread_local_var.rb +66 -0
- data/vendor/bundle/gems/concurrent-ruby-1.1.4/lib/concurrent/atomic/atomic_boolean.rb +126 -0
- data/vendor/bundle/gems/concurrent-ruby-1.1.4/lib/concurrent/atomic/atomic_fixnum.rb +143 -0
- data/vendor/bundle/gems/concurrent-ruby-1.1.4/lib/concurrent/atomic/atomic_markable_reference.rb +164 -0
- data/vendor/bundle/gems/concurrent-ruby-1.1.4/lib/concurrent/atomic/atomic_reference.rb +204 -0
- data/vendor/bundle/gems/concurrent-ruby-1.1.4/lib/concurrent/atomic/count_down_latch.rb +100 -0
- data/vendor/bundle/gems/concurrent-ruby-1.1.4/lib/concurrent/atomic/cyclic_barrier.rb +128 -0
- data/vendor/bundle/gems/concurrent-ruby-1.1.4/lib/concurrent/atomic/event.rb +109 -0
- data/vendor/bundle/gems/concurrent-ruby-1.1.4/lib/concurrent/atomic/java_count_down_latch.rb +42 -0
- data/vendor/bundle/gems/concurrent-ruby-1.1.4/lib/concurrent/atomic/java_thread_local_var.rb +37 -0
- data/vendor/bundle/gems/concurrent-ruby-1.1.4/lib/concurrent/atomic/mutex_atomic_boolean.rb +62 -0
- data/vendor/bundle/gems/concurrent-ruby-1.1.4/lib/concurrent/atomic/mutex_atomic_fixnum.rb +75 -0
- data/vendor/bundle/gems/concurrent-ruby-1.1.4/lib/concurrent/atomic/mutex_count_down_latch.rb +44 -0
- data/vendor/bundle/gems/concurrent-ruby-1.1.4/lib/concurrent/atomic/mutex_semaphore.rb +115 -0
- data/vendor/bundle/gems/concurrent-ruby-1.1.4/lib/concurrent/atomic/read_write_lock.rb +254 -0
- data/vendor/bundle/gems/concurrent-ruby-1.1.4/lib/concurrent/atomic/reentrant_read_write_lock.rb +379 -0
- data/vendor/bundle/gems/concurrent-ruby-1.1.4/lib/concurrent/atomic/ruby_thread_local_var.rb +161 -0
- data/vendor/bundle/gems/concurrent-ruby-1.1.4/lib/concurrent/atomic/semaphore.rb +145 -0
- data/vendor/bundle/gems/concurrent-ruby-1.1.4/lib/concurrent/atomic/thread_local_var.rb +104 -0
- data/vendor/bundle/gems/concurrent-ruby-1.1.4/lib/concurrent/atomic_reference/mutex_atomic.rb +56 -0
- data/vendor/bundle/gems/concurrent-ruby-1.1.4/lib/concurrent/atomic_reference/numeric_cas_wrapper.rb +28 -0
- data/vendor/bundle/gems/concurrent-ruby-1.1.4/lib/concurrent/atomics.rb +10 -0
- data/vendor/bundle/gems/concurrent-ruby-1.1.4/lib/concurrent/collection/copy_on_notify_observer_set.rb +107 -0
- data/vendor/bundle/gems/concurrent-ruby-1.1.4/lib/concurrent/collection/copy_on_write_observer_set.rb +111 -0
- data/vendor/bundle/gems/concurrent-ruby-1.1.4/lib/concurrent/collection/java_non_concurrent_priority_queue.rb +84 -0
- data/vendor/bundle/gems/concurrent-ruby-1.1.4/lib/concurrent/collection/lock_free_stack.rb +158 -0
- data/vendor/bundle/gems/concurrent-ruby-1.1.4/lib/concurrent/collection/map/atomic_reference_map_backend.rb +927 -0
- data/vendor/bundle/gems/concurrent-ruby-1.1.4/lib/concurrent/collection/map/mri_map_backend.rb +66 -0
- data/vendor/bundle/gems/concurrent-ruby-1.1.4/lib/concurrent/collection/map/non_concurrent_map_backend.rb +140 -0
- data/vendor/bundle/gems/concurrent-ruby-1.1.4/lib/concurrent/collection/map/synchronized_map_backend.rb +82 -0
- data/vendor/bundle/gems/concurrent-ruby-1.1.4/lib/concurrent/collection/non_concurrent_priority_queue.rb +143 -0
- data/vendor/bundle/gems/concurrent-ruby-1.1.4/lib/concurrent/collection/ruby_non_concurrent_priority_queue.rb +150 -0
- data/vendor/bundle/gems/concurrent-ruby-1.1.4/lib/concurrent/concern/deprecation.rb +34 -0
- data/vendor/bundle/gems/concurrent-ruby-1.1.4/lib/concurrent/concern/dereferenceable.rb +73 -0
- data/vendor/bundle/gems/concurrent-ruby-1.1.4/lib/concurrent/concern/logging.rb +32 -0
- data/vendor/bundle/gems/concurrent-ruby-1.1.4/lib/concurrent/concern/obligation.rb +220 -0
- data/vendor/bundle/gems/concurrent-ruby-1.1.4/lib/concurrent/concern/observable.rb +110 -0
- data/vendor/bundle/gems/concurrent-ruby-1.1.4/lib/concurrent/concurrent_ruby.jar +0 -0
- data/vendor/bundle/gems/concurrent-ruby-1.1.4/lib/concurrent/configuration.rb +184 -0
- data/vendor/bundle/gems/concurrent-ruby-1.1.4/lib/concurrent/constants.rb +8 -0
- data/vendor/bundle/gems/concurrent-ruby-1.1.4/lib/concurrent/dataflow.rb +81 -0
- data/vendor/bundle/gems/concurrent-ruby-1.1.4/lib/concurrent/delay.rb +199 -0
- data/vendor/bundle/gems/concurrent-ruby-1.1.4/lib/concurrent/errors.rb +69 -0
- data/vendor/bundle/gems/concurrent-ruby-1.1.4/lib/concurrent/exchanger.rb +352 -0
- data/vendor/bundle/gems/concurrent-ruby-1.1.4/lib/concurrent/executor/abstract_executor_service.rb +134 -0
- data/vendor/bundle/gems/concurrent-ruby-1.1.4/lib/concurrent/executor/cached_thread_pool.rb +62 -0
- data/vendor/bundle/gems/concurrent-ruby-1.1.4/lib/concurrent/executor/executor_service.rb +185 -0
- data/vendor/bundle/gems/concurrent-ruby-1.1.4/lib/concurrent/executor/fixed_thread_pool.rb +206 -0
- data/vendor/bundle/gems/concurrent-ruby-1.1.4/lib/concurrent/executor/immediate_executor.rb +66 -0
- data/vendor/bundle/gems/concurrent-ruby-1.1.4/lib/concurrent/executor/indirect_immediate_executor.rb +44 -0
- data/vendor/bundle/gems/concurrent-ruby-1.1.4/lib/concurrent/executor/java_executor_service.rb +91 -0
- data/vendor/bundle/gems/concurrent-ruby-1.1.4/lib/concurrent/executor/java_single_thread_executor.rb +29 -0
- data/vendor/bundle/gems/concurrent-ruby-1.1.4/lib/concurrent/executor/java_thread_pool_executor.rb +123 -0
- data/vendor/bundle/gems/concurrent-ruby-1.1.4/lib/concurrent/executor/ruby_executor_service.rb +78 -0
- data/vendor/bundle/gems/concurrent-ruby-1.1.4/lib/concurrent/executor/ruby_single_thread_executor.rb +22 -0
- data/vendor/bundle/gems/concurrent-ruby-1.1.4/lib/concurrent/executor/ruby_thread_pool_executor.rb +362 -0
- data/vendor/bundle/gems/concurrent-ruby-1.1.4/lib/concurrent/executor/safe_task_executor.rb +35 -0
- data/vendor/bundle/gems/concurrent-ruby-1.1.4/lib/concurrent/executor/serial_executor_service.rb +34 -0
- data/vendor/bundle/gems/concurrent-ruby-1.1.4/lib/concurrent/executor/serialized_execution.rb +107 -0
- data/vendor/bundle/gems/concurrent-ruby-1.1.4/lib/concurrent/executor/serialized_execution_delegator.rb +28 -0
- data/vendor/bundle/gems/concurrent-ruby-1.1.4/lib/concurrent/executor/simple_executor_service.rb +100 -0
- data/vendor/bundle/gems/concurrent-ruby-1.1.4/lib/concurrent/executor/single_thread_executor.rb +56 -0
- data/vendor/bundle/gems/concurrent-ruby-1.1.4/lib/concurrent/executor/thread_pool_executor.rb +87 -0
- data/vendor/bundle/gems/concurrent-ruby-1.1.4/lib/concurrent/executor/timer_set.rb +175 -0
- data/vendor/bundle/gems/concurrent-ruby-1.1.4/lib/concurrent/executors.rb +20 -0
- data/vendor/bundle/gems/concurrent-ruby-1.1.4/lib/concurrent/future.rb +141 -0
- data/vendor/bundle/gems/concurrent-ruby-1.1.4/lib/concurrent/hash.rb +59 -0
- data/vendor/bundle/gems/concurrent-ruby-1.1.4/lib/concurrent/immutable_struct.rb +93 -0
- data/vendor/bundle/gems/concurrent-ruby-1.1.4/lib/concurrent/ivar.rb +207 -0
- data/vendor/bundle/gems/concurrent-ruby-1.1.4/lib/concurrent/map.rb +337 -0
- data/vendor/bundle/gems/concurrent-ruby-1.1.4/lib/concurrent/maybe.rb +229 -0
- data/vendor/bundle/gems/concurrent-ruby-1.1.4/lib/concurrent/mutable_struct.rb +229 -0
- data/vendor/bundle/gems/concurrent-ruby-1.1.4/lib/concurrent/mvar.rb +242 -0
- data/vendor/bundle/gems/concurrent-ruby-1.1.4/lib/concurrent/options.rb +42 -0
- data/vendor/bundle/gems/concurrent-ruby-1.1.4/lib/concurrent/promise.rb +579 -0
- data/vendor/bundle/gems/concurrent-ruby-1.1.4/lib/concurrent/promises.rb +1936 -0
- data/vendor/bundle/gems/concurrent-ruby-1.1.4/lib/concurrent/re_include.rb +58 -0
- data/vendor/bundle/gems/concurrent-ruby-1.1.4/lib/concurrent/scheduled_task.rb +318 -0
- data/vendor/bundle/gems/concurrent-ruby-1.1.4/lib/concurrent/set.rb +66 -0
- data/vendor/bundle/gems/concurrent-ruby-1.1.4/lib/concurrent/settable_struct.rb +129 -0
- data/vendor/bundle/gems/concurrent-ruby-1.1.4/lib/concurrent/synchronization.rb +30 -0
- data/vendor/bundle/gems/concurrent-ruby-1.1.4/lib/concurrent/synchronization/abstract_lockable_object.rb +98 -0
- data/vendor/bundle/gems/concurrent-ruby-1.1.4/lib/concurrent/synchronization/abstract_object.rb +24 -0
- data/vendor/bundle/gems/concurrent-ruby-1.1.4/lib/concurrent/synchronization/abstract_struct.rb +159 -0
- data/vendor/bundle/gems/concurrent-ruby-1.1.4/lib/concurrent/synchronization/condition.rb +58 -0
- data/vendor/bundle/gems/concurrent-ruby-1.1.4/lib/concurrent/synchronization/jruby_lockable_object.rb +13 -0
- data/vendor/bundle/gems/concurrent-ruby-1.1.4/lib/concurrent/synchronization/jruby_object.rb +44 -0
- data/vendor/bundle/gems/concurrent-ruby-1.1.4/lib/concurrent/synchronization/lock.rb +34 -0
- data/vendor/bundle/gems/concurrent-ruby-1.1.4/lib/concurrent/synchronization/lockable_object.rb +74 -0
- data/vendor/bundle/gems/concurrent-ruby-1.1.4/lib/concurrent/synchronization/mri_object.rb +43 -0
- data/vendor/bundle/gems/concurrent-ruby-1.1.4/lib/concurrent/synchronization/mutex_lockable_object.rb +76 -0
- data/vendor/bundle/gems/concurrent-ruby-1.1.4/lib/concurrent/synchronization/object.rb +157 -0
- data/vendor/bundle/gems/concurrent-ruby-1.1.4/lib/concurrent/synchronization/rbx_lockable_object.rb +65 -0
- data/vendor/bundle/gems/concurrent-ruby-1.1.4/lib/concurrent/synchronization/rbx_object.rb +48 -0
- data/vendor/bundle/gems/concurrent-ruby-1.1.4/lib/concurrent/synchronization/truffleruby_object.rb +46 -0
- data/vendor/bundle/gems/concurrent-ruby-1.1.4/lib/concurrent/synchronization/volatile.rb +36 -0
- data/vendor/bundle/gems/concurrent-ruby-1.1.4/lib/concurrent/thread_safe/synchronized_delegator.rb +50 -0
- data/vendor/bundle/gems/concurrent-ruby-1.1.4/lib/concurrent/thread_safe/util.rb +16 -0
- data/vendor/bundle/gems/concurrent-ruby-1.1.4/lib/concurrent/thread_safe/util/adder.rb +74 -0
- data/vendor/bundle/gems/concurrent-ruby-1.1.4/lib/concurrent/thread_safe/util/cheap_lockable.rb +118 -0
- data/vendor/bundle/gems/concurrent-ruby-1.1.4/lib/concurrent/thread_safe/util/data_structures.rb +63 -0
- data/vendor/bundle/gems/concurrent-ruby-1.1.4/lib/concurrent/thread_safe/util/power_of_two_tuple.rb +38 -0
- data/vendor/bundle/gems/concurrent-ruby-1.1.4/lib/concurrent/thread_safe/util/striped64.rb +246 -0
- data/vendor/bundle/gems/concurrent-ruby-1.1.4/lib/concurrent/thread_safe/util/volatile.rb +75 -0
- data/vendor/bundle/gems/concurrent-ruby-1.1.4/lib/concurrent/thread_safe/util/xor_shift_random.rb +50 -0
- data/vendor/bundle/gems/concurrent-ruby-1.1.4/lib/concurrent/timer_task.rb +334 -0
- data/vendor/bundle/gems/concurrent-ruby-1.1.4/lib/concurrent/tuple.rb +86 -0
- data/vendor/bundle/gems/concurrent-ruby-1.1.4/lib/concurrent/tvar.rb +258 -0
- data/vendor/bundle/gems/concurrent-ruby-1.1.4/lib/concurrent/utility/at_exit.rb +97 -0
- data/vendor/bundle/gems/concurrent-ruby-1.1.4/lib/concurrent/utility/engine.rb +56 -0
- data/vendor/bundle/gems/concurrent-ruby-1.1.4/lib/concurrent/utility/monotonic_time.rb +58 -0
- data/vendor/bundle/gems/concurrent-ruby-1.1.4/lib/concurrent/utility/native_extension_loader.rb +79 -0
- data/vendor/bundle/gems/concurrent-ruby-1.1.4/lib/concurrent/utility/native_integer.rb +53 -0
- data/vendor/bundle/gems/concurrent-ruby-1.1.4/lib/concurrent/utility/processor_counter.rb +158 -0
- data/vendor/bundle/gems/concurrent-ruby-1.1.4/lib/concurrent/version.rb +4 -0
- data/vendor/bundle/gems/i18n-1.3.0/MIT-LICENSE +20 -0
- data/vendor/bundle/gems/i18n-1.3.0/README.md +125 -0
- data/vendor/bundle/gems/i18n-1.3.0/lib/i18n.rb +383 -0
- data/vendor/bundle/gems/i18n-1.3.0/lib/i18n/backend.rb +21 -0
- data/vendor/bundle/gems/i18n-1.3.0/lib/i18n/backend/base.rb +269 -0
- data/vendor/bundle/gems/i18n-1.3.0/lib/i18n/backend/cache.rb +116 -0
- data/vendor/bundle/gems/i18n-1.3.0/lib/i18n/backend/cache_file.rb +36 -0
- data/vendor/bundle/gems/i18n-1.3.0/lib/i18n/backend/cascade.rb +56 -0
- data/vendor/bundle/gems/i18n-1.3.0/lib/i18n/backend/chain.rb +123 -0
- data/vendor/bundle/gems/i18n-1.3.0/lib/i18n/backend/fallbacks.rb +84 -0
- data/vendor/bundle/gems/i18n-1.3.0/lib/i18n/backend/flatten.rb +115 -0
- data/vendor/bundle/gems/i18n-1.3.0/lib/i18n/backend/gettext.rb +85 -0
- data/vendor/bundle/gems/i18n-1.3.0/lib/i18n/backend/interpolation_compiler.rb +123 -0
- data/vendor/bundle/gems/i18n-1.3.0/lib/i18n/backend/key_value.rb +206 -0
- data/vendor/bundle/gems/i18n-1.3.0/lib/i18n/backend/memoize.rb +48 -0
- data/vendor/bundle/gems/i18n-1.3.0/lib/i18n/backend/metadata.rb +71 -0
- data/vendor/bundle/gems/i18n-1.3.0/lib/i18n/backend/pluralization.rb +55 -0
- data/vendor/bundle/gems/i18n-1.3.0/lib/i18n/backend/simple.rb +106 -0
- data/vendor/bundle/gems/i18n-1.3.0/lib/i18n/backend/transliterator.rb +108 -0
- data/vendor/bundle/gems/i18n-1.3.0/lib/i18n/config.rb +165 -0
- data/vendor/bundle/gems/i18n-1.3.0/lib/i18n/core_ext/hash.rb +37 -0
- data/vendor/bundle/gems/i18n-1.3.0/lib/i18n/core_ext/string/interpolate.rb +9 -0
- data/vendor/bundle/gems/i18n-1.3.0/lib/i18n/exceptions.rb +97 -0
- data/vendor/bundle/gems/i18n-1.3.0/lib/i18n/gettext.rb +28 -0
- data/vendor/bundle/gems/i18n-1.3.0/lib/i18n/gettext/helpers.rb +75 -0
- data/vendor/bundle/gems/i18n-1.3.0/lib/i18n/gettext/po_parser.rb +329 -0
- data/vendor/bundle/gems/i18n-1.3.0/lib/i18n/interpolate/ruby.rb +39 -0
- data/vendor/bundle/gems/i18n-1.3.0/lib/i18n/locale.rb +8 -0
- data/vendor/bundle/gems/i18n-1.3.0/lib/i18n/locale/fallbacks.rb +96 -0
- data/vendor/bundle/gems/i18n-1.3.0/lib/i18n/locale/tag.rb +28 -0
- data/vendor/bundle/gems/i18n-1.3.0/lib/i18n/locale/tag/parents.rb +22 -0
- data/vendor/bundle/gems/i18n-1.3.0/lib/i18n/locale/tag/rfc4646.rb +74 -0
- data/vendor/bundle/gems/i18n-1.3.0/lib/i18n/locale/tag/simple.rb +39 -0
- data/vendor/bundle/gems/i18n-1.3.0/lib/i18n/middleware.rb +17 -0
- data/vendor/bundle/gems/i18n-1.3.0/lib/i18n/tests.rb +14 -0
- data/vendor/bundle/gems/i18n-1.3.0/lib/i18n/tests/basics.rb +60 -0
- data/vendor/bundle/gems/i18n-1.3.0/lib/i18n/tests/defaults.rb +52 -0
- data/vendor/bundle/gems/i18n-1.3.0/lib/i18n/tests/interpolation.rb +159 -0
- data/vendor/bundle/gems/i18n-1.3.0/lib/i18n/tests/link.rb +56 -0
- data/vendor/bundle/gems/i18n-1.3.0/lib/i18n/tests/localization.rb +19 -0
- data/vendor/bundle/gems/i18n-1.3.0/lib/i18n/tests/localization/date.rb +95 -0
- data/vendor/bundle/gems/i18n-1.3.0/lib/i18n/tests/localization/date_time.rb +82 -0
- data/vendor/bundle/gems/i18n-1.3.0/lib/i18n/tests/localization/procs.rb +116 -0
- data/vendor/bundle/gems/i18n-1.3.0/lib/i18n/tests/localization/time.rb +81 -0
- data/vendor/bundle/gems/i18n-1.3.0/lib/i18n/tests/lookup.rb +81 -0
- data/vendor/bundle/gems/i18n-1.3.0/lib/i18n/tests/pluralization.rb +35 -0
- data/vendor/bundle/gems/i18n-1.3.0/lib/i18n/tests/procs.rb +55 -0
- data/vendor/bundle/gems/i18n-1.3.0/lib/i18n/version.rb +5 -0
- data/vendor/bundle/gems/minitest-5.11.3/.autotest +34 -0
- data/vendor/bundle/gems/minitest-5.11.3/History.rdoc +1310 -0
- data/vendor/bundle/gems/minitest-5.11.3/Manifest.txt +26 -0
- data/vendor/bundle/gems/minitest-5.11.3/README.rdoc +746 -0
- data/vendor/bundle/gems/minitest-5.11.3/Rakefile +86 -0
- data/vendor/bundle/gems/minitest-5.11.3/design_rationale.rb +52 -0
- data/vendor/bundle/gems/minitest-5.11.3/lib/hoe/minitest.rb +32 -0
- data/vendor/bundle/gems/minitest-5.11.3/lib/minitest.rb +987 -0
- data/vendor/bundle/gems/minitest-5.11.3/lib/minitest/assertions.rb +693 -0
- data/vendor/bundle/gems/minitest-5.11.3/lib/minitest/autorun.rb +13 -0
- data/vendor/bundle/gems/minitest-5.11.3/lib/minitest/benchmark.rb +455 -0
- data/vendor/bundle/gems/minitest-5.11.3/lib/minitest/expectations.rb +284 -0
- data/vendor/bundle/gems/minitest-5.11.3/lib/minitest/hell.rb +11 -0
- data/vendor/bundle/gems/minitest-5.11.3/lib/minitest/mock.rb +240 -0
- data/vendor/bundle/gems/minitest-5.11.3/lib/minitest/parallel.rb +70 -0
- data/vendor/bundle/gems/minitest-5.11.3/lib/minitest/pride.rb +4 -0
- data/vendor/bundle/gems/minitest-5.11.3/lib/minitest/pride_plugin.rb +142 -0
- data/vendor/bundle/gems/minitest-5.11.3/lib/minitest/spec.rb +331 -0
- data/vendor/bundle/gems/minitest-5.11.3/lib/minitest/test.rb +220 -0
- data/vendor/bundle/gems/minitest-5.11.3/lib/minitest/unit.rb +45 -0
- data/vendor/bundle/gems/minitest-5.11.3/test/minitest/metametameta.rb +102 -0
- data/vendor/bundle/gems/minitest-5.11.3/test/minitest/test_minitest_benchmark.rb +137 -0
- data/vendor/bundle/gems/minitest-5.11.3/test/minitest/test_minitest_mock.rb +874 -0
- data/vendor/bundle/gems/minitest-5.11.3/test/minitest/test_minitest_reporter.rb +299 -0
- data/vendor/bundle/gems/minitest-5.11.3/test/minitest/test_minitest_spec.rb +987 -0
- data/vendor/bundle/gems/minitest-5.11.3/test/minitest/test_minitest_test.rb +2142 -0
- data/vendor/bundle/gems/minitest-reporters-1.3.5/.gitignore +27 -0
- data/vendor/bundle/gems/minitest-reporters-1.3.5/.rubocop.yml +77 -0
- data/vendor/bundle/gems/minitest-reporters-1.3.5/.ruby-gemset +1 -0
- data/vendor/bundle/gems/minitest-reporters-1.3.5/.travis.yml +13 -0
- data/vendor/bundle/gems/minitest-reporters-1.3.5/.yardopts +6 -0
- data/vendor/bundle/gems/minitest-reporters-1.3.5/CHANGELOG.md +88 -0
- data/vendor/bundle/gems/minitest-reporters-1.3.5/Gemfile +2 -0
- data/vendor/bundle/gems/minitest-reporters-1.3.5/LICENSE +20 -0
- data/vendor/bundle/gems/minitest-reporters-1.3.5/README.md +135 -0
- data/vendor/bundle/gems/minitest-reporters-1.3.5/Rakefile +70 -0
- data/vendor/bundle/gems/minitest-reporters-1.3.5/appveyor.yml +22 -0
- data/vendor/bundle/gems/minitest-reporters-1.3.5/assets/default-reporter.png +0 -0
- data/vendor/bundle/gems/minitest-reporters-1.3.5/assets/mean_time_reporter.png +0 -0
- data/vendor/bundle/gems/minitest-reporters-1.3.5/assets/progress-reporter.png +0 -0
- data/vendor/bundle/gems/minitest-reporters-1.3.5/assets/spec-reporter.png +0 -0
- data/vendor/bundle/gems/minitest-reporters-1.3.5/lib/minitest/extensible_backtrace_filter.rb +67 -0
- data/vendor/bundle/gems/minitest-reporters-1.3.5/lib/minitest/minitest_reporter_plugin.rb +76 -0
- data/vendor/bundle/gems/minitest-reporters-1.3.5/lib/minitest/old_activesupport_fix.rb +24 -0
- data/vendor/bundle/gems/minitest-reporters-1.3.5/lib/minitest/relative_position.rb +26 -0
- data/vendor/bundle/gems/minitest-reporters-1.3.5/lib/minitest/reporters.rb +91 -0
- data/vendor/bundle/gems/minitest-reporters-1.3.5/lib/minitest/reporters/ansi.rb +30 -0
- data/vendor/bundle/gems/minitest-reporters-1.3.5/lib/minitest/reporters/base_reporter.rb +134 -0
- data/vendor/bundle/gems/minitest-reporters-1.3.5/lib/minitest/reporters/default_reporter.rb +228 -0
- data/vendor/bundle/gems/minitest-reporters-1.3.5/lib/minitest/reporters/html_reporter.rb +224 -0
- data/vendor/bundle/gems/minitest-reporters-1.3.5/lib/minitest/reporters/junit_reporter.rb +164 -0
- data/vendor/bundle/gems/minitest-reporters-1.3.5/lib/minitest/reporters/mean_time_reporter.rb +388 -0
- data/vendor/bundle/gems/minitest-reporters-1.3.5/lib/minitest/reporters/progress_reporter.rb +96 -0
- data/vendor/bundle/gems/minitest-reporters-1.3.5/lib/minitest/reporters/ruby_mate_reporter.rb +54 -0
- data/vendor/bundle/gems/minitest-reporters-1.3.5/lib/minitest/reporters/rubymine_reporter.rb +116 -0
- data/vendor/bundle/gems/minitest-reporters-1.3.5/lib/minitest/reporters/spec_reporter.rb +61 -0
- data/vendor/bundle/gems/minitest-reporters-1.3.5/lib/minitest/reporters/version.rb +5 -0
- data/vendor/bundle/gems/minitest-reporters-1.3.5/lib/minitest/templates/index.html.erb +83 -0
- data/vendor/bundle/gems/minitest-reporters-1.3.5/minitest-reporters.gemspec +32 -0
- data/vendor/bundle/gems/minitest-reporters-1.3.5/test/fixtures/junit_filename_bug_example_test.rb +41 -0
- data/vendor/bundle/gems/minitest-reporters-1.3.5/test/fixtures/mean_time_test.rb +36 -0
- data/vendor/bundle/gems/minitest-reporters-1.3.5/test/fixtures/progress_detailed_skip_test.rb +8 -0
- data/vendor/bundle/gems/minitest-reporters-1.3.5/test/fixtures/progress_test.rb +8 -0
- data/vendor/bundle/gems/minitest-reporters-1.3.5/test/fixtures/sample_test.rb +15 -0
- data/vendor/bundle/gems/minitest-reporters-1.3.5/test/fixtures/spec_test.rb +18 -0
- data/vendor/bundle/gems/minitest-reporters-1.3.5/test/gallery/bad_test.rb +25 -0
- data/vendor/bundle/gems/minitest-reporters-1.3.5/test/gallery/good_test.rb +14 -0
- data/vendor/bundle/gems/minitest-reporters-1.3.5/test/integration/reporters/junit_reporter_test.rb +12 -0
- data/vendor/bundle/gems/minitest-reporters-1.3.5/test/integration/reporters/mean_time_reporter_test.rb +7 -0
- data/vendor/bundle/gems/minitest-reporters-1.3.5/test/integration/reporters/progress_reporter_test.rb +40 -0
- data/vendor/bundle/gems/minitest-reporters-1.3.5/test/test_helper.rb +22 -0
- data/vendor/bundle/gems/minitest-reporters-1.3.5/test/unit/minitest/extensible_backtrace_filter_test.rb +42 -0
- data/vendor/bundle/gems/minitest-reporters-1.3.5/test/unit/minitest/junit_reporter_test.rb +23 -0
- data/vendor/bundle/gems/minitest-reporters-1.3.5/test/unit/minitest/mean_time_reporter_unit_test.rb +149 -0
- data/vendor/bundle/gems/minitest-reporters-1.3.5/test/unit/minitest/minitest_reporter_plugin_test.rb +14 -0
- data/vendor/bundle/gems/minitest-reporters-1.3.5/test/unit/minitest/reporters_test.rb +65 -0
- data/vendor/bundle/gems/minitest-reporters-1.3.5/test/unit/minitest/spec_reporter_test.rb +62 -0
- data/vendor/bundle/gems/rake-10.5.0/.autotest +7 -0
- data/vendor/bundle/gems/rake-10.5.0/.rubocop.yml +27 -0
- data/vendor/bundle/gems/rake-10.5.0/.togglerc +7 -0
- data/vendor/bundle/gems/rake-10.5.0/CONTRIBUTING.rdoc +38 -0
- data/vendor/bundle/gems/rake-10.5.0/History.rdoc +659 -0
- data/vendor/bundle/gems/rake-10.5.0/MIT-LICENSE +21 -0
- data/vendor/bundle/gems/rake-10.5.0/Manifest.txt +166 -0
- data/vendor/bundle/gems/rake-10.5.0/README.rdoc +139 -0
- data/vendor/bundle/gems/rake-10.5.0/Rakefile +81 -0
- data/vendor/bundle/gems/rake-10.5.0/bin/rake +33 -0
- data/vendor/bundle/gems/rake-10.5.0/doc/command_line_usage.rdoc +158 -0
- data/vendor/bundle/gems/rake-10.5.0/doc/example/Rakefile1 +38 -0
- data/vendor/bundle/gems/rake-10.5.0/doc/example/Rakefile2 +35 -0
- data/vendor/bundle/gems/rake-10.5.0/doc/example/a.c +6 -0
- data/vendor/bundle/gems/rake-10.5.0/doc/example/b.c +6 -0
- data/vendor/bundle/gems/rake-10.5.0/doc/example/main.c +11 -0
- data/vendor/bundle/gems/rake-10.5.0/doc/glossary.rdoc +42 -0
- data/vendor/bundle/gems/rake-10.5.0/doc/jamis.rb +591 -0
- data/vendor/bundle/gems/rake-10.5.0/doc/proto_rake.rdoc +127 -0
- data/vendor/bundle/gems/rake-10.5.0/doc/rake.1 +141 -0
- data/vendor/bundle/gems/rake-10.5.0/doc/rakefile.rdoc +624 -0
- data/vendor/bundle/gems/rake-10.5.0/doc/rational.rdoc +151 -0
- data/vendor/bundle/gems/rake-10.5.0/doc/release_notes/rake-0.4.14.rdoc +23 -0
- data/vendor/bundle/gems/rake-10.5.0/doc/release_notes/rake-0.4.15.rdoc +35 -0
- data/vendor/bundle/gems/rake-10.5.0/doc/release_notes/rake-0.5.0.rdoc +53 -0
- data/vendor/bundle/gems/rake-10.5.0/doc/release_notes/rake-0.5.3.rdoc +78 -0
- data/vendor/bundle/gems/rake-10.5.0/doc/release_notes/rake-0.5.4.rdoc +46 -0
- data/vendor/bundle/gems/rake-10.5.0/doc/release_notes/rake-0.6.0.rdoc +141 -0
- data/vendor/bundle/gems/rake-10.5.0/doc/release_notes/rake-0.7.0.rdoc +119 -0
- data/vendor/bundle/gems/rake-10.5.0/doc/release_notes/rake-0.7.1.rdoc +59 -0
- data/vendor/bundle/gems/rake-10.5.0/doc/release_notes/rake-0.7.2.rdoc +121 -0
- data/vendor/bundle/gems/rake-10.5.0/doc/release_notes/rake-0.7.3.rdoc +47 -0
- data/vendor/bundle/gems/rake-10.5.0/doc/release_notes/rake-0.8.0.rdoc +114 -0
- data/vendor/bundle/gems/rake-10.5.0/doc/release_notes/rake-0.8.2.rdoc +165 -0
- data/vendor/bundle/gems/rake-10.5.0/doc/release_notes/rake-0.8.3.rdoc +112 -0
- data/vendor/bundle/gems/rake-10.5.0/doc/release_notes/rake-0.8.4.rdoc +147 -0
- data/vendor/bundle/gems/rake-10.5.0/doc/release_notes/rake-0.8.5.rdoc +53 -0
- data/vendor/bundle/gems/rake-10.5.0/doc/release_notes/rake-0.8.6.rdoc +37 -0
- data/vendor/bundle/gems/rake-10.5.0/doc/release_notes/rake-0.8.7.rdoc +55 -0
- data/vendor/bundle/gems/rake-10.5.0/doc/release_notes/rake-0.9.0.rdoc +112 -0
- data/vendor/bundle/gems/rake-10.5.0/doc/release_notes/rake-0.9.1.rdoc +52 -0
- data/vendor/bundle/gems/rake-10.5.0/doc/release_notes/rake-0.9.2.2.rdoc +55 -0
- data/vendor/bundle/gems/rake-10.5.0/doc/release_notes/rake-0.9.2.rdoc +49 -0
- data/vendor/bundle/gems/rake-10.5.0/doc/release_notes/rake-0.9.3.rdoc +102 -0
- data/vendor/bundle/gems/rake-10.5.0/doc/release_notes/rake-0.9.4.rdoc +60 -0
- data/vendor/bundle/gems/rake-10.5.0/doc/release_notes/rake-0.9.5.rdoc +55 -0
- data/vendor/bundle/gems/rake-10.5.0/doc/release_notes/rake-0.9.6.rdoc +64 -0
- data/vendor/bundle/gems/rake-10.5.0/doc/release_notes/rake-10.0.0.rdoc +178 -0
- data/vendor/bundle/gems/rake-10.5.0/doc/release_notes/rake-10.0.1.rdoc +58 -0
- data/vendor/bundle/gems/rake-10.5.0/doc/release_notes/rake-10.0.2.rdoc +53 -0
- data/vendor/bundle/gems/rake-10.5.0/doc/release_notes/rake-10.0.3.rdoc +191 -0
- data/vendor/bundle/gems/rake-10.5.0/doc/release_notes/rake-10.1.0.rdoc +61 -0
- data/vendor/bundle/gems/rake-10.5.0/lib/rake.rb +79 -0
- data/vendor/bundle/gems/rake-10.5.0/lib/rake/alt_system.rb +110 -0
- data/vendor/bundle/gems/rake-10.5.0/lib/rake/application.rb +790 -0
- data/vendor/bundle/gems/rake-10.5.0/lib/rake/backtrace.rb +23 -0
- data/vendor/bundle/gems/rake-10.5.0/lib/rake/clean.rb +76 -0
- data/vendor/bundle/gems/rake-10.5.0/lib/rake/cloneable.rb +16 -0
- data/vendor/bundle/gems/rake-10.5.0/lib/rake/contrib/.document +1 -0
- data/vendor/bundle/gems/rake-10.5.0/lib/rake/contrib/compositepublisher.rb +21 -0
- data/vendor/bundle/gems/rake-10.5.0/lib/rake/contrib/ftptools.rb +137 -0
- data/vendor/bundle/gems/rake-10.5.0/lib/rake/contrib/publisher.rb +81 -0
- data/vendor/bundle/gems/rake-10.5.0/lib/rake/contrib/rubyforgepublisher.rb +18 -0
- data/vendor/bundle/gems/rake-10.5.0/lib/rake/contrib/sshpublisher.rb +61 -0
- data/vendor/bundle/gems/rake-10.5.0/lib/rake/contrib/sys.rb +4 -0
- data/vendor/bundle/gems/rake-10.5.0/lib/rake/cpu_counter.rb +125 -0
- data/vendor/bundle/gems/rake-10.5.0/lib/rake/default_loader.rb +14 -0
- data/vendor/bundle/gems/rake-10.5.0/lib/rake/dsl_definition.rb +201 -0
- data/vendor/bundle/gems/rake-10.5.0/lib/rake/early_time.rb +21 -0
- data/vendor/bundle/gems/rake-10.5.0/lib/rake/ext/core.rb +25 -0
- data/vendor/bundle/gems/rake-10.5.0/lib/rake/ext/module.rb +2 -0
- data/vendor/bundle/gems/rake-10.5.0/lib/rake/ext/pathname.rb +25 -0
- data/vendor/bundle/gems/rake-10.5.0/lib/rake/ext/string.rb +175 -0
- data/vendor/bundle/gems/rake-10.5.0/lib/rake/ext/time.rb +18 -0
- data/vendor/bundle/gems/rake-10.5.0/lib/rake/file_creation_task.rb +24 -0
- data/vendor/bundle/gems/rake-10.5.0/lib/rake/file_list.rb +428 -0
- data/vendor/bundle/gems/rake-10.5.0/lib/rake/file_task.rb +46 -0
- data/vendor/bundle/gems/rake-10.5.0/lib/rake/file_utils.rb +128 -0
- data/vendor/bundle/gems/rake-10.5.0/lib/rake/file_utils_ext.rb +144 -0
- data/vendor/bundle/gems/rake-10.5.0/lib/rake/gempackagetask.rb +4 -0
- data/vendor/bundle/gems/rake-10.5.0/lib/rake/invocation_chain.rb +56 -0
- data/vendor/bundle/gems/rake-10.5.0/lib/rake/invocation_exception_mixin.rb +16 -0
- data/vendor/bundle/gems/rake-10.5.0/lib/rake/late_time.rb +17 -0
- data/vendor/bundle/gems/rake-10.5.0/lib/rake/linked_list.rb +103 -0
- data/vendor/bundle/gems/rake-10.5.0/lib/rake/loaders/makefile.rb +53 -0
- data/vendor/bundle/gems/rake-10.5.0/lib/rake/multi_task.rb +13 -0
- data/vendor/bundle/gems/rake-10.5.0/lib/rake/name_space.rb +38 -0
- data/vendor/bundle/gems/rake-10.5.0/lib/rake/packagetask.rb +199 -0
- data/vendor/bundle/gems/rake-10.5.0/lib/rake/pathmap.rb +3 -0
- data/vendor/bundle/gems/rake-10.5.0/lib/rake/phony.rb +15 -0
- data/vendor/bundle/gems/rake-10.5.0/lib/rake/private_reader.rb +20 -0
- data/vendor/bundle/gems/rake-10.5.0/lib/rake/promise.rb +99 -0
- data/vendor/bundle/gems/rake-10.5.0/lib/rake/pseudo_status.rb +29 -0
- data/vendor/bundle/gems/rake-10.5.0/lib/rake/rake_module.rb +38 -0
- data/vendor/bundle/gems/rake-10.5.0/lib/rake/rake_test_loader.rb +22 -0
- data/vendor/bundle/gems/rake-10.5.0/lib/rake/rdoctask.rb +4 -0
- data/vendor/bundle/gems/rake-10.5.0/lib/rake/ruby182_test_unit_fix.rb +29 -0
- data/vendor/bundle/gems/rake-10.5.0/lib/rake/rule_recursion_overflow_error.rb +20 -0
- data/vendor/bundle/gems/rake-10.5.0/lib/rake/runtest.rb +27 -0
- data/vendor/bundle/gems/rake-10.5.0/lib/rake/scope.rb +42 -0
- data/vendor/bundle/gems/rake-10.5.0/lib/rake/task.rb +383 -0
- data/vendor/bundle/gems/rake-10.5.0/lib/rake/task_argument_error.rb +7 -0
- data/vendor/bundle/gems/rake-10.5.0/lib/rake/task_arguments.rb +98 -0
- data/vendor/bundle/gems/rake-10.5.0/lib/rake/task_manager.rb +307 -0
- data/vendor/bundle/gems/rake-10.5.0/lib/rake/tasklib.rb +24 -0
- data/vendor/bundle/gems/rake-10.5.0/lib/rake/testtask.rb +213 -0
- data/vendor/bundle/gems/rake-10.5.0/lib/rake/thread_history_display.rb +48 -0
- data/vendor/bundle/gems/rake-10.5.0/lib/rake/thread_pool.rb +164 -0
- data/vendor/bundle/gems/rake-10.5.0/lib/rake/trace_output.rb +22 -0
- data/vendor/bundle/gems/rake-10.5.0/lib/rake/version.rb +7 -0
- data/vendor/bundle/gems/rake-10.5.0/lib/rake/win32.rb +56 -0
- data/vendor/bundle/gems/rake-10.5.0/rakelib/publish.rake +20 -0
- data/vendor/bundle/gems/rake-10.5.0/rakelib/test_times.rake +25 -0
- data/vendor/bundle/gems/rake-10.5.0/test/file_creation.rb +34 -0
- data/vendor/bundle/gems/rake-10.5.0/test/helper.rb +129 -0
- data/vendor/bundle/gems/rake-10.5.0/test/support/rakefile_definitions.rb +478 -0
- data/vendor/bundle/gems/rake-10.5.0/test/support/ruby_runner.rb +34 -0
- data/vendor/bundle/gems/rake-10.5.0/test/test_private_reader.rb +42 -0
- data/vendor/bundle/gems/rake-10.5.0/test/test_rake.rb +40 -0
- data/vendor/bundle/gems/rake-10.5.0/test/test_rake_application.rb +643 -0
- data/vendor/bundle/gems/rake-10.5.0/test/test_rake_application_options.rb +468 -0
- data/vendor/bundle/gems/rake-10.5.0/test/test_rake_backtrace.rb +119 -0
- data/vendor/bundle/gems/rake-10.5.0/test/test_rake_clean.rb +61 -0
- data/vendor/bundle/gems/rake-10.5.0/test/test_rake_cpu_counter.rb +68 -0
- data/vendor/bundle/gems/rake-10.5.0/test/test_rake_definitions.rb +84 -0
- data/vendor/bundle/gems/rake-10.5.0/test/test_rake_directory_task.rb +76 -0
- data/vendor/bundle/gems/rake-10.5.0/test/test_rake_dsl.rb +40 -0
- data/vendor/bundle/gems/rake-10.5.0/test/test_rake_early_time.rb +31 -0
- data/vendor/bundle/gems/rake-10.5.0/test/test_rake_extension.rb +59 -0
- data/vendor/bundle/gems/rake-10.5.0/test/test_rake_file_creation_task.rb +56 -0
- data/vendor/bundle/gems/rake-10.5.0/test/test_rake_file_list.rb +670 -0
- data/vendor/bundle/gems/rake-10.5.0/test/test_rake_file_list_path_map.rb +8 -0
- data/vendor/bundle/gems/rake-10.5.0/test/test_rake_file_task.rb +197 -0
- data/vendor/bundle/gems/rake-10.5.0/test/test_rake_file_utils.rb +314 -0
- data/vendor/bundle/gems/rake-10.5.0/test/test_rake_ftp_file.rb +74 -0
- data/vendor/bundle/gems/rake-10.5.0/test/test_rake_functional.rb +482 -0
- data/vendor/bundle/gems/rake-10.5.0/test/test_rake_invocation_chain.rb +64 -0
- data/vendor/bundle/gems/rake-10.5.0/test/test_rake_late_time.rb +18 -0
- data/vendor/bundle/gems/rake-10.5.0/test/test_rake_linked_list.rb +84 -0
- data/vendor/bundle/gems/rake-10.5.0/test/test_rake_makefile_loader.rb +46 -0
- data/vendor/bundle/gems/rake-10.5.0/test/test_rake_multi_task.rb +64 -0
- data/vendor/bundle/gems/rake-10.5.0/test/test_rake_name_space.rb +57 -0
- data/vendor/bundle/gems/rake-10.5.0/test/test_rake_package_task.rb +79 -0
- data/vendor/bundle/gems/rake-10.5.0/test/test_rake_path_map.rb +168 -0
- data/vendor/bundle/gems/rake-10.5.0/test/test_rake_path_map_explode.rb +34 -0
- data/vendor/bundle/gems/rake-10.5.0/test/test_rake_path_map_partial.rb +18 -0
- data/vendor/bundle/gems/rake-10.5.0/test/test_rake_pathname_extensions.rb +15 -0
- data/vendor/bundle/gems/rake-10.5.0/test/test_rake_pseudo_status.rb +21 -0
- data/vendor/bundle/gems/rake-10.5.0/test/test_rake_rake_test_loader.rb +20 -0
- data/vendor/bundle/gems/rake-10.5.0/test/test_rake_reduce_compat.rb +26 -0
- data/vendor/bundle/gems/rake-10.5.0/test/test_rake_require.rb +40 -0
- data/vendor/bundle/gems/rake-10.5.0/test/test_rake_rules.rb +388 -0
- data/vendor/bundle/gems/rake-10.5.0/test/test_rake_scope.rb +44 -0
- data/vendor/bundle/gems/rake-10.5.0/test/test_rake_task.rb +393 -0
- data/vendor/bundle/gems/rake-10.5.0/test/test_rake_task_argument_parsing.rb +119 -0
- data/vendor/bundle/gems/rake-10.5.0/test/test_rake_task_arguments.rb +127 -0
- data/vendor/bundle/gems/rake-10.5.0/test/test_rake_task_lib.rb +9 -0
- data/vendor/bundle/gems/rake-10.5.0/test/test_rake_task_manager.rb +178 -0
- data/vendor/bundle/gems/rake-10.5.0/test/test_rake_task_manager_argument_resolution.rb +19 -0
- data/vendor/bundle/gems/rake-10.5.0/test/test_rake_task_with_arguments.rb +172 -0
- data/vendor/bundle/gems/rake-10.5.0/test/test_rake_test_task.rb +146 -0
- data/vendor/bundle/gems/rake-10.5.0/test/test_rake_thread_pool.rb +145 -0
- data/vendor/bundle/gems/rake-10.5.0/test/test_rake_top_level_functions.rb +71 -0
- data/vendor/bundle/gems/rake-10.5.0/test/test_rake_win32.rb +72 -0
- data/vendor/bundle/gems/rake-10.5.0/test/test_thread_history_display.rb +101 -0
- data/vendor/bundle/gems/rake-10.5.0/test/test_trace_output.rb +52 -0
- data/vendor/bundle/gems/ruby-progressbar-1.10.0/LICENSE.txt +19 -0
- data/vendor/bundle/gems/ruby-progressbar-1.10.0/README.md +38 -0
- data/vendor/bundle/gems/ruby-progressbar-1.10.0/Rakefile +2 -0
- data/vendor/bundle/gems/ruby-progressbar-1.10.0/lib/ruby-progressbar.rb +18 -0
- data/vendor/bundle/gems/ruby-progressbar-1.10.0/lib/ruby-progressbar/base.rb +183 -0
- data/vendor/bundle/gems/ruby-progressbar-1.10.0/lib/ruby-progressbar/calculators/length.rb +100 -0
- data/vendor/bundle/gems/ruby-progressbar-1.10.0/lib/ruby-progressbar/calculators/running_average.rb +9 -0
- data/vendor/bundle/gems/ruby-progressbar-1.10.0/lib/ruby-progressbar/components.rb +5 -0
- data/vendor/bundle/gems/ruby-progressbar-1.10.0/lib/ruby-progressbar/components/bar.rb +102 -0
- data/vendor/bundle/gems/ruby-progressbar-1.10.0/lib/ruby-progressbar/components/percentage.rb +29 -0
- data/vendor/bundle/gems/ruby-progressbar-1.10.0/lib/ruby-progressbar/components/rate.rb +43 -0
- data/vendor/bundle/gems/ruby-progressbar-1.10.0/lib/ruby-progressbar/components/time.rb +107 -0
- data/vendor/bundle/gems/ruby-progressbar-1.10.0/lib/ruby-progressbar/components/title.rb +13 -0
- data/vendor/bundle/gems/ruby-progressbar-1.10.0/lib/ruby-progressbar/errors/invalid_progress_error.rb +4 -0
- data/vendor/bundle/gems/ruby-progressbar-1.10.0/lib/ruby-progressbar/format.rb +3 -0
- data/vendor/bundle/gems/ruby-progressbar-1.10.0/lib/ruby-progressbar/format/formatter.rb +27 -0
- data/vendor/bundle/gems/ruby-progressbar-1.10.0/lib/ruby-progressbar/format/molecule.rb +60 -0
- data/vendor/bundle/gems/ruby-progressbar-1.10.0/lib/ruby-progressbar/format/string.rb +36 -0
- data/vendor/bundle/gems/ruby-progressbar-1.10.0/lib/ruby-progressbar/output.rb +68 -0
- data/vendor/bundle/gems/ruby-progressbar-1.10.0/lib/ruby-progressbar/outputs/non_tty.rb +47 -0
- data/vendor/bundle/gems/ruby-progressbar-1.10.0/lib/ruby-progressbar/outputs/null.rb +33 -0
- data/vendor/bundle/gems/ruby-progressbar-1.10.0/lib/ruby-progressbar/outputs/tty.rb +32 -0
- data/vendor/bundle/gems/ruby-progressbar-1.10.0/lib/ruby-progressbar/progress.rb +118 -0
- data/vendor/bundle/gems/ruby-progressbar-1.10.0/lib/ruby-progressbar/refinements.rb +1 -0
- data/vendor/bundle/gems/ruby-progressbar-1.10.0/lib/ruby-progressbar/refinements/enumerator.rb +23 -0
- data/vendor/bundle/gems/ruby-progressbar-1.10.0/lib/ruby-progressbar/throttle.rb +25 -0
- data/vendor/bundle/gems/ruby-progressbar-1.10.0/lib/ruby-progressbar/time.rb +32 -0
- data/vendor/bundle/gems/ruby-progressbar-1.10.0/lib/ruby-progressbar/timer.rb +72 -0
- data/vendor/bundle/gems/ruby-progressbar-1.10.0/lib/ruby-progressbar/version.rb +3 -0
- data/vendor/bundle/gems/sqlite3-1.3.13/API_CHANGES.rdoc +50 -0
- data/vendor/bundle/gems/sqlite3-1.3.13/CHANGELOG.rdoc +292 -0
- data/vendor/bundle/gems/sqlite3-1.3.13/ChangeLog.cvs +88 -0
- data/vendor/bundle/gems/sqlite3-1.3.13/Gemfile +15 -0
- data/vendor/bundle/gems/sqlite3-1.3.13/LICENSE +27 -0
- data/vendor/bundle/gems/sqlite3-1.3.13/Manifest.txt +52 -0
- data/vendor/bundle/gems/sqlite3-1.3.13/README.rdoc +118 -0
- data/vendor/bundle/gems/sqlite3-1.3.13/Rakefile +10 -0
- data/vendor/bundle/gems/sqlite3-1.3.13/ext/sqlite3/.RUBYARCHDIR.-.sqlite3.time +0 -0
- data/vendor/bundle/gems/sqlite3-1.3.13/ext/sqlite3/Makefile +261 -0
- data/vendor/bundle/gems/sqlite3-1.3.13/ext/sqlite3/backup.c +168 -0
- data/vendor/bundle/gems/sqlite3-1.3.13/ext/sqlite3/backup.h +15 -0
- data/vendor/bundle/gems/sqlite3-1.3.13/ext/sqlite3/backup.o +0 -0
- data/vendor/bundle/gems/sqlite3-1.3.13/ext/sqlite3/database.c +888 -0
- data/vendor/bundle/gems/sqlite3-1.3.13/ext/sqlite3/database.h +15 -0
- data/vendor/bundle/gems/sqlite3-1.3.13/ext/sqlite3/database.o +0 -0
- data/vendor/bundle/gems/sqlite3-1.3.13/ext/sqlite3/exception.c +94 -0
- data/vendor/bundle/gems/sqlite3-1.3.13/ext/sqlite3/exception.h +8 -0
- data/vendor/bundle/gems/sqlite3-1.3.13/ext/sqlite3/exception.o +0 -0
- data/vendor/bundle/gems/sqlite3-1.3.13/ext/sqlite3/extconf.rb +71 -0
- data/vendor/bundle/gems/sqlite3-1.3.13/ext/sqlite3/sqlite3.c +152 -0
- data/vendor/bundle/gems/sqlite3-1.3.13/ext/sqlite3/sqlite3.o +0 -0
- data/vendor/bundle/gems/sqlite3-1.3.13/ext/sqlite3/sqlite3_native.bundle +0 -0
- data/vendor/bundle/gems/sqlite3-1.3.13/ext/sqlite3/sqlite3_ruby.h +52 -0
- data/vendor/bundle/gems/sqlite3-1.3.13/ext/sqlite3/statement.c +447 -0
- data/vendor/bundle/gems/sqlite3-1.3.13/ext/sqlite3/statement.h +16 -0
- data/vendor/bundle/gems/sqlite3-1.3.13/ext/sqlite3/statement.o +0 -0
- data/vendor/bundle/gems/sqlite3-1.3.13/faq/faq.rb +145 -0
- data/vendor/bundle/gems/sqlite3-1.3.13/faq/faq.yml +426 -0
- data/vendor/bundle/gems/sqlite3-1.3.13/lib/sqlite3.rb +15 -0
- data/vendor/bundle/gems/sqlite3-1.3.13/lib/sqlite3/constants.rb +49 -0
- data/vendor/bundle/gems/sqlite3-1.3.13/lib/sqlite3/database.rb +591 -0
- data/vendor/bundle/gems/sqlite3-1.3.13/lib/sqlite3/errors.rb +44 -0
- data/vendor/bundle/gems/sqlite3-1.3.13/lib/sqlite3/pragmas.rb +588 -0
- data/vendor/bundle/gems/sqlite3-1.3.13/lib/sqlite3/resultset.rb +195 -0
- data/vendor/bundle/gems/sqlite3-1.3.13/lib/sqlite3/sqlite3_native.bundle +0 -0
- data/vendor/bundle/gems/sqlite3-1.3.13/lib/sqlite3/statement.rb +144 -0
- data/vendor/bundle/gems/sqlite3-1.3.13/lib/sqlite3/translator.rb +118 -0
- data/vendor/bundle/gems/sqlite3-1.3.13/lib/sqlite3/value.rb +57 -0
- data/vendor/bundle/gems/sqlite3-1.3.13/lib/sqlite3/version.rb +25 -0
- data/vendor/bundle/gems/sqlite3-1.3.13/setup.rb +1333 -0
- data/vendor/bundle/gems/sqlite3-1.3.13/tasks/faq.rake +9 -0
- data/vendor/bundle/gems/sqlite3-1.3.13/tasks/gem.rake +38 -0
- data/vendor/bundle/gems/sqlite3-1.3.13/tasks/native.rake +52 -0
- data/vendor/bundle/gems/sqlite3-1.3.13/tasks/vendor_sqlite3.rake +97 -0
- data/vendor/bundle/gems/sqlite3-1.3.13/test/helper.rb +18 -0
- data/vendor/bundle/gems/sqlite3-1.3.13/test/test_backup.rb +33 -0
- data/vendor/bundle/gems/sqlite3-1.3.13/test/test_collation.rb +82 -0
- data/vendor/bundle/gems/sqlite3-1.3.13/test/test_database.rb +430 -0
- data/vendor/bundle/gems/sqlite3-1.3.13/test/test_database_readonly.rb +36 -0
- data/vendor/bundle/gems/sqlite3-1.3.13/test/test_deprecated.rb +44 -0
- data/vendor/bundle/gems/sqlite3-1.3.13/test/test_encoding.rb +155 -0
- data/vendor/bundle/gems/sqlite3-1.3.13/test/test_integration.rb +576 -0
- data/vendor/bundle/gems/sqlite3-1.3.13/test/test_integration_open_close.rb +30 -0
- data/vendor/bundle/gems/sqlite3-1.3.13/test/test_integration_pending.rb +115 -0
- data/vendor/bundle/gems/sqlite3-1.3.13/test/test_integration_resultset.rb +159 -0
- data/vendor/bundle/gems/sqlite3-1.3.13/test/test_integration_statement.rb +194 -0
- data/vendor/bundle/gems/sqlite3-1.3.13/test/test_result_set.rb +37 -0
- data/vendor/bundle/gems/sqlite3-1.3.13/test/test_sqlite3.rb +21 -0
- data/vendor/bundle/gems/sqlite3-1.3.13/test/test_statement.rb +260 -0
- data/vendor/bundle/gems/sqlite3-1.3.13/test/test_statement_execute.rb +35 -0
- data/vendor/bundle/gems/thread_safe-0.3.6/.rspec +2 -0
- data/vendor/bundle/gems/thread_safe-0.3.6/.travis.yml +46 -0
- data/vendor/bundle/gems/thread_safe-0.3.6/.yardopts +13 -0
- data/vendor/bundle/gems/thread_safe-0.3.6/Gemfile +20 -0
- data/vendor/bundle/gems/thread_safe-0.3.6/LICENSE +144 -0
- data/vendor/bundle/gems/thread_safe-0.3.6/README.md +60 -0
- data/vendor/bundle/gems/thread_safe-0.3.6/Rakefile +62 -0
- data/vendor/bundle/gems/thread_safe-0.3.6/examples/bench_cache.rb +35 -0
- data/vendor/bundle/gems/thread_safe-0.3.6/ext/org/jruby/ext/thread_safe/JRubyCacheBackendLibrary.java +245 -0
- data/vendor/bundle/gems/thread_safe-0.3.6/ext/org/jruby/ext/thread_safe/jsr166e/ConcurrentHashMap.java +31 -0
- data/vendor/bundle/gems/thread_safe-0.3.6/ext/org/jruby/ext/thread_safe/jsr166e/ConcurrentHashMapV8.java +3863 -0
- data/vendor/bundle/gems/thread_safe-0.3.6/ext/org/jruby/ext/thread_safe/jsr166e/LongAdder.java +203 -0
- data/vendor/bundle/gems/thread_safe-0.3.6/ext/org/jruby/ext/thread_safe/jsr166e/Striped64.java +342 -0
- data/vendor/bundle/gems/thread_safe-0.3.6/ext/org/jruby/ext/thread_safe/jsr166e/nounsafe/ConcurrentHashMapV8.java +3800 -0
- data/vendor/bundle/gems/thread_safe-0.3.6/ext/org/jruby/ext/thread_safe/jsr166e/nounsafe/LongAdder.java +204 -0
- data/vendor/bundle/gems/thread_safe-0.3.6/ext/org/jruby/ext/thread_safe/jsr166e/nounsafe/Striped64.java +291 -0
- data/vendor/bundle/gems/thread_safe-0.3.6/ext/org/jruby/ext/thread_safe/jsr166y/ThreadLocalRandom.java +199 -0
- data/vendor/bundle/gems/thread_safe-0.3.6/ext/thread_safe/JrubyCacheBackendService.java +15 -0
- data/vendor/bundle/gems/thread_safe-0.3.6/lib/thread_safe.rb +65 -0
- data/vendor/bundle/gems/thread_safe-0.3.6/lib/thread_safe/atomic_reference_cache_backend.rb +908 -0
- data/vendor/bundle/gems/thread_safe-0.3.6/lib/thread_safe/cache.rb +161 -0
- data/vendor/bundle/gems/thread_safe-0.3.6/lib/thread_safe/mri_cache_backend.rb +60 -0
- data/vendor/bundle/gems/thread_safe-0.3.6/lib/thread_safe/non_concurrent_cache_backend.rb +135 -0
- data/vendor/bundle/gems/thread_safe-0.3.6/lib/thread_safe/synchronized_cache_backend.rb +77 -0
- data/vendor/bundle/gems/thread_safe-0.3.6/lib/thread_safe/synchronized_delegator.rb +43 -0
- data/vendor/bundle/gems/thread_safe-0.3.6/lib/thread_safe/util.rb +16 -0
- data/vendor/bundle/gems/thread_safe-0.3.6/lib/thread_safe/util/adder.rb +62 -0
- data/vendor/bundle/gems/thread_safe-0.3.6/lib/thread_safe/util/atomic_reference.rb +44 -0
- data/vendor/bundle/gems/thread_safe-0.3.6/lib/thread_safe/util/cheap_lockable.rb +106 -0
- data/vendor/bundle/gems/thread_safe-0.3.6/lib/thread_safe/util/power_of_two_tuple.rb +26 -0
- data/vendor/bundle/gems/thread_safe-0.3.6/lib/thread_safe/util/striped64.rb +222 -0
- data/vendor/bundle/gems/thread_safe-0.3.6/lib/thread_safe/util/volatile.rb +64 -0
- data/vendor/bundle/gems/thread_safe-0.3.6/lib/thread_safe/util/volatile_tuple.rb +46 -0
- data/vendor/bundle/gems/thread_safe-0.3.6/lib/thread_safe/util/xor_shift_random.rb +41 -0
- data/vendor/bundle/gems/thread_safe-0.3.6/lib/thread_safe/version.rb +21 -0
- data/vendor/bundle/gems/thread_safe-0.3.6/spec/.gitignore +0 -0
- data/vendor/bundle/gems/thread_safe-0.3.6/spec/spec_helper.rb +31 -0
- data/vendor/bundle/gems/thread_safe-0.3.6/spec/src/thread_safe/SecurityManager.java +21 -0
- data/vendor/bundle/gems/thread_safe-0.3.6/spec/support/.gitignore +0 -0
- data/vendor/bundle/gems/thread_safe-0.3.6/spec/support/threads.rb +1 -0
- data/vendor/bundle/gems/thread_safe-0.3.6/spec/support/threadsafe_test.rb +75 -0
- data/vendor/bundle/gems/thread_safe-0.3.6/spec/thread_safe/.gitignore +0 -0
- data/vendor/bundle/gems/thread_safe-0.3.6/spec/thread_safe/array_spec.rb +18 -0
- data/vendor/bundle/gems/thread_safe-0.3.6/spec/thread_safe/cache_loops_spec.rb +507 -0
- data/vendor/bundle/gems/thread_safe-0.3.6/spec/thread_safe/cache_spec.rb +943 -0
- data/vendor/bundle/gems/thread_safe-0.3.6/spec/thread_safe/hash_spec.rb +17 -0
- data/vendor/bundle/gems/thread_safe-0.3.6/spec/thread_safe/no_unsafe_spec.rb +27 -0
- data/vendor/bundle/gems/thread_safe-0.3.6/spec/thread_safe/synchronized_delegator_spec.rb +85 -0
- data/vendor/bundle/gems/thread_safe-0.3.6/tasks/update_doc.rake +45 -0
- data/vendor/bundle/gems/thread_safe-0.3.6/thread_safe.gemspec +26 -0
- data/vendor/bundle/gems/thread_safe-0.3.6/yard-template/default/fulldoc/html/css/common.css +125 -0
- data/vendor/bundle/gems/thread_safe-0.3.6/yard-template/default/layout/html/footer.erb +16 -0
- data/vendor/bundle/gems/tzinfo-1.2.5/.yardopts +6 -0
- data/vendor/bundle/gems/tzinfo-1.2.5/CHANGES.md +786 -0
- data/vendor/bundle/gems/tzinfo-1.2.5/LICENSE +19 -0
- data/vendor/bundle/gems/tzinfo-1.2.5/README.md +151 -0
- data/vendor/bundle/gems/tzinfo-1.2.5/Rakefile +107 -0
- data/vendor/bundle/gems/tzinfo-1.2.5/lib/tzinfo.rb +40 -0
- data/vendor/bundle/gems/tzinfo-1.2.5/lib/tzinfo/country.rb +196 -0
- data/vendor/bundle/gems/tzinfo-1.2.5/lib/tzinfo/country_index_definition.rb +31 -0
- data/vendor/bundle/gems/tzinfo-1.2.5/lib/tzinfo/country_info.rb +42 -0
- data/vendor/bundle/gems/tzinfo-1.2.5/lib/tzinfo/country_timezone.rb +135 -0
- data/vendor/bundle/gems/tzinfo-1.2.5/lib/tzinfo/data_source.rb +190 -0
- data/vendor/bundle/gems/tzinfo-1.2.5/lib/tzinfo/data_timezone.rb +58 -0
- data/vendor/bundle/gems/tzinfo-1.2.5/lib/tzinfo/data_timezone_info.rb +55 -0
- data/vendor/bundle/gems/tzinfo-1.2.5/lib/tzinfo/info_timezone.rb +30 -0
- data/vendor/bundle/gems/tzinfo-1.2.5/lib/tzinfo/linked_timezone.rb +63 -0
- data/vendor/bundle/gems/tzinfo-1.2.5/lib/tzinfo/linked_timezone_info.rb +26 -0
- data/vendor/bundle/gems/tzinfo-1.2.5/lib/tzinfo/offset_rationals.rb +77 -0
- data/vendor/bundle/gems/tzinfo-1.2.5/lib/tzinfo/ruby_core_support.rb +146 -0
- data/vendor/bundle/gems/tzinfo-1.2.5/lib/tzinfo/ruby_country_info.rb +74 -0
- data/vendor/bundle/gems/tzinfo-1.2.5/lib/tzinfo/ruby_data_source.rb +136 -0
- data/vendor/bundle/gems/tzinfo-1.2.5/lib/tzinfo/time_or_datetime.rb +340 -0
- data/vendor/bundle/gems/tzinfo-1.2.5/lib/tzinfo/timezone.rb +669 -0
- data/vendor/bundle/gems/tzinfo-1.2.5/lib/tzinfo/timezone_definition.rb +36 -0
- data/vendor/bundle/gems/tzinfo-1.2.5/lib/tzinfo/timezone_index_definition.rb +54 -0
- data/vendor/bundle/gems/tzinfo-1.2.5/lib/tzinfo/timezone_info.rb +30 -0
- data/vendor/bundle/gems/tzinfo-1.2.5/lib/tzinfo/timezone_offset.rb +101 -0
- data/vendor/bundle/gems/tzinfo-1.2.5/lib/tzinfo/timezone_period.rb +245 -0
- data/vendor/bundle/gems/tzinfo-1.2.5/lib/tzinfo/timezone_proxy.rb +105 -0
- data/vendor/bundle/gems/tzinfo-1.2.5/lib/tzinfo/timezone_transition.rb +130 -0
- data/vendor/bundle/gems/tzinfo-1.2.5/lib/tzinfo/timezone_transition_definition.rb +104 -0
- data/vendor/bundle/gems/tzinfo-1.2.5/lib/tzinfo/transition_data_timezone_info.rb +274 -0
- data/vendor/bundle/gems/tzinfo-1.2.5/lib/tzinfo/zoneinfo_country_info.rb +37 -0
- data/vendor/bundle/gems/tzinfo-1.2.5/lib/tzinfo/zoneinfo_data_source.rb +488 -0
- data/vendor/bundle/gems/tzinfo-1.2.5/lib/tzinfo/zoneinfo_timezone_info.rb +296 -0
- data/vendor/bundle/gems/tzinfo-1.2.5/test/tc_country.rb +234 -0
- data/vendor/bundle/gems/tzinfo-1.2.5/test/tc_country_index_definition.rb +69 -0
- data/vendor/bundle/gems/tzinfo-1.2.5/test/tc_country_info.rb +16 -0
- data/vendor/bundle/gems/tzinfo-1.2.5/test/tc_country_timezone.rb +173 -0
- data/vendor/bundle/gems/tzinfo-1.2.5/test/tc_data_source.rb +218 -0
- data/vendor/bundle/gems/tzinfo-1.2.5/test/tc_data_timezone.rb +99 -0
- data/vendor/bundle/gems/tzinfo-1.2.5/test/tc_data_timezone_info.rb +18 -0
- data/vendor/bundle/gems/tzinfo-1.2.5/test/tc_info_timezone.rb +34 -0
- data/vendor/bundle/gems/tzinfo-1.2.5/test/tc_linked_timezone.rb +155 -0
- data/vendor/bundle/gems/tzinfo-1.2.5/test/tc_linked_timezone_info.rb +23 -0
- data/vendor/bundle/gems/tzinfo-1.2.5/test/tc_offset_rationals.rb +23 -0
- data/vendor/bundle/gems/tzinfo-1.2.5/test/tc_ruby_core_support.rb +168 -0
- data/vendor/bundle/gems/tzinfo-1.2.5/test/tc_ruby_country_info.rb +110 -0
- data/vendor/bundle/gems/tzinfo-1.2.5/test/tc_ruby_data_source.rb +143 -0
- data/vendor/bundle/gems/tzinfo-1.2.5/test/tc_time_or_datetime.rb +654 -0
- data/vendor/bundle/gems/tzinfo-1.2.5/test/tc_timezone.rb +1350 -0
- data/vendor/bundle/gems/tzinfo-1.2.5/test/tc_timezone_definition.rb +113 -0
- data/vendor/bundle/gems/tzinfo-1.2.5/test/tc_timezone_index_definition.rb +73 -0
- data/vendor/bundle/gems/tzinfo-1.2.5/test/tc_timezone_info.rb +11 -0
- data/vendor/bundle/gems/tzinfo-1.2.5/test/tc_timezone_london.rb +143 -0
- data/vendor/bundle/gems/tzinfo-1.2.5/test/tc_timezone_melbourne.rb +142 -0
- data/vendor/bundle/gems/tzinfo-1.2.5/test/tc_timezone_new_york.rb +142 -0
- data/vendor/bundle/gems/tzinfo-1.2.5/test/tc_timezone_offset.rb +126 -0
- data/vendor/bundle/gems/tzinfo-1.2.5/test/tc_timezone_period.rb +555 -0
- data/vendor/bundle/gems/tzinfo-1.2.5/test/tc_timezone_proxy.rb +136 -0
- data/vendor/bundle/gems/tzinfo-1.2.5/test/tc_timezone_transition.rb +366 -0
- data/vendor/bundle/gems/tzinfo-1.2.5/test/tc_timezone_transition_definition.rb +295 -0
- data/vendor/bundle/gems/tzinfo-1.2.5/test/tc_timezone_utc.rb +27 -0
- data/vendor/bundle/gems/tzinfo-1.2.5/test/tc_transition_data_timezone_info.rb +423 -0
- data/vendor/bundle/gems/tzinfo-1.2.5/test/tc_zoneinfo_country_info.rb +78 -0
- data/vendor/bundle/gems/tzinfo-1.2.5/test/tc_zoneinfo_data_source.rb +1195 -0
- data/vendor/bundle/gems/tzinfo-1.2.5/test/tc_zoneinfo_timezone_info.rb +1232 -0
- data/vendor/bundle/gems/tzinfo-1.2.5/test/test_utils.rb +163 -0
- data/vendor/bundle/gems/tzinfo-1.2.5/test/ts_all.rb +7 -0
- data/vendor/bundle/gems/tzinfo-1.2.5/test/ts_all_ruby.rb +5 -0
- data/vendor/bundle/gems/tzinfo-1.2.5/test/ts_all_zoneinfo.rb +7 -0
- data/vendor/bundle/gems/tzinfo-1.2.5/test/tzinfo-data/tzinfo/data.rb +8 -0
- data/vendor/bundle/gems/tzinfo-1.2.5/test/tzinfo-data/tzinfo/data/definitions/America/Argentina/Buenos_Aires.rb +89 -0
- data/vendor/bundle/gems/tzinfo-1.2.5/test/tzinfo-data/tzinfo/data/definitions/America/New_York.rb +315 -0
- data/vendor/bundle/gems/tzinfo-1.2.5/test/tzinfo-data/tzinfo/data/definitions/Australia/Melbourne.rb +218 -0
- data/vendor/bundle/gems/tzinfo-1.2.5/test/tzinfo-data/tzinfo/data/definitions/EST.rb +19 -0
- data/vendor/bundle/gems/tzinfo-1.2.5/test/tzinfo-data/tzinfo/data/definitions/Etc/GMT__m__1.rb +21 -0
- data/vendor/bundle/gems/tzinfo-1.2.5/test/tzinfo-data/tzinfo/data/definitions/Etc/GMT__p__1.rb +21 -0
- data/vendor/bundle/gems/tzinfo-1.2.5/test/tzinfo-data/tzinfo/data/definitions/Etc/UTC.rb +21 -0
- data/vendor/bundle/gems/tzinfo-1.2.5/test/tzinfo-data/tzinfo/data/definitions/Europe/Amsterdam.rb +261 -0
- data/vendor/bundle/gems/tzinfo-1.2.5/test/tzinfo-data/tzinfo/data/definitions/Europe/Andorra.rb +186 -0
- data/vendor/bundle/gems/tzinfo-1.2.5/test/tzinfo-data/tzinfo/data/definitions/Europe/London.rb +321 -0
- data/vendor/bundle/gems/tzinfo-1.2.5/test/tzinfo-data/tzinfo/data/definitions/Europe/Paris.rb +265 -0
- data/vendor/bundle/gems/tzinfo-1.2.5/test/tzinfo-data/tzinfo/data/definitions/Europe/Prague.rb +220 -0
- data/vendor/bundle/gems/tzinfo-1.2.5/test/tzinfo-data/tzinfo/data/definitions/UTC.rb +16 -0
- data/vendor/bundle/gems/tzinfo-1.2.5/test/tzinfo-data/tzinfo/data/indexes/countries.rb +927 -0
- data/vendor/bundle/gems/tzinfo-1.2.5/test/tzinfo-data/tzinfo/data/indexes/timezones.rb +596 -0
- data/vendor/bundle/gems/tzinfo-1.2.5/test/tzinfo-data/tzinfo/data/version.rb +14 -0
- data/vendor/bundle/gems/tzinfo-1.2.5/test/zoneinfo/America/Argentina/Buenos_Aires +0 -0
- data/vendor/bundle/gems/tzinfo-1.2.5/test/zoneinfo/America/New_York +0 -0
- data/vendor/bundle/gems/tzinfo-1.2.5/test/zoneinfo/Australia/Melbourne +0 -0
- data/vendor/bundle/gems/tzinfo-1.2.5/test/zoneinfo/EST +0 -0
- data/vendor/bundle/gems/tzinfo-1.2.5/test/zoneinfo/Etc/UTC +0 -0
- data/vendor/bundle/gems/tzinfo-1.2.5/test/zoneinfo/Europe/Amsterdam +0 -0
- data/vendor/bundle/gems/tzinfo-1.2.5/test/zoneinfo/Europe/Andorra +0 -0
- data/vendor/bundle/gems/tzinfo-1.2.5/test/zoneinfo/Europe/London +0 -0
- data/vendor/bundle/gems/tzinfo-1.2.5/test/zoneinfo/Europe/Paris +0 -0
- data/vendor/bundle/gems/tzinfo-1.2.5/test/zoneinfo/Europe/Prague +0 -0
- data/vendor/bundle/gems/tzinfo-1.2.5/test/zoneinfo/Factory +0 -0
- data/vendor/bundle/gems/tzinfo-1.2.5/test/zoneinfo/iso3166.tab +275 -0
- data/vendor/bundle/gems/tzinfo-1.2.5/test/zoneinfo/leapseconds +61 -0
- data/vendor/bundle/gems/tzinfo-1.2.5/test/zoneinfo/posix/Europe/London +0 -0
- data/vendor/bundle/gems/tzinfo-1.2.5/test/zoneinfo/posixrules +0 -0
- data/vendor/bundle/gems/tzinfo-1.2.5/test/zoneinfo/right/Europe/London +0 -0
- data/vendor/bundle/gems/tzinfo-1.2.5/test/zoneinfo/zone.tab +439 -0
- data/vendor/bundle/gems/tzinfo-1.2.5/test/zoneinfo/zone1970.tab +369 -0
- data/vendor/bundle/gems/tzinfo-1.2.5/tzinfo.gemspec +21 -0
- data/vendor/bundle/specifications/activemodel-5.2.2.gemspec +34 -0
- data/vendor/bundle/specifications/activerecord-5.2.2.gemspec +43 -0
- data/vendor/bundle/specifications/activesupport-5.2.2.gemspec +44 -0
- data/vendor/bundle/specifications/ansi-1.5.0.gemspec +49 -0
- data/vendor/bundle/specifications/arel-9.0.0.gemspec +45 -0
- data/vendor/bundle/specifications/builder-3.2.3.gemspec +21 -0
- data/vendor/bundle/specifications/concurrent-ruby-1.1.4.gemspec +23 -0
- data/vendor/bundle/specifications/i18n-1.3.0.gemspec +36 -0
- data/vendor/bundle/specifications/minitest-5.11.3.gemspec +39 -0
- data/vendor/bundle/specifications/minitest-reporters-1.3.5.gemspec +52 -0
- data/vendor/bundle/specifications/rake-10.5.0.gemspec +43 -0
- data/vendor/bundle/specifications/ruby-progressbar-1.10.0.gemspec +46 -0
- data/vendor/bundle/specifications/sqlite3-1.3.13.gemspec +56 -0
- data/vendor/bundle/specifications/thread_safe-0.3.6.gemspec +38 -0
- data/vendor/bundle/specifications/tzinfo-1.2.5.gemspec +37 -0
- metadata +1563 -0
@@ -0,0 +1,283 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module ActiveRecord
|
4
|
+
# See ActiveRecord::Aggregations::ClassMethods for documentation
|
5
|
+
module Aggregations
|
6
|
+
extend ActiveSupport::Concern
|
7
|
+
|
8
|
+
def initialize_dup(*) # :nodoc:
|
9
|
+
@aggregation_cache = {}
|
10
|
+
super
|
11
|
+
end
|
12
|
+
|
13
|
+
def reload(*) # :nodoc:
|
14
|
+
clear_aggregation_cache
|
15
|
+
super
|
16
|
+
end
|
17
|
+
|
18
|
+
private
|
19
|
+
|
20
|
+
def clear_aggregation_cache
|
21
|
+
@aggregation_cache.clear if persisted?
|
22
|
+
end
|
23
|
+
|
24
|
+
def init_internals
|
25
|
+
@aggregation_cache = {}
|
26
|
+
super
|
27
|
+
end
|
28
|
+
|
29
|
+
# Active Record implements aggregation through a macro-like class method called #composed_of
|
30
|
+
# for representing attributes as value objects. It expresses relationships like "Account [is]
|
31
|
+
# composed of Money [among other things]" or "Person [is] composed of [an] address". Each call
|
32
|
+
# to the macro adds a description of how the value objects are created from the attributes of
|
33
|
+
# the entity object (when the entity is initialized either as a new object or from finding an
|
34
|
+
# existing object) and how it can be turned back into attributes (when the entity is saved to
|
35
|
+
# the database).
|
36
|
+
#
|
37
|
+
# class Customer < ActiveRecord::Base
|
38
|
+
# composed_of :balance, class_name: "Money", mapping: %w(balance amount)
|
39
|
+
# composed_of :address, mapping: [ %w(address_street street), %w(address_city city) ]
|
40
|
+
# end
|
41
|
+
#
|
42
|
+
# The customer class now has the following methods to manipulate the value objects:
|
43
|
+
# * <tt>Customer#balance, Customer#balance=(money)</tt>
|
44
|
+
# * <tt>Customer#address, Customer#address=(address)</tt>
|
45
|
+
#
|
46
|
+
# These methods will operate with value objects like the ones described below:
|
47
|
+
#
|
48
|
+
# class Money
|
49
|
+
# include Comparable
|
50
|
+
# attr_reader :amount, :currency
|
51
|
+
# EXCHANGE_RATES = { "USD_TO_DKK" => 6 }
|
52
|
+
#
|
53
|
+
# def initialize(amount, currency = "USD")
|
54
|
+
# @amount, @currency = amount, currency
|
55
|
+
# end
|
56
|
+
#
|
57
|
+
# def exchange_to(other_currency)
|
58
|
+
# exchanged_amount = (amount * EXCHANGE_RATES["#{currency}_TO_#{other_currency}"]).floor
|
59
|
+
# Money.new(exchanged_amount, other_currency)
|
60
|
+
# end
|
61
|
+
#
|
62
|
+
# def ==(other_money)
|
63
|
+
# amount == other_money.amount && currency == other_money.currency
|
64
|
+
# end
|
65
|
+
#
|
66
|
+
# def <=>(other_money)
|
67
|
+
# if currency == other_money.currency
|
68
|
+
# amount <=> other_money.amount
|
69
|
+
# else
|
70
|
+
# amount <=> other_money.exchange_to(currency).amount
|
71
|
+
# end
|
72
|
+
# end
|
73
|
+
# end
|
74
|
+
#
|
75
|
+
# class Address
|
76
|
+
# attr_reader :street, :city
|
77
|
+
# def initialize(street, city)
|
78
|
+
# @street, @city = street, city
|
79
|
+
# end
|
80
|
+
#
|
81
|
+
# def close_to?(other_address)
|
82
|
+
# city == other_address.city
|
83
|
+
# end
|
84
|
+
#
|
85
|
+
# def ==(other_address)
|
86
|
+
# city == other_address.city && street == other_address.street
|
87
|
+
# end
|
88
|
+
# end
|
89
|
+
#
|
90
|
+
# Now it's possible to access attributes from the database through the value objects instead. If
|
91
|
+
# you choose to name the composition the same as the attribute's name, it will be the only way to
|
92
|
+
# access that attribute. That's the case with our +balance+ attribute. You interact with the value
|
93
|
+
# objects just like you would with any other attribute:
|
94
|
+
#
|
95
|
+
# customer.balance = Money.new(20) # sets the Money value object and the attribute
|
96
|
+
# customer.balance # => Money value object
|
97
|
+
# customer.balance.exchange_to("DKK") # => Money.new(120, "DKK")
|
98
|
+
# customer.balance > Money.new(10) # => true
|
99
|
+
# customer.balance == Money.new(20) # => true
|
100
|
+
# customer.balance < Money.new(5) # => false
|
101
|
+
#
|
102
|
+
# Value objects can also be composed of multiple attributes, such as the case of Address. The order
|
103
|
+
# of the mappings will determine the order of the parameters.
|
104
|
+
#
|
105
|
+
# customer.address_street = "Hyancintvej"
|
106
|
+
# customer.address_city = "Copenhagen"
|
107
|
+
# customer.address # => Address.new("Hyancintvej", "Copenhagen")
|
108
|
+
#
|
109
|
+
# customer.address = Address.new("May Street", "Chicago")
|
110
|
+
# customer.address_street # => "May Street"
|
111
|
+
# customer.address_city # => "Chicago"
|
112
|
+
#
|
113
|
+
# == Writing value objects
|
114
|
+
#
|
115
|
+
# Value objects are immutable and interchangeable objects that represent a given value, such as
|
116
|
+
# a Money object representing $5. Two Money objects both representing $5 should be equal (through
|
117
|
+
# methods such as <tt>==</tt> and <tt><=></tt> from Comparable if ranking makes sense). This is
|
118
|
+
# unlike entity objects where equality is determined by identity. An entity class such as Customer can
|
119
|
+
# easily have two different objects that both have an address on Hyancintvej. Entity identity is
|
120
|
+
# determined by object or relational unique identifiers (such as primary keys). Normal
|
121
|
+
# ActiveRecord::Base classes are entity objects.
|
122
|
+
#
|
123
|
+
# It's also important to treat the value objects as immutable. Don't allow the Money object to have
|
124
|
+
# its amount changed after creation. Create a new Money object with the new value instead. The
|
125
|
+
# <tt>Money#exchange_to</tt> method is an example of this. It returns a new value object instead of changing
|
126
|
+
# its own values. Active Record won't persist value objects that have been changed through means
|
127
|
+
# other than the writer method.
|
128
|
+
#
|
129
|
+
# The immutable requirement is enforced by Active Record by freezing any object assigned as a value
|
130
|
+
# object. Attempting to change it afterwards will result in a +RuntimeError+.
|
131
|
+
#
|
132
|
+
# Read more about value objects on http://c2.com/cgi/wiki?ValueObject and on the dangers of not
|
133
|
+
# keeping value objects immutable on http://c2.com/cgi/wiki?ValueObjectsShouldBeImmutable
|
134
|
+
#
|
135
|
+
# == Custom constructors and converters
|
136
|
+
#
|
137
|
+
# By default value objects are initialized by calling the <tt>new</tt> constructor of the value
|
138
|
+
# class passing each of the mapped attributes, in the order specified by the <tt>:mapping</tt>
|
139
|
+
# option, as arguments. If the value class doesn't support this convention then #composed_of allows
|
140
|
+
# a custom constructor to be specified.
|
141
|
+
#
|
142
|
+
# When a new value is assigned to the value object, the default assumption is that the new value
|
143
|
+
# is an instance of the value class. Specifying a custom converter allows the new value to be automatically
|
144
|
+
# converted to an instance of value class if necessary.
|
145
|
+
#
|
146
|
+
# For example, the +NetworkResource+ model has +network_address+ and +cidr_range+ attributes that should be
|
147
|
+
# aggregated using the +NetAddr::CIDR+ value class (http://www.rubydoc.info/gems/netaddr/1.5.0/NetAddr/CIDR).
|
148
|
+
# The constructor for the value class is called +create+ and it expects a CIDR address string as a parameter.
|
149
|
+
# New values can be assigned to the value object using either another +NetAddr::CIDR+ object, a string
|
150
|
+
# or an array. The <tt>:constructor</tt> and <tt>:converter</tt> options can be used to meet
|
151
|
+
# these requirements:
|
152
|
+
#
|
153
|
+
# class NetworkResource < ActiveRecord::Base
|
154
|
+
# composed_of :cidr,
|
155
|
+
# class_name: 'NetAddr::CIDR',
|
156
|
+
# mapping: [ %w(network_address network), %w(cidr_range bits) ],
|
157
|
+
# allow_nil: true,
|
158
|
+
# constructor: Proc.new { |network_address, cidr_range| NetAddr::CIDR.create("#{network_address}/#{cidr_range}") },
|
159
|
+
# converter: Proc.new { |value| NetAddr::CIDR.create(value.is_a?(Array) ? value.join('/') : value) }
|
160
|
+
# end
|
161
|
+
#
|
162
|
+
# # This calls the :constructor
|
163
|
+
# network_resource = NetworkResource.new(network_address: '192.168.0.1', cidr_range: 24)
|
164
|
+
#
|
165
|
+
# # These assignments will both use the :converter
|
166
|
+
# network_resource.cidr = [ '192.168.2.1', 8 ]
|
167
|
+
# network_resource.cidr = '192.168.0.1/24'
|
168
|
+
#
|
169
|
+
# # This assignment won't use the :converter as the value is already an instance of the value class
|
170
|
+
# network_resource.cidr = NetAddr::CIDR.create('192.168.2.1/8')
|
171
|
+
#
|
172
|
+
# # Saving and then reloading will use the :constructor on reload
|
173
|
+
# network_resource.save
|
174
|
+
# network_resource.reload
|
175
|
+
#
|
176
|
+
# == Finding records by a value object
|
177
|
+
#
|
178
|
+
# Once a #composed_of relationship is specified for a model, records can be loaded from the database
|
179
|
+
# by specifying an instance of the value object in the conditions hash. The following example
|
180
|
+
# finds all customers with +address_street+ equal to "May Street" and +address_city+ equal to "Chicago":
|
181
|
+
#
|
182
|
+
# Customer.where(address: Address.new("May Street", "Chicago"))
|
183
|
+
#
|
184
|
+
module ClassMethods
|
185
|
+
# Adds reader and writer methods for manipulating a value object:
|
186
|
+
# <tt>composed_of :address</tt> adds <tt>address</tt> and <tt>address=(new_address)</tt> methods.
|
187
|
+
#
|
188
|
+
# Options are:
|
189
|
+
# * <tt>:class_name</tt> - Specifies the class name of the association. Use it only if that name
|
190
|
+
# can't be inferred from the part id. So <tt>composed_of :address</tt> will by default be linked
|
191
|
+
# to the Address class, but if the real class name is +CompanyAddress+, you'll have to specify it
|
192
|
+
# with this option.
|
193
|
+
# * <tt>:mapping</tt> - Specifies the mapping of entity attributes to attributes of the value
|
194
|
+
# object. Each mapping is represented as an array where the first item is the name of the
|
195
|
+
# entity attribute and the second item is the name of the attribute in the value object. The
|
196
|
+
# order in which mappings are defined determines the order in which attributes are sent to the
|
197
|
+
# value class constructor.
|
198
|
+
# * <tt>:allow_nil</tt> - Specifies that the value object will not be instantiated when all mapped
|
199
|
+
# attributes are +nil+. Setting the value object to +nil+ has the effect of writing +nil+ to all
|
200
|
+
# mapped attributes.
|
201
|
+
# This defaults to +false+.
|
202
|
+
# * <tt>:constructor</tt> - A symbol specifying the name of the constructor method or a Proc that
|
203
|
+
# is called to initialize the value object. The constructor is passed all of the mapped attributes,
|
204
|
+
# in the order that they are defined in the <tt>:mapping option</tt>, as arguments and uses them
|
205
|
+
# to instantiate a <tt>:class_name</tt> object.
|
206
|
+
# The default is <tt>:new</tt>.
|
207
|
+
# * <tt>:converter</tt> - A symbol specifying the name of a class method of <tt>:class_name</tt>
|
208
|
+
# or a Proc that is called when a new value is assigned to the value object. The converter is
|
209
|
+
# passed the single value that is used in the assignment and is only called if the new value is
|
210
|
+
# not an instance of <tt>:class_name</tt>. If <tt>:allow_nil</tt> is set to true, the converter
|
211
|
+
# can return +nil+ to skip the assignment.
|
212
|
+
#
|
213
|
+
# Option examples:
|
214
|
+
# composed_of :temperature, mapping: %w(reading celsius)
|
215
|
+
# composed_of :balance, class_name: "Money", mapping: %w(balance amount)
|
216
|
+
# composed_of :address, mapping: [ %w(address_street street), %w(address_city city) ]
|
217
|
+
# composed_of :gps_location
|
218
|
+
# composed_of :gps_location, allow_nil: true
|
219
|
+
# composed_of :ip_address,
|
220
|
+
# class_name: 'IPAddr',
|
221
|
+
# mapping: %w(ip to_i),
|
222
|
+
# constructor: Proc.new { |ip| IPAddr.new(ip, Socket::AF_INET) },
|
223
|
+
# converter: Proc.new { |ip| ip.is_a?(Integer) ? IPAddr.new(ip, Socket::AF_INET) : IPAddr.new(ip.to_s) }
|
224
|
+
#
|
225
|
+
def composed_of(part_id, options = {})
|
226
|
+
options.assert_valid_keys(:class_name, :mapping, :allow_nil, :constructor, :converter)
|
227
|
+
|
228
|
+
name = part_id.id2name
|
229
|
+
class_name = options[:class_name] || name.camelize
|
230
|
+
mapping = options[:mapping] || [ name, name ]
|
231
|
+
mapping = [ mapping ] unless mapping.first.is_a?(Array)
|
232
|
+
allow_nil = options[:allow_nil] || false
|
233
|
+
constructor = options[:constructor] || :new
|
234
|
+
converter = options[:converter]
|
235
|
+
|
236
|
+
reader_method(name, class_name, mapping, allow_nil, constructor)
|
237
|
+
writer_method(name, class_name, mapping, allow_nil, converter)
|
238
|
+
|
239
|
+
reflection = ActiveRecord::Reflection.create(:composed_of, part_id, nil, options, self)
|
240
|
+
Reflection.add_aggregate_reflection self, part_id, reflection
|
241
|
+
end
|
242
|
+
|
243
|
+
private
|
244
|
+
def reader_method(name, class_name, mapping, allow_nil, constructor)
|
245
|
+
define_method(name) do
|
246
|
+
if @aggregation_cache[name].nil? && (!allow_nil || mapping.any? { |key, _| !_read_attribute(key).nil? })
|
247
|
+
attrs = mapping.collect { |key, _| _read_attribute(key) }
|
248
|
+
object = constructor.respond_to?(:call) ?
|
249
|
+
constructor.call(*attrs) :
|
250
|
+
class_name.constantize.send(constructor, *attrs)
|
251
|
+
@aggregation_cache[name] = object
|
252
|
+
end
|
253
|
+
@aggregation_cache[name]
|
254
|
+
end
|
255
|
+
end
|
256
|
+
|
257
|
+
def writer_method(name, class_name, mapping, allow_nil, converter)
|
258
|
+
define_method("#{name}=") do |part|
|
259
|
+
klass = class_name.constantize
|
260
|
+
|
261
|
+
unless part.is_a?(klass) || converter.nil? || part.nil?
|
262
|
+
part = converter.respond_to?(:call) ? converter.call(part) : klass.send(converter, part)
|
263
|
+
end
|
264
|
+
|
265
|
+
hash_from_multiparameter_assignment = part.is_a?(Hash) &&
|
266
|
+
part.each_key.all? { |k| k.is_a?(Integer) }
|
267
|
+
if hash_from_multiparameter_assignment
|
268
|
+
raise ArgumentError unless part.size == part.each_key.max
|
269
|
+
part = klass.new(*part.sort.map(&:last))
|
270
|
+
end
|
271
|
+
|
272
|
+
if part.nil? && allow_nil
|
273
|
+
mapping.each { |key, _| self[key] = nil }
|
274
|
+
@aggregation_cache[name] = nil
|
275
|
+
else
|
276
|
+
mapping.each { |key, value| self[key] = part.send(value) }
|
277
|
+
@aggregation_cache[name] = part.freeze
|
278
|
+
end
|
279
|
+
end
|
280
|
+
end
|
281
|
+
end
|
282
|
+
end
|
283
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module ActiveRecord
|
4
|
+
class AssociationRelation < Relation
|
5
|
+
def initialize(klass, association)
|
6
|
+
super(klass)
|
7
|
+
@association = association
|
8
|
+
end
|
9
|
+
|
10
|
+
def proxy_association
|
11
|
+
@association
|
12
|
+
end
|
13
|
+
|
14
|
+
def ==(other)
|
15
|
+
other == records
|
16
|
+
end
|
17
|
+
|
18
|
+
def build(*args, &block)
|
19
|
+
scoping { @association.build(*args, &block) }
|
20
|
+
end
|
21
|
+
alias new build
|
22
|
+
|
23
|
+
def create(*args, &block)
|
24
|
+
scoping { @association.create(*args, &block) }
|
25
|
+
end
|
26
|
+
|
27
|
+
def create!(*args, &block)
|
28
|
+
scoping { @association.create!(*args, &block) }
|
29
|
+
end
|
30
|
+
|
31
|
+
private
|
32
|
+
|
33
|
+
def exec_queries
|
34
|
+
super do |record|
|
35
|
+
@association.set_inverse_instance_from_queries(record)
|
36
|
+
yield record if block_given?
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,1860 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "active_support/core_ext/enumerable"
|
4
|
+
require "active_support/core_ext/string/conversions"
|
5
|
+
require "active_support/core_ext/module/remove_method"
|
6
|
+
require "active_record/errors"
|
7
|
+
|
8
|
+
module ActiveRecord
|
9
|
+
class AssociationNotFoundError < ConfigurationError #:nodoc:
|
10
|
+
def initialize(record = nil, association_name = nil)
|
11
|
+
if record && association_name
|
12
|
+
super("Association named '#{association_name}' was not found on #{record.class.name}; perhaps you misspelled it?")
|
13
|
+
else
|
14
|
+
super("Association was not found.")
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
class InverseOfAssociationNotFoundError < ActiveRecordError #:nodoc:
|
20
|
+
def initialize(reflection = nil, associated_class = nil)
|
21
|
+
if reflection
|
22
|
+
super("Could not find the inverse association for #{reflection.name} (#{reflection.options[:inverse_of].inspect} in #{associated_class.nil? ? reflection.class_name : associated_class.name})")
|
23
|
+
else
|
24
|
+
super("Could not find the inverse association.")
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
class HasManyThroughAssociationNotFoundError < ActiveRecordError #:nodoc:
|
30
|
+
def initialize(owner_class_name = nil, reflection = nil)
|
31
|
+
if owner_class_name && reflection
|
32
|
+
super("Could not find the association #{reflection.options[:through].inspect} in model #{owner_class_name}")
|
33
|
+
else
|
34
|
+
super("Could not find the association.")
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
class HasManyThroughAssociationPolymorphicSourceError < ActiveRecordError #:nodoc:
|
40
|
+
def initialize(owner_class_name = nil, reflection = nil, source_reflection = nil)
|
41
|
+
if owner_class_name && reflection && source_reflection
|
42
|
+
super("Cannot have a has_many :through association '#{owner_class_name}##{reflection.name}' on the polymorphic object '#{source_reflection.class_name}##{source_reflection.name}' without 'source_type'. Try adding 'source_type: \"#{reflection.name.to_s.classify}\"' to 'has_many :through' definition.")
|
43
|
+
else
|
44
|
+
super("Cannot have a has_many :through association.")
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
class HasManyThroughAssociationPolymorphicThroughError < ActiveRecordError #:nodoc:
|
50
|
+
def initialize(owner_class_name = nil, reflection = nil)
|
51
|
+
if owner_class_name && reflection
|
52
|
+
super("Cannot have a has_many :through association '#{owner_class_name}##{reflection.name}' which goes through the polymorphic association '#{owner_class_name}##{reflection.through_reflection.name}'.")
|
53
|
+
else
|
54
|
+
super("Cannot have a has_many :through association.")
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
class HasManyThroughAssociationPointlessSourceTypeError < ActiveRecordError #:nodoc:
|
60
|
+
def initialize(owner_class_name = nil, reflection = nil, source_reflection = nil)
|
61
|
+
if owner_class_name && reflection && source_reflection
|
62
|
+
super("Cannot have a has_many :through association '#{owner_class_name}##{reflection.name}' with a :source_type option if the '#{reflection.through_reflection.class_name}##{source_reflection.name}' is not polymorphic. Try removing :source_type on your association.")
|
63
|
+
else
|
64
|
+
super("Cannot have a has_many :through association.")
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
class HasOneThroughCantAssociateThroughCollection < ActiveRecordError #:nodoc:
|
70
|
+
def initialize(owner_class_name = nil, reflection = nil, through_reflection = nil)
|
71
|
+
if owner_class_name && reflection && through_reflection
|
72
|
+
super("Cannot have a has_one :through association '#{owner_class_name}##{reflection.name}' where the :through association '#{owner_class_name}##{through_reflection.name}' is a collection. Specify a has_one or belongs_to association in the :through option instead.")
|
73
|
+
else
|
74
|
+
super("Cannot have a has_one :through association.")
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
class HasOneAssociationPolymorphicThroughError < ActiveRecordError #:nodoc:
|
80
|
+
def initialize(owner_class_name = nil, reflection = nil)
|
81
|
+
if owner_class_name && reflection
|
82
|
+
super("Cannot have a has_one :through association '#{owner_class_name}##{reflection.name}' which goes through the polymorphic association '#{owner_class_name}##{reflection.through_reflection.name}'.")
|
83
|
+
else
|
84
|
+
super("Cannot have a has_one :through association.")
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
class HasManyThroughSourceAssociationNotFoundError < ActiveRecordError #:nodoc:
|
90
|
+
def initialize(reflection = nil)
|
91
|
+
if reflection
|
92
|
+
through_reflection = reflection.through_reflection
|
93
|
+
source_reflection_names = reflection.source_reflection_names
|
94
|
+
source_associations = reflection.through_reflection.klass._reflections.keys
|
95
|
+
super("Could not find the source association(s) #{source_reflection_names.collect(&:inspect).to_sentence(two_words_connector: ' or ', last_word_connector: ', or ', locale: :en)} in model #{through_reflection.klass}. Try 'has_many #{reflection.name.inspect}, :through => #{through_reflection.name.inspect}, :source => <name>'. Is it one of #{source_associations.to_sentence(two_words_connector: ' or ', last_word_connector: ', or ', locale: :en)}?")
|
96
|
+
else
|
97
|
+
super("Could not find the source association(s).")
|
98
|
+
end
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
102
|
+
class HasManyThroughOrderError < ActiveRecordError #:nodoc:
|
103
|
+
def initialize(owner_class_name = nil, reflection = nil, through_reflection = nil)
|
104
|
+
if owner_class_name && reflection && through_reflection
|
105
|
+
super("Cannot have a has_many :through association '#{owner_class_name}##{reflection.name}' which goes through '#{owner_class_name}##{through_reflection.name}' before the through association is defined.")
|
106
|
+
else
|
107
|
+
super("Cannot have a has_many :through association before the through association is defined.")
|
108
|
+
end
|
109
|
+
end
|
110
|
+
end
|
111
|
+
|
112
|
+
class ThroughCantAssociateThroughHasOneOrManyReflection < ActiveRecordError #:nodoc:
|
113
|
+
def initialize(owner = nil, reflection = nil)
|
114
|
+
if owner && reflection
|
115
|
+
super("Cannot modify association '#{owner.class.name}##{reflection.name}' because the source reflection class '#{reflection.source_reflection.class_name}' is associated to '#{reflection.through_reflection.class_name}' via :#{reflection.source_reflection.macro}.")
|
116
|
+
else
|
117
|
+
super("Cannot modify association.")
|
118
|
+
end
|
119
|
+
end
|
120
|
+
end
|
121
|
+
|
122
|
+
class AmbiguousSourceReflectionForThroughAssociation < ActiveRecordError # :nodoc:
|
123
|
+
def initialize(klass, macro, association_name, options, possible_sources)
|
124
|
+
example_options = options.dup
|
125
|
+
example_options[:source] = possible_sources.first
|
126
|
+
|
127
|
+
super("Ambiguous source reflection for through association. Please " \
|
128
|
+
"specify a :source directive on your declaration like:\n" \
|
129
|
+
"\n" \
|
130
|
+
" class #{klass} < ActiveRecord::Base\n" \
|
131
|
+
" #{macro} :#{association_name}, #{example_options}\n" \
|
132
|
+
" end"
|
133
|
+
)
|
134
|
+
end
|
135
|
+
end
|
136
|
+
|
137
|
+
class HasManyThroughCantAssociateThroughHasOneOrManyReflection < ThroughCantAssociateThroughHasOneOrManyReflection #:nodoc:
|
138
|
+
end
|
139
|
+
|
140
|
+
class HasOneThroughCantAssociateThroughHasOneOrManyReflection < ThroughCantAssociateThroughHasOneOrManyReflection #:nodoc:
|
141
|
+
end
|
142
|
+
|
143
|
+
class ThroughNestedAssociationsAreReadonly < ActiveRecordError #:nodoc:
|
144
|
+
def initialize(owner = nil, reflection = nil)
|
145
|
+
if owner && reflection
|
146
|
+
super("Cannot modify association '#{owner.class.name}##{reflection.name}' because it goes through more than one other association.")
|
147
|
+
else
|
148
|
+
super("Through nested associations are read-only.")
|
149
|
+
end
|
150
|
+
end
|
151
|
+
end
|
152
|
+
|
153
|
+
class HasManyThroughNestedAssociationsAreReadonly < ThroughNestedAssociationsAreReadonly #:nodoc:
|
154
|
+
end
|
155
|
+
|
156
|
+
class HasOneThroughNestedAssociationsAreReadonly < ThroughNestedAssociationsAreReadonly #:nodoc:
|
157
|
+
end
|
158
|
+
|
159
|
+
# This error is raised when trying to eager load a polymorphic association using a JOIN.
|
160
|
+
# Eager loading polymorphic associations is only possible with
|
161
|
+
# {ActiveRecord::Relation#preload}[rdoc-ref:QueryMethods#preload].
|
162
|
+
class EagerLoadPolymorphicError < ActiveRecordError
|
163
|
+
def initialize(reflection = nil)
|
164
|
+
if reflection
|
165
|
+
super("Cannot eagerly load the polymorphic association #{reflection.name.inspect}")
|
166
|
+
else
|
167
|
+
super("Eager load polymorphic error.")
|
168
|
+
end
|
169
|
+
end
|
170
|
+
end
|
171
|
+
|
172
|
+
# This error is raised when trying to destroy a parent instance in N:1 or 1:1 associations
|
173
|
+
# (has_many, has_one) when there is at least 1 child associated instance.
|
174
|
+
# ex: if @project.tasks.size > 0, DeleteRestrictionError will be raised when trying to destroy @project
|
175
|
+
class DeleteRestrictionError < ActiveRecordError #:nodoc:
|
176
|
+
def initialize(name = nil)
|
177
|
+
if name
|
178
|
+
super("Cannot delete record because of dependent #{name}")
|
179
|
+
else
|
180
|
+
super("Delete restriction error.")
|
181
|
+
end
|
182
|
+
end
|
183
|
+
end
|
184
|
+
|
185
|
+
# See ActiveRecord::Associations::ClassMethods for documentation.
|
186
|
+
module Associations # :nodoc:
|
187
|
+
extend ActiveSupport::Autoload
|
188
|
+
extend ActiveSupport::Concern
|
189
|
+
|
190
|
+
# These classes will be loaded when associations are created.
|
191
|
+
# So there is no need to eager load them.
|
192
|
+
autoload :Association
|
193
|
+
autoload :SingularAssociation
|
194
|
+
autoload :CollectionAssociation
|
195
|
+
autoload :ForeignAssociation
|
196
|
+
autoload :CollectionProxy
|
197
|
+
autoload :ThroughAssociation
|
198
|
+
|
199
|
+
module Builder #:nodoc:
|
200
|
+
autoload :Association, "active_record/associations/builder/association"
|
201
|
+
autoload :SingularAssociation, "active_record/associations/builder/singular_association"
|
202
|
+
autoload :CollectionAssociation, "active_record/associations/builder/collection_association"
|
203
|
+
|
204
|
+
autoload :BelongsTo, "active_record/associations/builder/belongs_to"
|
205
|
+
autoload :HasOne, "active_record/associations/builder/has_one"
|
206
|
+
autoload :HasMany, "active_record/associations/builder/has_many"
|
207
|
+
autoload :HasAndBelongsToMany, "active_record/associations/builder/has_and_belongs_to_many"
|
208
|
+
end
|
209
|
+
|
210
|
+
eager_autoload do
|
211
|
+
autoload :BelongsToAssociation
|
212
|
+
autoload :BelongsToPolymorphicAssociation
|
213
|
+
autoload :HasManyAssociation
|
214
|
+
autoload :HasManyThroughAssociation
|
215
|
+
autoload :HasOneAssociation
|
216
|
+
autoload :HasOneThroughAssociation
|
217
|
+
|
218
|
+
autoload :Preloader
|
219
|
+
autoload :JoinDependency
|
220
|
+
autoload :AssociationScope
|
221
|
+
autoload :AliasTracker
|
222
|
+
end
|
223
|
+
|
224
|
+
def self.eager_load!
|
225
|
+
super
|
226
|
+
Preloader.eager_load!
|
227
|
+
end
|
228
|
+
|
229
|
+
# Returns the association instance for the given name, instantiating it if it doesn't already exist
|
230
|
+
def association(name) #:nodoc:
|
231
|
+
association = association_instance_get(name)
|
232
|
+
|
233
|
+
if association.nil?
|
234
|
+
unless reflection = self.class._reflect_on_association(name)
|
235
|
+
raise AssociationNotFoundError.new(self, name)
|
236
|
+
end
|
237
|
+
association = reflection.association_class.new(self, reflection)
|
238
|
+
association_instance_set(name, association)
|
239
|
+
end
|
240
|
+
|
241
|
+
association
|
242
|
+
end
|
243
|
+
|
244
|
+
def association_cached?(name) # :nodoc:
|
245
|
+
@association_cache.key?(name)
|
246
|
+
end
|
247
|
+
|
248
|
+
def initialize_dup(*) # :nodoc:
|
249
|
+
@association_cache = {}
|
250
|
+
super
|
251
|
+
end
|
252
|
+
|
253
|
+
def reload(*) # :nodoc:
|
254
|
+
clear_association_cache
|
255
|
+
super
|
256
|
+
end
|
257
|
+
|
258
|
+
private
|
259
|
+
# Clears out the association cache.
|
260
|
+
def clear_association_cache
|
261
|
+
@association_cache.clear if persisted?
|
262
|
+
end
|
263
|
+
|
264
|
+
def init_internals
|
265
|
+
@association_cache = {}
|
266
|
+
super
|
267
|
+
end
|
268
|
+
|
269
|
+
# Returns the specified association instance if it exists, +nil+ otherwise.
|
270
|
+
def association_instance_get(name)
|
271
|
+
@association_cache[name]
|
272
|
+
end
|
273
|
+
|
274
|
+
# Set the specified association instance.
|
275
|
+
def association_instance_set(name, association)
|
276
|
+
@association_cache[name] = association
|
277
|
+
end
|
278
|
+
|
279
|
+
# \Associations are a set of macro-like class methods for tying objects together through
|
280
|
+
# foreign keys. They express relationships like "Project has one Project Manager"
|
281
|
+
# or "Project belongs to a Portfolio". Each macro adds a number of methods to the
|
282
|
+
# class which are specialized according to the collection or association symbol and the
|
283
|
+
# options hash. It works much the same way as Ruby's own <tt>attr*</tt>
|
284
|
+
# methods.
|
285
|
+
#
|
286
|
+
# class Project < ActiveRecord::Base
|
287
|
+
# belongs_to :portfolio
|
288
|
+
# has_one :project_manager
|
289
|
+
# has_many :milestones
|
290
|
+
# has_and_belongs_to_many :categories
|
291
|
+
# end
|
292
|
+
#
|
293
|
+
# The project class now has the following methods (and more) to ease the traversal and
|
294
|
+
# manipulation of its relationships:
|
295
|
+
# * <tt>Project#portfolio, Project#portfolio=(portfolio), Project#portfolio.nil?</tt>
|
296
|
+
# * <tt>Project#project_manager, Project#project_manager=(project_manager), Project#project_manager.nil?,</tt>
|
297
|
+
# * <tt>Project#milestones.empty?, Project#milestones.size, Project#milestones, Project#milestones<<(milestone),</tt>
|
298
|
+
# <tt>Project#milestones.delete(milestone), Project#milestones.destroy(milestone), Project#milestones.find(milestone_id),</tt>
|
299
|
+
# <tt>Project#milestones.build, Project#milestones.create</tt>
|
300
|
+
# * <tt>Project#categories.empty?, Project#categories.size, Project#categories, Project#categories<<(category1),</tt>
|
301
|
+
# <tt>Project#categories.delete(category1), Project#categories.destroy(category1)</tt>
|
302
|
+
#
|
303
|
+
# === A word of warning
|
304
|
+
#
|
305
|
+
# Don't create associations that have the same name as {instance methods}[rdoc-ref:ActiveRecord::Core] of
|
306
|
+
# <tt>ActiveRecord::Base</tt>. Since the association adds a method with that name to
|
307
|
+
# its model, using an association with the same name as one provided by <tt>ActiveRecord::Base</tt> will override the method inherited through <tt>ActiveRecord::Base</tt> and will break things.
|
308
|
+
# For instance, +attributes+ and +connection+ would be bad choices for association names, because those names already exist in the list of <tt>ActiveRecord::Base</tt> instance methods.
|
309
|
+
#
|
310
|
+
# == Auto-generated methods
|
311
|
+
# See also Instance Public methods below for more details.
|
312
|
+
#
|
313
|
+
# === Singular associations (one-to-one)
|
314
|
+
# | | belongs_to |
|
315
|
+
# generated methods | belongs_to | :polymorphic | has_one
|
316
|
+
# ----------------------------------+------------+--------------+---------
|
317
|
+
# other | X | X | X
|
318
|
+
# other=(other) | X | X | X
|
319
|
+
# build_other(attributes={}) | X | | X
|
320
|
+
# create_other(attributes={}) | X | | X
|
321
|
+
# create_other!(attributes={}) | X | | X
|
322
|
+
# reload_other | X | X | X
|
323
|
+
#
|
324
|
+
# === Collection associations (one-to-many / many-to-many)
|
325
|
+
# | | | has_many
|
326
|
+
# generated methods | habtm | has_many | :through
|
327
|
+
# ----------------------------------+-------+----------+----------
|
328
|
+
# others | X | X | X
|
329
|
+
# others=(other,other,...) | X | X | X
|
330
|
+
# other_ids | X | X | X
|
331
|
+
# other_ids=(id,id,...) | X | X | X
|
332
|
+
# others<< | X | X | X
|
333
|
+
# others.push | X | X | X
|
334
|
+
# others.concat | X | X | X
|
335
|
+
# others.build(attributes={}) | X | X | X
|
336
|
+
# others.create(attributes={}) | X | X | X
|
337
|
+
# others.create!(attributes={}) | X | X | X
|
338
|
+
# others.size | X | X | X
|
339
|
+
# others.length | X | X | X
|
340
|
+
# others.count | X | X | X
|
341
|
+
# others.sum(*args) | X | X | X
|
342
|
+
# others.empty? | X | X | X
|
343
|
+
# others.clear | X | X | X
|
344
|
+
# others.delete(other,other,...) | X | X | X
|
345
|
+
# others.delete_all | X | X | X
|
346
|
+
# others.destroy(other,other,...) | X | X | X
|
347
|
+
# others.destroy_all | X | X | X
|
348
|
+
# others.find(*args) | X | X | X
|
349
|
+
# others.exists? | X | X | X
|
350
|
+
# others.distinct | X | X | X
|
351
|
+
# others.reset | X | X | X
|
352
|
+
# others.reload | X | X | X
|
353
|
+
#
|
354
|
+
# === Overriding generated methods
|
355
|
+
#
|
356
|
+
# Association methods are generated in a module included into the model
|
357
|
+
# class, making overrides easy. The original generated method can thus be
|
358
|
+
# called with +super+:
|
359
|
+
#
|
360
|
+
# class Car < ActiveRecord::Base
|
361
|
+
# belongs_to :owner
|
362
|
+
# belongs_to :old_owner
|
363
|
+
#
|
364
|
+
# def owner=(new_owner)
|
365
|
+
# self.old_owner = self.owner
|
366
|
+
# super
|
367
|
+
# end
|
368
|
+
# end
|
369
|
+
#
|
370
|
+
# The association methods module is included immediately after the
|
371
|
+
# generated attributes methods module, meaning an association will
|
372
|
+
# override the methods for an attribute with the same name.
|
373
|
+
#
|
374
|
+
# == Cardinality and associations
|
375
|
+
#
|
376
|
+
# Active Record associations can be used to describe one-to-one, one-to-many and many-to-many
|
377
|
+
# relationships between models. Each model uses an association to describe its role in
|
378
|
+
# the relation. The #belongs_to association is always used in the model that has
|
379
|
+
# the foreign key.
|
380
|
+
#
|
381
|
+
# === One-to-one
|
382
|
+
#
|
383
|
+
# Use #has_one in the base, and #belongs_to in the associated model.
|
384
|
+
#
|
385
|
+
# class Employee < ActiveRecord::Base
|
386
|
+
# has_one :office
|
387
|
+
# end
|
388
|
+
# class Office < ActiveRecord::Base
|
389
|
+
# belongs_to :employee # foreign key - employee_id
|
390
|
+
# end
|
391
|
+
#
|
392
|
+
# === One-to-many
|
393
|
+
#
|
394
|
+
# Use #has_many in the base, and #belongs_to in the associated model.
|
395
|
+
#
|
396
|
+
# class Manager < ActiveRecord::Base
|
397
|
+
# has_many :employees
|
398
|
+
# end
|
399
|
+
# class Employee < ActiveRecord::Base
|
400
|
+
# belongs_to :manager # foreign key - manager_id
|
401
|
+
# end
|
402
|
+
#
|
403
|
+
# === Many-to-many
|
404
|
+
#
|
405
|
+
# There are two ways to build a many-to-many relationship.
|
406
|
+
#
|
407
|
+
# The first way uses a #has_many association with the <tt>:through</tt> option and a join model, so
|
408
|
+
# there are two stages of associations.
|
409
|
+
#
|
410
|
+
# class Assignment < ActiveRecord::Base
|
411
|
+
# belongs_to :programmer # foreign key - programmer_id
|
412
|
+
# belongs_to :project # foreign key - project_id
|
413
|
+
# end
|
414
|
+
# class Programmer < ActiveRecord::Base
|
415
|
+
# has_many :assignments
|
416
|
+
# has_many :projects, through: :assignments
|
417
|
+
# end
|
418
|
+
# class Project < ActiveRecord::Base
|
419
|
+
# has_many :assignments
|
420
|
+
# has_many :programmers, through: :assignments
|
421
|
+
# end
|
422
|
+
#
|
423
|
+
# For the second way, use #has_and_belongs_to_many in both models. This requires a join table
|
424
|
+
# that has no corresponding model or primary key.
|
425
|
+
#
|
426
|
+
# class Programmer < ActiveRecord::Base
|
427
|
+
# has_and_belongs_to_many :projects # foreign keys in the join table
|
428
|
+
# end
|
429
|
+
# class Project < ActiveRecord::Base
|
430
|
+
# has_and_belongs_to_many :programmers # foreign keys in the join table
|
431
|
+
# end
|
432
|
+
#
|
433
|
+
# Choosing which way to build a many-to-many relationship is not always simple.
|
434
|
+
# If you need to work with the relationship model as its own entity,
|
435
|
+
# use #has_many <tt>:through</tt>. Use #has_and_belongs_to_many when working with legacy schemas or when
|
436
|
+
# you never work directly with the relationship itself.
|
437
|
+
#
|
438
|
+
# == Is it a #belongs_to or #has_one association?
|
439
|
+
#
|
440
|
+
# Both express a 1-1 relationship. The difference is mostly where to place the foreign
|
441
|
+
# key, which goes on the table for the class declaring the #belongs_to relationship.
|
442
|
+
#
|
443
|
+
# class User < ActiveRecord::Base
|
444
|
+
# # I reference an account.
|
445
|
+
# belongs_to :account
|
446
|
+
# end
|
447
|
+
#
|
448
|
+
# class Account < ActiveRecord::Base
|
449
|
+
# # One user references me.
|
450
|
+
# has_one :user
|
451
|
+
# end
|
452
|
+
#
|
453
|
+
# The tables for these classes could look something like:
|
454
|
+
#
|
455
|
+
# CREATE TABLE users (
|
456
|
+
# id bigint NOT NULL auto_increment,
|
457
|
+
# account_id bigint default NULL,
|
458
|
+
# name varchar default NULL,
|
459
|
+
# PRIMARY KEY (id)
|
460
|
+
# )
|
461
|
+
#
|
462
|
+
# CREATE TABLE accounts (
|
463
|
+
# id bigint NOT NULL auto_increment,
|
464
|
+
# name varchar default NULL,
|
465
|
+
# PRIMARY KEY (id)
|
466
|
+
# )
|
467
|
+
#
|
468
|
+
# == Unsaved objects and associations
|
469
|
+
#
|
470
|
+
# You can manipulate objects and associations before they are saved to the database, but
|
471
|
+
# there is some special behavior you should be aware of, mostly involving the saving of
|
472
|
+
# associated objects.
|
473
|
+
#
|
474
|
+
# You can set the <tt>:autosave</tt> option on a #has_one, #belongs_to,
|
475
|
+
# #has_many, or #has_and_belongs_to_many association. Setting it
|
476
|
+
# to +true+ will _always_ save the members, whereas setting it to +false+ will
|
477
|
+
# _never_ save the members. More details about <tt>:autosave</tt> option is available at
|
478
|
+
# AutosaveAssociation.
|
479
|
+
#
|
480
|
+
# === One-to-one associations
|
481
|
+
#
|
482
|
+
# * Assigning an object to a #has_one association automatically saves that object and
|
483
|
+
# the object being replaced (if there is one), in order to update their foreign
|
484
|
+
# keys - except if the parent object is unsaved (<tt>new_record? == true</tt>).
|
485
|
+
# * If either of these saves fail (due to one of the objects being invalid), an
|
486
|
+
# ActiveRecord::RecordNotSaved exception is raised and the assignment is
|
487
|
+
# cancelled.
|
488
|
+
# * If you wish to assign an object to a #has_one association without saving it,
|
489
|
+
# use the <tt>#build_association</tt> method (documented below). The object being
|
490
|
+
# replaced will still be saved to update its foreign key.
|
491
|
+
# * Assigning an object to a #belongs_to association does not save the object, since
|
492
|
+
# the foreign key field belongs on the parent. It does not save the parent either.
|
493
|
+
#
|
494
|
+
# === Collections
|
495
|
+
#
|
496
|
+
# * Adding an object to a collection (#has_many or #has_and_belongs_to_many) automatically
|
497
|
+
# saves that object, except if the parent object (the owner of the collection) is not yet
|
498
|
+
# stored in the database.
|
499
|
+
# * If saving any of the objects being added to a collection (via <tt>push</tt> or similar)
|
500
|
+
# fails, then <tt>push</tt> returns +false+.
|
501
|
+
# * If saving fails while replacing the collection (via <tt>association=</tt>), an
|
502
|
+
# ActiveRecord::RecordNotSaved exception is raised and the assignment is
|
503
|
+
# cancelled.
|
504
|
+
# * You can add an object to a collection without automatically saving it by using the
|
505
|
+
# <tt>collection.build</tt> method (documented below).
|
506
|
+
# * All unsaved (<tt>new_record? == true</tt>) members of the collection are automatically
|
507
|
+
# saved when the parent is saved.
|
508
|
+
#
|
509
|
+
# == Customizing the query
|
510
|
+
#
|
511
|
+
# \Associations are built from <tt>Relation</tt> objects, and you can use the Relation syntax
|
512
|
+
# to customize them. For example, to add a condition:
|
513
|
+
#
|
514
|
+
# class Blog < ActiveRecord::Base
|
515
|
+
# has_many :published_posts, -> { where(published: true) }, class_name: 'Post'
|
516
|
+
# end
|
517
|
+
#
|
518
|
+
# Inside the <tt>-> { ... }</tt> block you can use all of the usual Relation methods.
|
519
|
+
#
|
520
|
+
# === Accessing the owner object
|
521
|
+
#
|
522
|
+
# Sometimes it is useful to have access to the owner object when building the query. The owner
|
523
|
+
# is passed as a parameter to the block. For example, the following association would find all
|
524
|
+
# events that occur on the user's birthday:
|
525
|
+
#
|
526
|
+
# class User < ActiveRecord::Base
|
527
|
+
# has_many :birthday_events, ->(user) { where(starts_on: user.birthday) }, class_name: 'Event'
|
528
|
+
# end
|
529
|
+
#
|
530
|
+
# Note: Joining, eager loading and preloading of these associations is not possible.
|
531
|
+
# These operations happen before instance creation and the scope will be called with a +nil+ argument.
|
532
|
+
#
|
533
|
+
# == Association callbacks
|
534
|
+
#
|
535
|
+
# Similar to the normal callbacks that hook into the life cycle of an Active Record object,
|
536
|
+
# you can also define callbacks that get triggered when you add an object to or remove an
|
537
|
+
# object from an association collection.
|
538
|
+
#
|
539
|
+
# class Project
|
540
|
+
# has_and_belongs_to_many :developers, after_add: :evaluate_velocity
|
541
|
+
#
|
542
|
+
# def evaluate_velocity(developer)
|
543
|
+
# ...
|
544
|
+
# end
|
545
|
+
# end
|
546
|
+
#
|
547
|
+
# It's possible to stack callbacks by passing them as an array. Example:
|
548
|
+
#
|
549
|
+
# class Project
|
550
|
+
# has_and_belongs_to_many :developers,
|
551
|
+
# after_add: [:evaluate_velocity, Proc.new { |p, d| p.shipping_date = Time.now}]
|
552
|
+
# end
|
553
|
+
#
|
554
|
+
# Possible callbacks are: +before_add+, +after_add+, +before_remove+ and +after_remove+.
|
555
|
+
#
|
556
|
+
# If any of the +before_add+ callbacks throw an exception, the object will not be
|
557
|
+
# added to the collection.
|
558
|
+
#
|
559
|
+
# Similarly, if any of the +before_remove+ callbacks throw an exception, the object
|
560
|
+
# will not be removed from the collection.
|
561
|
+
#
|
562
|
+
# == Association extensions
|
563
|
+
#
|
564
|
+
# The proxy objects that control the access to associations can be extended through anonymous
|
565
|
+
# modules. This is especially beneficial for adding new finders, creators, and other
|
566
|
+
# factory-type methods that are only used as part of this association.
|
567
|
+
#
|
568
|
+
# class Account < ActiveRecord::Base
|
569
|
+
# has_many :people do
|
570
|
+
# def find_or_create_by_name(name)
|
571
|
+
# first_name, last_name = name.split(" ", 2)
|
572
|
+
# find_or_create_by(first_name: first_name, last_name: last_name)
|
573
|
+
# end
|
574
|
+
# end
|
575
|
+
# end
|
576
|
+
#
|
577
|
+
# person = Account.first.people.find_or_create_by_name("David Heinemeier Hansson")
|
578
|
+
# person.first_name # => "David"
|
579
|
+
# person.last_name # => "Heinemeier Hansson"
|
580
|
+
#
|
581
|
+
# If you need to share the same extensions between many associations, you can use a named
|
582
|
+
# extension module.
|
583
|
+
#
|
584
|
+
# module FindOrCreateByNameExtension
|
585
|
+
# def find_or_create_by_name(name)
|
586
|
+
# first_name, last_name = name.split(" ", 2)
|
587
|
+
# find_or_create_by(first_name: first_name, last_name: last_name)
|
588
|
+
# end
|
589
|
+
# end
|
590
|
+
#
|
591
|
+
# class Account < ActiveRecord::Base
|
592
|
+
# has_many :people, -> { extending FindOrCreateByNameExtension }
|
593
|
+
# end
|
594
|
+
#
|
595
|
+
# class Company < ActiveRecord::Base
|
596
|
+
# has_many :people, -> { extending FindOrCreateByNameExtension }
|
597
|
+
# end
|
598
|
+
#
|
599
|
+
# Some extensions can only be made to work with knowledge of the association's internals.
|
600
|
+
# Extensions can access relevant state using the following methods (where +items+ is the
|
601
|
+
# name of the association):
|
602
|
+
#
|
603
|
+
# * <tt>record.association(:items).owner</tt> - Returns the object the association is part of.
|
604
|
+
# * <tt>record.association(:items).reflection</tt> - Returns the reflection object that describes the association.
|
605
|
+
# * <tt>record.association(:items).target</tt> - Returns the associated object for #belongs_to and #has_one, or
|
606
|
+
# the collection of associated objects for #has_many and #has_and_belongs_to_many.
|
607
|
+
#
|
608
|
+
# However, inside the actual extension code, you will not have access to the <tt>record</tt> as
|
609
|
+
# above. In this case, you can access <tt>proxy_association</tt>. For example,
|
610
|
+
# <tt>record.association(:items)</tt> and <tt>record.items.proxy_association</tt> will return
|
611
|
+
# the same object, allowing you to make calls like <tt>proxy_association.owner</tt> inside
|
612
|
+
# association extensions.
|
613
|
+
#
|
614
|
+
# == Association Join Models
|
615
|
+
#
|
616
|
+
# Has Many associations can be configured with the <tt>:through</tt> option to use an
|
617
|
+
# explicit join model to retrieve the data. This operates similarly to a
|
618
|
+
# #has_and_belongs_to_many association. The advantage is that you're able to add validations,
|
619
|
+
# callbacks, and extra attributes on the join model. Consider the following schema:
|
620
|
+
#
|
621
|
+
# class Author < ActiveRecord::Base
|
622
|
+
# has_many :authorships
|
623
|
+
# has_many :books, through: :authorships
|
624
|
+
# end
|
625
|
+
#
|
626
|
+
# class Authorship < ActiveRecord::Base
|
627
|
+
# belongs_to :author
|
628
|
+
# belongs_to :book
|
629
|
+
# end
|
630
|
+
#
|
631
|
+
# @author = Author.first
|
632
|
+
# @author.authorships.collect { |a| a.book } # selects all books that the author's authorships belong to
|
633
|
+
# @author.books # selects all books by using the Authorship join model
|
634
|
+
#
|
635
|
+
# You can also go through a #has_many association on the join model:
|
636
|
+
#
|
637
|
+
# class Firm < ActiveRecord::Base
|
638
|
+
# has_many :clients
|
639
|
+
# has_many :invoices, through: :clients
|
640
|
+
# end
|
641
|
+
#
|
642
|
+
# class Client < ActiveRecord::Base
|
643
|
+
# belongs_to :firm
|
644
|
+
# has_many :invoices
|
645
|
+
# end
|
646
|
+
#
|
647
|
+
# class Invoice < ActiveRecord::Base
|
648
|
+
# belongs_to :client
|
649
|
+
# end
|
650
|
+
#
|
651
|
+
# @firm = Firm.first
|
652
|
+
# @firm.clients.flat_map { |c| c.invoices } # select all invoices for all clients of the firm
|
653
|
+
# @firm.invoices # selects all invoices by going through the Client join model
|
654
|
+
#
|
655
|
+
# Similarly you can go through a #has_one association on the join model:
|
656
|
+
#
|
657
|
+
# class Group < ActiveRecord::Base
|
658
|
+
# has_many :users
|
659
|
+
# has_many :avatars, through: :users
|
660
|
+
# end
|
661
|
+
#
|
662
|
+
# class User < ActiveRecord::Base
|
663
|
+
# belongs_to :group
|
664
|
+
# has_one :avatar
|
665
|
+
# end
|
666
|
+
#
|
667
|
+
# class Avatar < ActiveRecord::Base
|
668
|
+
# belongs_to :user
|
669
|
+
# end
|
670
|
+
#
|
671
|
+
# @group = Group.first
|
672
|
+
# @group.users.collect { |u| u.avatar }.compact # select all avatars for all users in the group
|
673
|
+
# @group.avatars # selects all avatars by going through the User join model.
|
674
|
+
#
|
675
|
+
# An important caveat with going through #has_one or #has_many associations on the
|
676
|
+
# join model is that these associations are *read-only*. For example, the following
|
677
|
+
# would not work following the previous example:
|
678
|
+
#
|
679
|
+
# @group.avatars << Avatar.new # this would work if User belonged_to Avatar rather than the other way around
|
680
|
+
# @group.avatars.delete(@group.avatars.last) # so would this
|
681
|
+
#
|
682
|
+
# == Setting Inverses
|
683
|
+
#
|
684
|
+
# If you are using a #belongs_to on the join model, it is a good idea to set the
|
685
|
+
# <tt>:inverse_of</tt> option on the #belongs_to, which will mean that the following example
|
686
|
+
# works correctly (where <tt>tags</tt> is a #has_many <tt>:through</tt> association):
|
687
|
+
#
|
688
|
+
# @post = Post.first
|
689
|
+
# @tag = @post.tags.build name: "ruby"
|
690
|
+
# @tag.save
|
691
|
+
#
|
692
|
+
# The last line ought to save the through record (a <tt>Tagging</tt>). This will only work if the
|
693
|
+
# <tt>:inverse_of</tt> is set:
|
694
|
+
#
|
695
|
+
# class Tagging < ActiveRecord::Base
|
696
|
+
# belongs_to :post
|
697
|
+
# belongs_to :tag, inverse_of: :taggings
|
698
|
+
# end
|
699
|
+
#
|
700
|
+
# If you do not set the <tt>:inverse_of</tt> record, the association will
|
701
|
+
# do its best to match itself up with the correct inverse. Automatic
|
702
|
+
# inverse detection only works on #has_many, #has_one, and
|
703
|
+
# #belongs_to associations.
|
704
|
+
#
|
705
|
+
# Extra options on the associations, as defined in the
|
706
|
+
# <tt>AssociationReflection::INVALID_AUTOMATIC_INVERSE_OPTIONS</tt> constant, will
|
707
|
+
# also prevent the association's inverse from being found automatically.
|
708
|
+
#
|
709
|
+
# The automatic guessing of the inverse association uses a heuristic based
|
710
|
+
# on the name of the class, so it may not work for all associations,
|
711
|
+
# especially the ones with non-standard names.
|
712
|
+
#
|
713
|
+
# You can turn off the automatic detection of inverse associations by setting
|
714
|
+
# the <tt>:inverse_of</tt> option to <tt>false</tt> like so:
|
715
|
+
#
|
716
|
+
# class Tagging < ActiveRecord::Base
|
717
|
+
# belongs_to :tag, inverse_of: false
|
718
|
+
# end
|
719
|
+
#
|
720
|
+
# == Nested \Associations
|
721
|
+
#
|
722
|
+
# You can actually specify *any* association with the <tt>:through</tt> option, including an
|
723
|
+
# association which has a <tt>:through</tt> option itself. For example:
|
724
|
+
#
|
725
|
+
# class Author < ActiveRecord::Base
|
726
|
+
# has_many :posts
|
727
|
+
# has_many :comments, through: :posts
|
728
|
+
# has_many :commenters, through: :comments
|
729
|
+
# end
|
730
|
+
#
|
731
|
+
# class Post < ActiveRecord::Base
|
732
|
+
# has_many :comments
|
733
|
+
# end
|
734
|
+
#
|
735
|
+
# class Comment < ActiveRecord::Base
|
736
|
+
# belongs_to :commenter
|
737
|
+
# end
|
738
|
+
#
|
739
|
+
# @author = Author.first
|
740
|
+
# @author.commenters # => People who commented on posts written by the author
|
741
|
+
#
|
742
|
+
# An equivalent way of setting up this association this would be:
|
743
|
+
#
|
744
|
+
# class Author < ActiveRecord::Base
|
745
|
+
# has_many :posts
|
746
|
+
# has_many :commenters, through: :posts
|
747
|
+
# end
|
748
|
+
#
|
749
|
+
# class Post < ActiveRecord::Base
|
750
|
+
# has_many :comments
|
751
|
+
# has_many :commenters, through: :comments
|
752
|
+
# end
|
753
|
+
#
|
754
|
+
# class Comment < ActiveRecord::Base
|
755
|
+
# belongs_to :commenter
|
756
|
+
# end
|
757
|
+
#
|
758
|
+
# When using a nested association, you will not be able to modify the association because there
|
759
|
+
# is not enough information to know what modification to make. For example, if you tried to
|
760
|
+
# add a <tt>Commenter</tt> in the example above, there would be no way to tell how to set up the
|
761
|
+
# intermediate <tt>Post</tt> and <tt>Comment</tt> objects.
|
762
|
+
#
|
763
|
+
# == Polymorphic \Associations
|
764
|
+
#
|
765
|
+
# Polymorphic associations on models are not restricted on what types of models they
|
766
|
+
# can be associated with. Rather, they specify an interface that a #has_many association
|
767
|
+
# must adhere to.
|
768
|
+
#
|
769
|
+
# class Asset < ActiveRecord::Base
|
770
|
+
# belongs_to :attachable, polymorphic: true
|
771
|
+
# end
|
772
|
+
#
|
773
|
+
# class Post < ActiveRecord::Base
|
774
|
+
# has_many :assets, as: :attachable # The :as option specifies the polymorphic interface to use.
|
775
|
+
# end
|
776
|
+
#
|
777
|
+
# @asset.attachable = @post
|
778
|
+
#
|
779
|
+
# This works by using a type column in addition to a foreign key to specify the associated
|
780
|
+
# record. In the Asset example, you'd need an +attachable_id+ integer column and an
|
781
|
+
# +attachable_type+ string column.
|
782
|
+
#
|
783
|
+
# Using polymorphic associations in combination with single table inheritance (STI) is
|
784
|
+
# a little tricky. In order for the associations to work as expected, ensure that you
|
785
|
+
# store the base model for the STI models in the type column of the polymorphic
|
786
|
+
# association. To continue with the asset example above, suppose there are guest posts
|
787
|
+
# and member posts that use the posts table for STI. In this case, there must be a +type+
|
788
|
+
# column in the posts table.
|
789
|
+
#
|
790
|
+
# Note: The <tt>attachable_type=</tt> method is being called when assigning an +attachable+.
|
791
|
+
# The +class_name+ of the +attachable+ is passed as a String.
|
792
|
+
#
|
793
|
+
# class Asset < ActiveRecord::Base
|
794
|
+
# belongs_to :attachable, polymorphic: true
|
795
|
+
#
|
796
|
+
# def attachable_type=(class_name)
|
797
|
+
# super(class_name.constantize.base_class.to_s)
|
798
|
+
# end
|
799
|
+
# end
|
800
|
+
#
|
801
|
+
# class Post < ActiveRecord::Base
|
802
|
+
# # because we store "Post" in attachable_type now dependent: :destroy will work
|
803
|
+
# has_many :assets, as: :attachable, dependent: :destroy
|
804
|
+
# end
|
805
|
+
#
|
806
|
+
# class GuestPost < Post
|
807
|
+
# end
|
808
|
+
#
|
809
|
+
# class MemberPost < Post
|
810
|
+
# end
|
811
|
+
#
|
812
|
+
# == Caching
|
813
|
+
#
|
814
|
+
# All of the methods are built on a simple caching principle that will keep the result
|
815
|
+
# of the last query around unless specifically instructed not to. The cache is even
|
816
|
+
# shared across methods to make it even cheaper to use the macro-added methods without
|
817
|
+
# worrying too much about performance at the first go.
|
818
|
+
#
|
819
|
+
# project.milestones # fetches milestones from the database
|
820
|
+
# project.milestones.size # uses the milestone cache
|
821
|
+
# project.milestones.empty? # uses the milestone cache
|
822
|
+
# project.milestones.reload.size # fetches milestones from the database
|
823
|
+
# project.milestones # uses the milestone cache
|
824
|
+
#
|
825
|
+
# == Eager loading of associations
|
826
|
+
#
|
827
|
+
# Eager loading is a way to find objects of a certain class and a number of named associations.
|
828
|
+
# It is one of the easiest ways to prevent the dreaded N+1 problem in which fetching 100
|
829
|
+
# posts that each need to display their author triggers 101 database queries. Through the
|
830
|
+
# use of eager loading, the number of queries will be reduced from 101 to 2.
|
831
|
+
#
|
832
|
+
# class Post < ActiveRecord::Base
|
833
|
+
# belongs_to :author
|
834
|
+
# has_many :comments
|
835
|
+
# end
|
836
|
+
#
|
837
|
+
# Consider the following loop using the class above:
|
838
|
+
#
|
839
|
+
# Post.all.each do |post|
|
840
|
+
# puts "Post: " + post.title
|
841
|
+
# puts "Written by: " + post.author.name
|
842
|
+
# puts "Last comment on: " + post.comments.first.created_on
|
843
|
+
# end
|
844
|
+
#
|
845
|
+
# To iterate over these one hundred posts, we'll generate 201 database queries. Let's
|
846
|
+
# first just optimize it for retrieving the author:
|
847
|
+
#
|
848
|
+
# Post.includes(:author).each do |post|
|
849
|
+
#
|
850
|
+
# This references the name of the #belongs_to association that also used the <tt>:author</tt>
|
851
|
+
# symbol. After loading the posts, +find+ will collect the +author_id+ from each one and load
|
852
|
+
# all of the referenced authors with one query. Doing so will cut down the number of queries
|
853
|
+
# from 201 to 102.
|
854
|
+
#
|
855
|
+
# We can improve upon the situation further by referencing both associations in the finder with:
|
856
|
+
#
|
857
|
+
# Post.includes(:author, :comments).each do |post|
|
858
|
+
#
|
859
|
+
# This will load all comments with a single query. This reduces the total number of queries
|
860
|
+
# to 3. In general, the number of queries will be 1 plus the number of associations
|
861
|
+
# named (except if some of the associations are polymorphic #belongs_to - see below).
|
862
|
+
#
|
863
|
+
# To include a deep hierarchy of associations, use a hash:
|
864
|
+
#
|
865
|
+
# Post.includes(:author, { comments: { author: :gravatar } }).each do |post|
|
866
|
+
#
|
867
|
+
# The above code will load all the comments and all of their associated
|
868
|
+
# authors and gravatars. You can mix and match any combination of symbols,
|
869
|
+
# arrays, and hashes to retrieve the associations you want to load.
|
870
|
+
#
|
871
|
+
# All of this power shouldn't fool you into thinking that you can pull out huge amounts
|
872
|
+
# of data with no performance penalty just because you've reduced the number of queries.
|
873
|
+
# The database still needs to send all the data to Active Record and it still needs to
|
874
|
+
# be processed. So it's no catch-all for performance problems, but it's a great way to
|
875
|
+
# cut down on the number of queries in a situation as the one described above.
|
876
|
+
#
|
877
|
+
# Since only one table is loaded at a time, conditions or orders cannot reference tables
|
878
|
+
# other than the main one. If this is the case, Active Record falls back to the previously
|
879
|
+
# used <tt>LEFT OUTER JOIN</tt> based strategy. For example:
|
880
|
+
#
|
881
|
+
# Post.includes([:author, :comments]).where(['comments.approved = ?', true])
|
882
|
+
#
|
883
|
+
# This will result in a single SQL query with joins along the lines of:
|
884
|
+
# <tt>LEFT OUTER JOIN comments ON comments.post_id = posts.id</tt> and
|
885
|
+
# <tt>LEFT OUTER JOIN authors ON authors.id = posts.author_id</tt>. Note that using conditions
|
886
|
+
# like this can have unintended consequences.
|
887
|
+
# In the above example, posts with no approved comments are not returned at all because
|
888
|
+
# the conditions apply to the SQL statement as a whole and not just to the association.
|
889
|
+
#
|
890
|
+
# You must disambiguate column references for this fallback to happen, for example
|
891
|
+
# <tt>order: "author.name DESC"</tt> will work but <tt>order: "name DESC"</tt> will not.
|
892
|
+
#
|
893
|
+
# If you want to load all posts (including posts with no approved comments), then write
|
894
|
+
# your own <tt>LEFT OUTER JOIN</tt> query using <tt>ON</tt>:
|
895
|
+
#
|
896
|
+
# Post.joins("LEFT OUTER JOIN comments ON comments.post_id = posts.id AND comments.approved = '1'")
|
897
|
+
#
|
898
|
+
# In this case, it is usually more natural to include an association which has conditions defined on it:
|
899
|
+
#
|
900
|
+
# class Post < ActiveRecord::Base
|
901
|
+
# has_many :approved_comments, -> { where(approved: true) }, class_name: 'Comment'
|
902
|
+
# end
|
903
|
+
#
|
904
|
+
# Post.includes(:approved_comments)
|
905
|
+
#
|
906
|
+
# This will load posts and eager load the +approved_comments+ association, which contains
|
907
|
+
# only those comments that have been approved.
|
908
|
+
#
|
909
|
+
# If you eager load an association with a specified <tt>:limit</tt> option, it will be ignored,
|
910
|
+
# returning all the associated objects:
|
911
|
+
#
|
912
|
+
# class Picture < ActiveRecord::Base
|
913
|
+
# has_many :most_recent_comments, -> { order('id DESC').limit(10) }, class_name: 'Comment'
|
914
|
+
# end
|
915
|
+
#
|
916
|
+
# Picture.includes(:most_recent_comments).first.most_recent_comments # => returns all associated comments.
|
917
|
+
#
|
918
|
+
# Eager loading is supported with polymorphic associations.
|
919
|
+
#
|
920
|
+
# class Address < ActiveRecord::Base
|
921
|
+
# belongs_to :addressable, polymorphic: true
|
922
|
+
# end
|
923
|
+
#
|
924
|
+
# A call that tries to eager load the addressable model
|
925
|
+
#
|
926
|
+
# Address.includes(:addressable)
|
927
|
+
#
|
928
|
+
# This will execute one query to load the addresses and load the addressables with one
|
929
|
+
# query per addressable type.
|
930
|
+
# For example, if all the addressables are either of class Person or Company, then a total
|
931
|
+
# of 3 queries will be executed. The list of addressable types to load is determined on
|
932
|
+
# the back of the addresses loaded. This is not supported if Active Record has to fallback
|
933
|
+
# to the previous implementation of eager loading and will raise ActiveRecord::EagerLoadPolymorphicError.
|
934
|
+
# The reason is that the parent model's type is a column value so its corresponding table
|
935
|
+
# name cannot be put in the +FROM+/+JOIN+ clauses of that query.
|
936
|
+
#
|
937
|
+
# == Table Aliasing
|
938
|
+
#
|
939
|
+
# Active Record uses table aliasing in the case that a table is referenced multiple times
|
940
|
+
# in a join. If a table is referenced only once, the standard table name is used. The
|
941
|
+
# second time, the table is aliased as <tt>#{reflection_name}_#{parent_table_name}</tt>.
|
942
|
+
# Indexes are appended for any more successive uses of the table name.
|
943
|
+
#
|
944
|
+
# Post.joins(:comments)
|
945
|
+
# # => SELECT ... FROM posts INNER JOIN comments ON ...
|
946
|
+
# Post.joins(:special_comments) # STI
|
947
|
+
# # => SELECT ... FROM posts INNER JOIN comments ON ... AND comments.type = 'SpecialComment'
|
948
|
+
# Post.joins(:comments, :special_comments) # special_comments is the reflection name, posts is the parent table name
|
949
|
+
# # => SELECT ... FROM posts INNER JOIN comments ON ... INNER JOIN comments special_comments_posts
|
950
|
+
#
|
951
|
+
# Acts as tree example:
|
952
|
+
#
|
953
|
+
# TreeMixin.joins(:children)
|
954
|
+
# # => SELECT ... FROM mixins INNER JOIN mixins childrens_mixins ...
|
955
|
+
# TreeMixin.joins(children: :parent)
|
956
|
+
# # => SELECT ... FROM mixins INNER JOIN mixins childrens_mixins ...
|
957
|
+
# INNER JOIN parents_mixins ...
|
958
|
+
# TreeMixin.joins(children: {parent: :children})
|
959
|
+
# # => SELECT ... FROM mixins INNER JOIN mixins childrens_mixins ...
|
960
|
+
# INNER JOIN parents_mixins ...
|
961
|
+
# INNER JOIN mixins childrens_mixins_2
|
962
|
+
#
|
963
|
+
# Has and Belongs to Many join tables use the same idea, but add a <tt>_join</tt> suffix:
|
964
|
+
#
|
965
|
+
# Post.joins(:categories)
|
966
|
+
# # => SELECT ... FROM posts INNER JOIN categories_posts ... INNER JOIN categories ...
|
967
|
+
# Post.joins(categories: :posts)
|
968
|
+
# # => SELECT ... FROM posts INNER JOIN categories_posts ... INNER JOIN categories ...
|
969
|
+
# INNER JOIN categories_posts posts_categories_join INNER JOIN posts posts_categories
|
970
|
+
# Post.joins(categories: {posts: :categories})
|
971
|
+
# # => SELECT ... FROM posts INNER JOIN categories_posts ... INNER JOIN categories ...
|
972
|
+
# INNER JOIN categories_posts posts_categories_join INNER JOIN posts posts_categories
|
973
|
+
# INNER JOIN categories_posts categories_posts_join INNER JOIN categories categories_posts_2
|
974
|
+
#
|
975
|
+
# If you wish to specify your own custom joins using ActiveRecord::QueryMethods#joins method, those table
|
976
|
+
# names will take precedence over the eager associations:
|
977
|
+
#
|
978
|
+
# Post.joins(:comments).joins("inner join comments ...")
|
979
|
+
# # => SELECT ... FROM posts INNER JOIN comments_posts ON ... INNER JOIN comments ...
|
980
|
+
# Post.joins(:comments, :special_comments).joins("inner join comments ...")
|
981
|
+
# # => SELECT ... FROM posts INNER JOIN comments comments_posts ON ...
|
982
|
+
# INNER JOIN comments special_comments_posts ...
|
983
|
+
# INNER JOIN comments ...
|
984
|
+
#
|
985
|
+
# Table aliases are automatically truncated according to the maximum length of table identifiers
|
986
|
+
# according to the specific database.
|
987
|
+
#
|
988
|
+
# == Modules
|
989
|
+
#
|
990
|
+
# By default, associations will look for objects within the current module scope. Consider:
|
991
|
+
#
|
992
|
+
# module MyApplication
|
993
|
+
# module Business
|
994
|
+
# class Firm < ActiveRecord::Base
|
995
|
+
# has_many :clients
|
996
|
+
# end
|
997
|
+
#
|
998
|
+
# class Client < ActiveRecord::Base; end
|
999
|
+
# end
|
1000
|
+
# end
|
1001
|
+
#
|
1002
|
+
# When <tt>Firm#clients</tt> is called, it will in turn call
|
1003
|
+
# <tt>MyApplication::Business::Client.find_all_by_firm_id(firm.id)</tt>.
|
1004
|
+
# If you want to associate with a class in another module scope, this can be done by
|
1005
|
+
# specifying the complete class name.
|
1006
|
+
#
|
1007
|
+
# module MyApplication
|
1008
|
+
# module Business
|
1009
|
+
# class Firm < ActiveRecord::Base; end
|
1010
|
+
# end
|
1011
|
+
#
|
1012
|
+
# module Billing
|
1013
|
+
# class Account < ActiveRecord::Base
|
1014
|
+
# belongs_to :firm, class_name: "MyApplication::Business::Firm"
|
1015
|
+
# end
|
1016
|
+
# end
|
1017
|
+
# end
|
1018
|
+
#
|
1019
|
+
# == Bi-directional associations
|
1020
|
+
#
|
1021
|
+
# When you specify an association, there is usually an association on the associated model
|
1022
|
+
# that specifies the same relationship in reverse. For example, with the following models:
|
1023
|
+
#
|
1024
|
+
# class Dungeon < ActiveRecord::Base
|
1025
|
+
# has_many :traps
|
1026
|
+
# has_one :evil_wizard
|
1027
|
+
# end
|
1028
|
+
#
|
1029
|
+
# class Trap < ActiveRecord::Base
|
1030
|
+
# belongs_to :dungeon
|
1031
|
+
# end
|
1032
|
+
#
|
1033
|
+
# class EvilWizard < ActiveRecord::Base
|
1034
|
+
# belongs_to :dungeon
|
1035
|
+
# end
|
1036
|
+
#
|
1037
|
+
# The +traps+ association on +Dungeon+ and the +dungeon+ association on +Trap+ are
|
1038
|
+
# the inverse of each other, and the inverse of the +dungeon+ association on +EvilWizard+
|
1039
|
+
# is the +evil_wizard+ association on +Dungeon+ (and vice-versa). By default,
|
1040
|
+
# Active Record can guess the inverse of the association based on the name
|
1041
|
+
# of the class. The result is the following:
|
1042
|
+
#
|
1043
|
+
# d = Dungeon.first
|
1044
|
+
# t = d.traps.first
|
1045
|
+
# d.object_id == t.dungeon.object_id # => true
|
1046
|
+
#
|
1047
|
+
# The +Dungeon+ instances +d+ and <tt>t.dungeon</tt> in the above example refer to
|
1048
|
+
# the same in-memory instance since the association matches the name of the class.
|
1049
|
+
# The result would be the same if we added +:inverse_of+ to our model definitions:
|
1050
|
+
#
|
1051
|
+
# class Dungeon < ActiveRecord::Base
|
1052
|
+
# has_many :traps, inverse_of: :dungeon
|
1053
|
+
# has_one :evil_wizard, inverse_of: :dungeon
|
1054
|
+
# end
|
1055
|
+
#
|
1056
|
+
# class Trap < ActiveRecord::Base
|
1057
|
+
# belongs_to :dungeon, inverse_of: :traps
|
1058
|
+
# end
|
1059
|
+
#
|
1060
|
+
# class EvilWizard < ActiveRecord::Base
|
1061
|
+
# belongs_to :dungeon, inverse_of: :evil_wizard
|
1062
|
+
# end
|
1063
|
+
#
|
1064
|
+
# For more information, see the documentation for the +:inverse_of+ option.
|
1065
|
+
#
|
1066
|
+
# == Deleting from associations
|
1067
|
+
#
|
1068
|
+
# === Dependent associations
|
1069
|
+
#
|
1070
|
+
# #has_many, #has_one, and #belongs_to associations support the <tt>:dependent</tt> option.
|
1071
|
+
# This allows you to specify that associated records should be deleted when the owner is
|
1072
|
+
# deleted.
|
1073
|
+
#
|
1074
|
+
# For example:
|
1075
|
+
#
|
1076
|
+
# class Author
|
1077
|
+
# has_many :posts, dependent: :destroy
|
1078
|
+
# end
|
1079
|
+
# Author.find(1).destroy # => Will destroy all of the author's posts, too
|
1080
|
+
#
|
1081
|
+
# The <tt>:dependent</tt> option can have different values which specify how the deletion
|
1082
|
+
# is done. For more information, see the documentation for this option on the different
|
1083
|
+
# specific association types. When no option is given, the behavior is to do nothing
|
1084
|
+
# with the associated records when destroying a record.
|
1085
|
+
#
|
1086
|
+
# Note that <tt>:dependent</tt> is implemented using Rails' callback
|
1087
|
+
# system, which works by processing callbacks in order. Therefore, other
|
1088
|
+
# callbacks declared either before or after the <tt>:dependent</tt> option
|
1089
|
+
# can affect what it does.
|
1090
|
+
#
|
1091
|
+
# Note that <tt>:dependent</tt> option is ignored for #has_one <tt>:through</tt> associations.
|
1092
|
+
#
|
1093
|
+
# === Delete or destroy?
|
1094
|
+
#
|
1095
|
+
# #has_many and #has_and_belongs_to_many associations have the methods <tt>destroy</tt>,
|
1096
|
+
# <tt>delete</tt>, <tt>destroy_all</tt> and <tt>delete_all</tt>.
|
1097
|
+
#
|
1098
|
+
# For #has_and_belongs_to_many, <tt>delete</tt> and <tt>destroy</tt> are the same: they
|
1099
|
+
# cause the records in the join table to be removed.
|
1100
|
+
#
|
1101
|
+
# For #has_many, <tt>destroy</tt> and <tt>destroy_all</tt> will always call the <tt>destroy</tt> method of the
|
1102
|
+
# record(s) being removed so that callbacks are run. However <tt>delete</tt> and <tt>delete_all</tt> will either
|
1103
|
+
# do the deletion according to the strategy specified by the <tt>:dependent</tt> option, or
|
1104
|
+
# if no <tt>:dependent</tt> option is given, then it will follow the default strategy.
|
1105
|
+
# The default strategy is to do nothing (leave the foreign keys with the parent ids set), except for
|
1106
|
+
# #has_many <tt>:through</tt>, where the default strategy is <tt>delete_all</tt> (delete
|
1107
|
+
# the join records, without running their callbacks).
|
1108
|
+
#
|
1109
|
+
# There is also a <tt>clear</tt> method which is the same as <tt>delete_all</tt>, except that
|
1110
|
+
# it returns the association rather than the records which have been deleted.
|
1111
|
+
#
|
1112
|
+
# === What gets deleted?
|
1113
|
+
#
|
1114
|
+
# There is a potential pitfall here: #has_and_belongs_to_many and #has_many <tt>:through</tt>
|
1115
|
+
# associations have records in join tables, as well as the associated records. So when we
|
1116
|
+
# call one of these deletion methods, what exactly should be deleted?
|
1117
|
+
#
|
1118
|
+
# The answer is that it is assumed that deletion on an association is about removing the
|
1119
|
+
# <i>link</i> between the owner and the associated object(s), rather than necessarily the
|
1120
|
+
# associated objects themselves. So with #has_and_belongs_to_many and #has_many
|
1121
|
+
# <tt>:through</tt>, the join records will be deleted, but the associated records won't.
|
1122
|
+
#
|
1123
|
+
# This makes sense if you think about it: if you were to call <tt>post.tags.delete(Tag.find_by(name: 'food'))</tt>
|
1124
|
+
# you would want the 'food' tag to be unlinked from the post, rather than for the tag itself
|
1125
|
+
# to be removed from the database.
|
1126
|
+
#
|
1127
|
+
# However, there are examples where this strategy doesn't make sense. For example, suppose
|
1128
|
+
# a person has many projects, and each project has many tasks. If we deleted one of a person's
|
1129
|
+
# tasks, we would probably not want the project to be deleted. In this scenario, the delete method
|
1130
|
+
# won't actually work: it can only be used if the association on the join model is a
|
1131
|
+
# #belongs_to. In other situations you are expected to perform operations directly on
|
1132
|
+
# either the associated records or the <tt>:through</tt> association.
|
1133
|
+
#
|
1134
|
+
# With a regular #has_many there is no distinction between the "associated records"
|
1135
|
+
# and the "link", so there is only one choice for what gets deleted.
|
1136
|
+
#
|
1137
|
+
# With #has_and_belongs_to_many and #has_many <tt>:through</tt>, if you want to delete the
|
1138
|
+
# associated records themselves, you can always do something along the lines of
|
1139
|
+
# <tt>person.tasks.each(&:destroy)</tt>.
|
1140
|
+
#
|
1141
|
+
# == Type safety with ActiveRecord::AssociationTypeMismatch
|
1142
|
+
#
|
1143
|
+
# If you attempt to assign an object to an association that doesn't match the inferred
|
1144
|
+
# or specified <tt>:class_name</tt>, you'll get an ActiveRecord::AssociationTypeMismatch.
|
1145
|
+
#
|
1146
|
+
# == Options
|
1147
|
+
#
|
1148
|
+
# All of the association macros can be specialized through options. This makes cases
|
1149
|
+
# more complex than the simple and guessable ones possible.
|
1150
|
+
module ClassMethods
|
1151
|
+
# Specifies a one-to-many association. The following methods for retrieval and query of
|
1152
|
+
# collections of associated objects will be added:
|
1153
|
+
#
|
1154
|
+
# +collection+ is a placeholder for the symbol passed as the +name+ argument, so
|
1155
|
+
# <tt>has_many :clients</tt> would add among others <tt>clients.empty?</tt>.
|
1156
|
+
#
|
1157
|
+
# [collection]
|
1158
|
+
# Returns a Relation of all the associated objects.
|
1159
|
+
# An empty Relation is returned if none are found.
|
1160
|
+
# [collection<<(object, ...)]
|
1161
|
+
# Adds one or more objects to the collection by setting their foreign keys to the collection's primary key.
|
1162
|
+
# Note that this operation instantly fires update SQL without waiting for the save or update call on the
|
1163
|
+
# parent object, unless the parent object is a new record.
|
1164
|
+
# This will also run validations and callbacks of associated object(s).
|
1165
|
+
# [collection.delete(object, ...)]
|
1166
|
+
# Removes one or more objects from the collection by setting their foreign keys to +NULL+.
|
1167
|
+
# Objects will be in addition destroyed if they're associated with <tt>dependent: :destroy</tt>,
|
1168
|
+
# and deleted if they're associated with <tt>dependent: :delete_all</tt>.
|
1169
|
+
#
|
1170
|
+
# If the <tt>:through</tt> option is used, then the join records are deleted (rather than
|
1171
|
+
# nullified) by default, but you can specify <tt>dependent: :destroy</tt> or
|
1172
|
+
# <tt>dependent: :nullify</tt> to override this.
|
1173
|
+
# [collection.destroy(object, ...)]
|
1174
|
+
# Removes one or more objects from the collection by running <tt>destroy</tt> on
|
1175
|
+
# each record, regardless of any dependent option, ensuring callbacks are run.
|
1176
|
+
#
|
1177
|
+
# If the <tt>:through</tt> option is used, then the join records are destroyed
|
1178
|
+
# instead, not the objects themselves.
|
1179
|
+
# [collection=objects]
|
1180
|
+
# Replaces the collections content by deleting and adding objects as appropriate. If the <tt>:through</tt>
|
1181
|
+
# option is true callbacks in the join models are triggered except destroy callbacks, since deletion is
|
1182
|
+
# direct by default. You can specify <tt>dependent: :destroy</tt> or
|
1183
|
+
# <tt>dependent: :nullify</tt> to override this.
|
1184
|
+
# [collection_singular_ids]
|
1185
|
+
# Returns an array of the associated objects' ids
|
1186
|
+
# [collection_singular_ids=ids]
|
1187
|
+
# Replace the collection with the objects identified by the primary keys in +ids+. This
|
1188
|
+
# method loads the models and calls <tt>collection=</tt>. See above.
|
1189
|
+
# [collection.clear]
|
1190
|
+
# Removes every object from the collection. This destroys the associated objects if they
|
1191
|
+
# are associated with <tt>dependent: :destroy</tt>, deletes them directly from the
|
1192
|
+
# database if <tt>dependent: :delete_all</tt>, otherwise sets their foreign keys to +NULL+.
|
1193
|
+
# If the <tt>:through</tt> option is true no destroy callbacks are invoked on the join models.
|
1194
|
+
# Join models are directly deleted.
|
1195
|
+
# [collection.empty?]
|
1196
|
+
# Returns +true+ if there are no associated objects.
|
1197
|
+
# [collection.size]
|
1198
|
+
# Returns the number of associated objects.
|
1199
|
+
# [collection.find(...)]
|
1200
|
+
# Finds an associated object according to the same rules as ActiveRecord::FinderMethods#find.
|
1201
|
+
# [collection.exists?(...)]
|
1202
|
+
# Checks whether an associated object with the given conditions exists.
|
1203
|
+
# Uses the same rules as ActiveRecord::FinderMethods#exists?.
|
1204
|
+
# [collection.build(attributes = {}, ...)]
|
1205
|
+
# Returns one or more new objects of the collection type that have been instantiated
|
1206
|
+
# with +attributes+ and linked to this object through a foreign key, but have not yet
|
1207
|
+
# been saved.
|
1208
|
+
# [collection.create(attributes = {})]
|
1209
|
+
# Returns a new object of the collection type that has been instantiated
|
1210
|
+
# with +attributes+, linked to this object through a foreign key, and that has already
|
1211
|
+
# been saved (if it passed the validation). *Note*: This only works if the base model
|
1212
|
+
# already exists in the DB, not if it is a new (unsaved) record!
|
1213
|
+
# [collection.create!(attributes = {})]
|
1214
|
+
# Does the same as <tt>collection.create</tt>, but raises ActiveRecord::RecordInvalid
|
1215
|
+
# if the record is invalid.
|
1216
|
+
# [collection.reload]
|
1217
|
+
# Returns a Relation of all of the associated objects, forcing a database read.
|
1218
|
+
# An empty Relation is returned if none are found.
|
1219
|
+
#
|
1220
|
+
# === Example
|
1221
|
+
#
|
1222
|
+
# A <tt>Firm</tt> class declares <tt>has_many :clients</tt>, which will add:
|
1223
|
+
# * <tt>Firm#clients</tt> (similar to <tt>Client.where(firm_id: id)</tt>)
|
1224
|
+
# * <tt>Firm#clients<<</tt>
|
1225
|
+
# * <tt>Firm#clients.delete</tt>
|
1226
|
+
# * <tt>Firm#clients.destroy</tt>
|
1227
|
+
# * <tt>Firm#clients=</tt>
|
1228
|
+
# * <tt>Firm#client_ids</tt>
|
1229
|
+
# * <tt>Firm#client_ids=</tt>
|
1230
|
+
# * <tt>Firm#clients.clear</tt>
|
1231
|
+
# * <tt>Firm#clients.empty?</tt> (similar to <tt>firm.clients.size == 0</tt>)
|
1232
|
+
# * <tt>Firm#clients.size</tt> (similar to <tt>Client.count "firm_id = #{id}"</tt>)
|
1233
|
+
# * <tt>Firm#clients.find</tt> (similar to <tt>Client.where(firm_id: id).find(id)</tt>)
|
1234
|
+
# * <tt>Firm#clients.exists?(name: 'ACME')</tt> (similar to <tt>Client.exists?(name: 'ACME', firm_id: firm.id)</tt>)
|
1235
|
+
# * <tt>Firm#clients.build</tt> (similar to <tt>Client.new(firm_id: id)</tt>)
|
1236
|
+
# * <tt>Firm#clients.create</tt> (similar to <tt>c = Client.new(firm_id: id); c.save; c</tt>)
|
1237
|
+
# * <tt>Firm#clients.create!</tt> (similar to <tt>c = Client.new(firm_id: id); c.save!</tt>)
|
1238
|
+
# * <tt>Firm#clients.reload</tt>
|
1239
|
+
# The declaration can also include an +options+ hash to specialize the behavior of the association.
|
1240
|
+
#
|
1241
|
+
# === Scopes
|
1242
|
+
#
|
1243
|
+
# You can pass a second argument +scope+ as a callable (i.e. proc or
|
1244
|
+
# lambda) to retrieve a specific set of records or customize the generated
|
1245
|
+
# query when you access the associated collection.
|
1246
|
+
#
|
1247
|
+
# Scope examples:
|
1248
|
+
# has_many :comments, -> { where(author_id: 1) }
|
1249
|
+
# has_many :employees, -> { joins(:address) }
|
1250
|
+
# has_many :posts, ->(blog) { where("max_post_length > ?", blog.max_post_length) }
|
1251
|
+
#
|
1252
|
+
# === Extensions
|
1253
|
+
#
|
1254
|
+
# The +extension+ argument allows you to pass a block into a has_many
|
1255
|
+
# association. This is useful for adding new finders, creators and other
|
1256
|
+
# factory-type methods to be used as part of the association.
|
1257
|
+
#
|
1258
|
+
# Extension examples:
|
1259
|
+
# has_many :employees do
|
1260
|
+
# def find_or_create_by_name(name)
|
1261
|
+
# first_name, last_name = name.split(" ", 2)
|
1262
|
+
# find_or_create_by(first_name: first_name, last_name: last_name)
|
1263
|
+
# end
|
1264
|
+
# end
|
1265
|
+
#
|
1266
|
+
# === Options
|
1267
|
+
# [:class_name]
|
1268
|
+
# Specify the class name of the association. Use it only if that name can't be inferred
|
1269
|
+
# from the association name. So <tt>has_many :products</tt> will by default be linked
|
1270
|
+
# to the +Product+ class, but if the real class name is +SpecialProduct+, you'll have to
|
1271
|
+
# specify it with this option.
|
1272
|
+
# [:foreign_key]
|
1273
|
+
# Specify the foreign key used for the association. By default this is guessed to be the name
|
1274
|
+
# of this class in lower-case and "_id" suffixed. So a Person class that makes a #has_many
|
1275
|
+
# association will use "person_id" as the default <tt>:foreign_key</tt>.
|
1276
|
+
#
|
1277
|
+
# If you are going to modify the association (rather than just read from it), then it is
|
1278
|
+
# a good idea to set the <tt>:inverse_of</tt> option.
|
1279
|
+
# [:foreign_type]
|
1280
|
+
# Specify the column used to store the associated object's type, if this is a polymorphic
|
1281
|
+
# association. By default this is guessed to be the name of the polymorphic association
|
1282
|
+
# specified on "as" option with a "_type" suffix. So a class that defines a
|
1283
|
+
# <tt>has_many :tags, as: :taggable</tt> association will use "taggable_type" as the
|
1284
|
+
# default <tt>:foreign_type</tt>.
|
1285
|
+
# [:primary_key]
|
1286
|
+
# Specify the name of the column to use as the primary key for the association. By default this is +id+.
|
1287
|
+
# [:dependent]
|
1288
|
+
# Controls what happens to the associated objects when
|
1289
|
+
# their owner is destroyed. Note that these are implemented as
|
1290
|
+
# callbacks, and Rails executes callbacks in order. Therefore, other
|
1291
|
+
# similar callbacks may affect the <tt>:dependent</tt> behavior, and the
|
1292
|
+
# <tt>:dependent</tt> behavior may affect other callbacks.
|
1293
|
+
#
|
1294
|
+
# * <tt>:destroy</tt> causes all the associated objects to also be destroyed.
|
1295
|
+
# * <tt>:delete_all</tt> causes all the associated objects to be deleted directly from the database (so callbacks will not be executed).
|
1296
|
+
# * <tt>:nullify</tt> causes the foreign keys to be set to +NULL+. Callbacks are not executed.
|
1297
|
+
# * <tt>:restrict_with_exception</tt> causes an exception to be raised if there are any associated records.
|
1298
|
+
# * <tt>:restrict_with_error</tt> causes an error to be added to the owner if there are any associated objects.
|
1299
|
+
#
|
1300
|
+
# If using with the <tt>:through</tt> option, the association on the join model must be
|
1301
|
+
# a #belongs_to, and the records which get deleted are the join records, rather than
|
1302
|
+
# the associated records.
|
1303
|
+
#
|
1304
|
+
# If using <tt>dependent: :destroy</tt> on a scoped association, only the scoped objects are destroyed.
|
1305
|
+
# For example, if a Post model defines
|
1306
|
+
# <tt>has_many :comments, -> { where published: true }, dependent: :destroy</tt> and <tt>destroy</tt> is
|
1307
|
+
# called on a post, only published comments are destroyed. This means that any unpublished comments in the
|
1308
|
+
# database would still contain a foreign key pointing to the now deleted post.
|
1309
|
+
# [:counter_cache]
|
1310
|
+
# This option can be used to configure a custom named <tt>:counter_cache.</tt> You only need this option,
|
1311
|
+
# when you customized the name of your <tt>:counter_cache</tt> on the #belongs_to association.
|
1312
|
+
# [:as]
|
1313
|
+
# Specifies a polymorphic interface (See #belongs_to).
|
1314
|
+
# [:through]
|
1315
|
+
# Specifies an association through which to perform the query. This can be any other type
|
1316
|
+
# of association, including other <tt>:through</tt> associations. Options for <tt>:class_name</tt>,
|
1317
|
+
# <tt>:primary_key</tt> and <tt>:foreign_key</tt> are ignored, as the association uses the
|
1318
|
+
# source reflection.
|
1319
|
+
#
|
1320
|
+
# If the association on the join model is a #belongs_to, the collection can be modified
|
1321
|
+
# and the records on the <tt>:through</tt> model will be automatically created and removed
|
1322
|
+
# as appropriate. Otherwise, the collection is read-only, so you should manipulate the
|
1323
|
+
# <tt>:through</tt> association directly.
|
1324
|
+
#
|
1325
|
+
# If you are going to modify the association (rather than just read from it), then it is
|
1326
|
+
# a good idea to set the <tt>:inverse_of</tt> option on the source association on the
|
1327
|
+
# join model. This allows associated records to be built which will automatically create
|
1328
|
+
# the appropriate join model records when they are saved. (See the 'Association Join Models'
|
1329
|
+
# section above.)
|
1330
|
+
# [:source]
|
1331
|
+
# Specifies the source association name used by #has_many <tt>:through</tt> queries.
|
1332
|
+
# Only use it if the name cannot be inferred from the association.
|
1333
|
+
# <tt>has_many :subscribers, through: :subscriptions</tt> will look for either <tt>:subscribers</tt> or
|
1334
|
+
# <tt>:subscriber</tt> on Subscription, unless a <tt>:source</tt> is given.
|
1335
|
+
# [:source_type]
|
1336
|
+
# Specifies type of the source association used by #has_many <tt>:through</tt> queries where the source
|
1337
|
+
# association is a polymorphic #belongs_to.
|
1338
|
+
# [:validate]
|
1339
|
+
# When set to +true+, validates new objects added to association when saving the parent object. +true+ by default.
|
1340
|
+
# If you want to ensure associated objects are revalidated on every update, use +validates_associated+.
|
1341
|
+
# [:autosave]
|
1342
|
+
# If true, always save the associated objects or destroy them if marked for destruction,
|
1343
|
+
# when saving the parent object. If false, never save or destroy the associated objects.
|
1344
|
+
# By default, only save associated objects that are new records. This option is implemented as a
|
1345
|
+
# +before_save+ callback. Because callbacks are run in the order they are defined, associated objects
|
1346
|
+
# may need to be explicitly saved in any user-defined +before_save+ callbacks.
|
1347
|
+
#
|
1348
|
+
# Note that NestedAttributes::ClassMethods#accepts_nested_attributes_for sets
|
1349
|
+
# <tt>:autosave</tt> to <tt>true</tt>.
|
1350
|
+
# [:inverse_of]
|
1351
|
+
# Specifies the name of the #belongs_to association on the associated object
|
1352
|
+
# that is the inverse of this #has_many association.
|
1353
|
+
# See ActiveRecord::Associations::ClassMethods's overview on Bi-directional associations for more detail.
|
1354
|
+
# [:extend]
|
1355
|
+
# Specifies a module or array of modules that will be extended into the association object returned.
|
1356
|
+
# Useful for defining methods on associations, especially when they should be shared between multiple
|
1357
|
+
# association objects.
|
1358
|
+
#
|
1359
|
+
# Option examples:
|
1360
|
+
# has_many :comments, -> { order("posted_on") }
|
1361
|
+
# has_many :comments, -> { includes(:author) }
|
1362
|
+
# has_many :people, -> { where(deleted: false).order("name") }, class_name: "Person"
|
1363
|
+
# has_many :tracks, -> { order("position") }, dependent: :destroy
|
1364
|
+
# has_many :comments, dependent: :nullify
|
1365
|
+
# has_many :tags, as: :taggable
|
1366
|
+
# has_many :reports, -> { readonly }
|
1367
|
+
# has_many :subscribers, through: :subscriptions, source: :user
|
1368
|
+
def has_many(name, scope = nil, **options, &extension)
|
1369
|
+
reflection = Builder::HasMany.build(self, name, scope, options, &extension)
|
1370
|
+
Reflection.add_reflection self, name, reflection
|
1371
|
+
end
|
1372
|
+
|
1373
|
+
# Specifies a one-to-one association with another class. This method should only be used
|
1374
|
+
# if the other class contains the foreign key. If the current class contains the foreign key,
|
1375
|
+
# then you should use #belongs_to instead. See also ActiveRecord::Associations::ClassMethods's overview
|
1376
|
+
# on when to use #has_one and when to use #belongs_to.
|
1377
|
+
#
|
1378
|
+
# The following methods for retrieval and query of a single associated object will be added:
|
1379
|
+
#
|
1380
|
+
# +association+ is a placeholder for the symbol passed as the +name+ argument, so
|
1381
|
+
# <tt>has_one :manager</tt> would add among others <tt>manager.nil?</tt>.
|
1382
|
+
#
|
1383
|
+
# [association]
|
1384
|
+
# Returns the associated object. +nil+ is returned if none is found.
|
1385
|
+
# [association=(associate)]
|
1386
|
+
# Assigns the associate object, extracts the primary key, sets it as the foreign key,
|
1387
|
+
# and saves the associate object. To avoid database inconsistencies, permanently deletes an existing
|
1388
|
+
# associated object when assigning a new one, even if the new one isn't saved to database.
|
1389
|
+
# [build_association(attributes = {})]
|
1390
|
+
# Returns a new object of the associated type that has been instantiated
|
1391
|
+
# with +attributes+ and linked to this object through a foreign key, but has not
|
1392
|
+
# yet been saved.
|
1393
|
+
# [create_association(attributes = {})]
|
1394
|
+
# Returns a new object of the associated type that has been instantiated
|
1395
|
+
# with +attributes+, linked to this object through a foreign key, and that
|
1396
|
+
# has already been saved (if it passed the validation).
|
1397
|
+
# [create_association!(attributes = {})]
|
1398
|
+
# Does the same as <tt>create_association</tt>, but raises ActiveRecord::RecordInvalid
|
1399
|
+
# if the record is invalid.
|
1400
|
+
# [reload_association]
|
1401
|
+
# Returns the associated object, forcing a database read.
|
1402
|
+
#
|
1403
|
+
# === Example
|
1404
|
+
#
|
1405
|
+
# An Account class declares <tt>has_one :beneficiary</tt>, which will add:
|
1406
|
+
# * <tt>Account#beneficiary</tt> (similar to <tt>Beneficiary.where(account_id: id).first</tt>)
|
1407
|
+
# * <tt>Account#beneficiary=(beneficiary)</tt> (similar to <tt>beneficiary.account_id = account.id; beneficiary.save</tt>)
|
1408
|
+
# * <tt>Account#build_beneficiary</tt> (similar to <tt>Beneficiary.new(account_id: id)</tt>)
|
1409
|
+
# * <tt>Account#create_beneficiary</tt> (similar to <tt>b = Beneficiary.new(account_id: id); b.save; b</tt>)
|
1410
|
+
# * <tt>Account#create_beneficiary!</tt> (similar to <tt>b = Beneficiary.new(account_id: id); b.save!; b</tt>)
|
1411
|
+
# * <tt>Account#reload_beneficiary</tt>
|
1412
|
+
#
|
1413
|
+
# === Scopes
|
1414
|
+
#
|
1415
|
+
# You can pass a second argument +scope+ as a callable (i.e. proc or
|
1416
|
+
# lambda) to retrieve a specific record or customize the generated query
|
1417
|
+
# when you access the associated object.
|
1418
|
+
#
|
1419
|
+
# Scope examples:
|
1420
|
+
# has_one :author, -> { where(comment_id: 1) }
|
1421
|
+
# has_one :employer, -> { joins(:company) }
|
1422
|
+
# has_one :latest_post, ->(blog) { where("created_at > ?", blog.enabled_at) }
|
1423
|
+
#
|
1424
|
+
# === Options
|
1425
|
+
#
|
1426
|
+
# The declaration can also include an +options+ hash to specialize the behavior of the association.
|
1427
|
+
#
|
1428
|
+
# Options are:
|
1429
|
+
# [:class_name]
|
1430
|
+
# Specify the class name of the association. Use it only if that name can't be inferred
|
1431
|
+
# from the association name. So <tt>has_one :manager</tt> will by default be linked to the Manager class, but
|
1432
|
+
# if the real class name is Person, you'll have to specify it with this option.
|
1433
|
+
# [:dependent]
|
1434
|
+
# Controls what happens to the associated object when
|
1435
|
+
# its owner is destroyed:
|
1436
|
+
#
|
1437
|
+
# * <tt>:destroy</tt> causes the associated object to also be destroyed
|
1438
|
+
# * <tt>:delete</tt> causes the associated object to be deleted directly from the database (so callbacks will not execute)
|
1439
|
+
# * <tt>:nullify</tt> causes the foreign key to be set to +NULL+. Callbacks are not executed.
|
1440
|
+
# * <tt>:restrict_with_exception</tt> causes an exception to be raised if there is an associated record
|
1441
|
+
# * <tt>:restrict_with_error</tt> causes an error to be added to the owner if there is an associated object
|
1442
|
+
#
|
1443
|
+
# Note that <tt>:dependent</tt> option is ignored when using <tt>:through</tt> option.
|
1444
|
+
# [:foreign_key]
|
1445
|
+
# Specify the foreign key used for the association. By default this is guessed to be the name
|
1446
|
+
# of this class in lower-case and "_id" suffixed. So a Person class that makes a #has_one association
|
1447
|
+
# will use "person_id" as the default <tt>:foreign_key</tt>.
|
1448
|
+
#
|
1449
|
+
# If you are going to modify the association (rather than just read from it), then it is
|
1450
|
+
# a good idea to set the <tt>:inverse_of</tt> option.
|
1451
|
+
# [:foreign_type]
|
1452
|
+
# Specify the column used to store the associated object's type, if this is a polymorphic
|
1453
|
+
# association. By default this is guessed to be the name of the polymorphic association
|
1454
|
+
# specified on "as" option with a "_type" suffix. So a class that defines a
|
1455
|
+
# <tt>has_one :tag, as: :taggable</tt> association will use "taggable_type" as the
|
1456
|
+
# default <tt>:foreign_type</tt>.
|
1457
|
+
# [:primary_key]
|
1458
|
+
# Specify the method that returns the primary key used for the association. By default this is +id+.
|
1459
|
+
# [:as]
|
1460
|
+
# Specifies a polymorphic interface (See #belongs_to).
|
1461
|
+
# [:through]
|
1462
|
+
# Specifies a Join Model through which to perform the query. Options for <tt>:class_name</tt>,
|
1463
|
+
# <tt>:primary_key</tt>, and <tt>:foreign_key</tt> are ignored, as the association uses the
|
1464
|
+
# source reflection. You can only use a <tt>:through</tt> query through a #has_one
|
1465
|
+
# or #belongs_to association on the join model.
|
1466
|
+
#
|
1467
|
+
# If you are going to modify the association (rather than just read from it), then it is
|
1468
|
+
# a good idea to set the <tt>:inverse_of</tt> option.
|
1469
|
+
# [:source]
|
1470
|
+
# Specifies the source association name used by #has_one <tt>:through</tt> queries.
|
1471
|
+
# Only use it if the name cannot be inferred from the association.
|
1472
|
+
# <tt>has_one :favorite, through: :favorites</tt> will look for a
|
1473
|
+
# <tt>:favorite</tt> on Favorite, unless a <tt>:source</tt> is given.
|
1474
|
+
# [:source_type]
|
1475
|
+
# Specifies type of the source association used by #has_one <tt>:through</tt> queries where the source
|
1476
|
+
# association is a polymorphic #belongs_to.
|
1477
|
+
# [:validate]
|
1478
|
+
# When set to +true+, validates new objects added to association when saving the parent object. +false+ by default.
|
1479
|
+
# If you want to ensure associated objects are revalidated on every update, use +validates_associated+.
|
1480
|
+
# [:autosave]
|
1481
|
+
# If true, always save the associated object or destroy it if marked for destruction,
|
1482
|
+
# when saving the parent object. If false, never save or destroy the associated object.
|
1483
|
+
# By default, only save the associated object if it's a new record.
|
1484
|
+
#
|
1485
|
+
# Note that NestedAttributes::ClassMethods#accepts_nested_attributes_for sets
|
1486
|
+
# <tt>:autosave</tt> to <tt>true</tt>.
|
1487
|
+
# [:inverse_of]
|
1488
|
+
# Specifies the name of the #belongs_to association on the associated object
|
1489
|
+
# that is the inverse of this #has_one association.
|
1490
|
+
# See ActiveRecord::Associations::ClassMethods's overview on Bi-directional associations for more detail.
|
1491
|
+
# [:required]
|
1492
|
+
# When set to +true+, the association will also have its presence validated.
|
1493
|
+
# This will validate the association itself, not the id. You can use
|
1494
|
+
# +:inverse_of+ to avoid an extra query during validation.
|
1495
|
+
#
|
1496
|
+
# Option examples:
|
1497
|
+
# has_one :credit_card, dependent: :destroy # destroys the associated credit card
|
1498
|
+
# has_one :credit_card, dependent: :nullify # updates the associated records foreign
|
1499
|
+
# # key value to NULL rather than destroying it
|
1500
|
+
# has_one :last_comment, -> { order('posted_on') }, class_name: "Comment"
|
1501
|
+
# has_one :project_manager, -> { where(role: 'project_manager') }, class_name: "Person"
|
1502
|
+
# has_one :attachment, as: :attachable
|
1503
|
+
# has_one :boss, -> { readonly }
|
1504
|
+
# has_one :club, through: :membership
|
1505
|
+
# has_one :primary_address, -> { where(primary: true) }, through: :addressables, source: :addressable
|
1506
|
+
# has_one :credit_card, required: true
|
1507
|
+
def has_one(name, scope = nil, **options)
|
1508
|
+
reflection = Builder::HasOne.build(self, name, scope, options)
|
1509
|
+
Reflection.add_reflection self, name, reflection
|
1510
|
+
end
|
1511
|
+
|
1512
|
+
# Specifies a one-to-one association with another class. This method should only be used
|
1513
|
+
# if this class contains the foreign key. If the other class contains the foreign key,
|
1514
|
+
# then you should use #has_one instead. See also ActiveRecord::Associations::ClassMethods's overview
|
1515
|
+
# on when to use #has_one and when to use #belongs_to.
|
1516
|
+
#
|
1517
|
+
# Methods will be added for retrieval and query for a single associated object, for which
|
1518
|
+
# this object holds an id:
|
1519
|
+
#
|
1520
|
+
# +association+ is a placeholder for the symbol passed as the +name+ argument, so
|
1521
|
+
# <tt>belongs_to :author</tt> would add among others <tt>author.nil?</tt>.
|
1522
|
+
#
|
1523
|
+
# [association]
|
1524
|
+
# Returns the associated object. +nil+ is returned if none is found.
|
1525
|
+
# [association=(associate)]
|
1526
|
+
# Assigns the associate object, extracts the primary key, and sets it as the foreign key.
|
1527
|
+
# [build_association(attributes = {})]
|
1528
|
+
# Returns a new object of the associated type that has been instantiated
|
1529
|
+
# with +attributes+ and linked to this object through a foreign key, but has not yet been saved.
|
1530
|
+
# [create_association(attributes = {})]
|
1531
|
+
# Returns a new object of the associated type that has been instantiated
|
1532
|
+
# with +attributes+, linked to this object through a foreign key, and that
|
1533
|
+
# has already been saved (if it passed the validation).
|
1534
|
+
# [create_association!(attributes = {})]
|
1535
|
+
# Does the same as <tt>create_association</tt>, but raises ActiveRecord::RecordInvalid
|
1536
|
+
# if the record is invalid.
|
1537
|
+
# [reload_association]
|
1538
|
+
# Returns the associated object, forcing a database read.
|
1539
|
+
#
|
1540
|
+
# === Example
|
1541
|
+
#
|
1542
|
+
# A Post class declares <tt>belongs_to :author</tt>, which will add:
|
1543
|
+
# * <tt>Post#author</tt> (similar to <tt>Author.find(author_id)</tt>)
|
1544
|
+
# * <tt>Post#author=(author)</tt> (similar to <tt>post.author_id = author.id</tt>)
|
1545
|
+
# * <tt>Post#build_author</tt> (similar to <tt>post.author = Author.new</tt>)
|
1546
|
+
# * <tt>Post#create_author</tt> (similar to <tt>post.author = Author.new; post.author.save; post.author</tt>)
|
1547
|
+
# * <tt>Post#create_author!</tt> (similar to <tt>post.author = Author.new; post.author.save!; post.author</tt>)
|
1548
|
+
# * <tt>Post#reload_author</tt>
|
1549
|
+
# The declaration can also include an +options+ hash to specialize the behavior of the association.
|
1550
|
+
#
|
1551
|
+
# === Scopes
|
1552
|
+
#
|
1553
|
+
# You can pass a second argument +scope+ as a callable (i.e. proc or
|
1554
|
+
# lambda) to retrieve a specific record or customize the generated query
|
1555
|
+
# when you access the associated object.
|
1556
|
+
#
|
1557
|
+
# Scope examples:
|
1558
|
+
# belongs_to :firm, -> { where(id: 2) }
|
1559
|
+
# belongs_to :user, -> { joins(:friends) }
|
1560
|
+
# belongs_to :level, ->(game) { where("game_level > ?", game.current_level) }
|
1561
|
+
#
|
1562
|
+
# === Options
|
1563
|
+
#
|
1564
|
+
# [:class_name]
|
1565
|
+
# Specify the class name of the association. Use it only if that name can't be inferred
|
1566
|
+
# from the association name. So <tt>belongs_to :author</tt> will by default be linked to the Author class, but
|
1567
|
+
# if the real class name is Person, you'll have to specify it with this option.
|
1568
|
+
# [:foreign_key]
|
1569
|
+
# Specify the foreign key used for the association. By default this is guessed to be the name
|
1570
|
+
# of the association with an "_id" suffix. So a class that defines a <tt>belongs_to :person</tt>
|
1571
|
+
# association will use "person_id" as the default <tt>:foreign_key</tt>. Similarly,
|
1572
|
+
# <tt>belongs_to :favorite_person, class_name: "Person"</tt> will use a foreign key
|
1573
|
+
# of "favorite_person_id".
|
1574
|
+
#
|
1575
|
+
# If you are going to modify the association (rather than just read from it), then it is
|
1576
|
+
# a good idea to set the <tt>:inverse_of</tt> option.
|
1577
|
+
# [:foreign_type]
|
1578
|
+
# Specify the column used to store the associated object's type, if this is a polymorphic
|
1579
|
+
# association. By default this is guessed to be the name of the association with a "_type"
|
1580
|
+
# suffix. So a class that defines a <tt>belongs_to :taggable, polymorphic: true</tt>
|
1581
|
+
# association will use "taggable_type" as the default <tt>:foreign_type</tt>.
|
1582
|
+
# [:primary_key]
|
1583
|
+
# Specify the method that returns the primary key of associated object used for the association.
|
1584
|
+
# By default this is id.
|
1585
|
+
# [:dependent]
|
1586
|
+
# If set to <tt>:destroy</tt>, the associated object is destroyed when this object is. If set to
|
1587
|
+
# <tt>:delete</tt>, the associated object is deleted *without* calling its destroy method.
|
1588
|
+
# This option should not be specified when #belongs_to is used in conjunction with
|
1589
|
+
# a #has_many relationship on another class because of the potential to leave
|
1590
|
+
# orphaned records behind.
|
1591
|
+
# [:counter_cache]
|
1592
|
+
# Caches the number of belonging objects on the associate class through the use of CounterCache::ClassMethods#increment_counter
|
1593
|
+
# and CounterCache::ClassMethods#decrement_counter. The counter cache is incremented when an object of this
|
1594
|
+
# class is created and decremented when it's destroyed. This requires that a column
|
1595
|
+
# named <tt>#{table_name}_count</tt> (such as +comments_count+ for a belonging Comment class)
|
1596
|
+
# is used on the associate class (such as a Post class) - that is the migration for
|
1597
|
+
# <tt>#{table_name}_count</tt> is created on the associate class (such that <tt>Post.comments_count</tt> will
|
1598
|
+
# return the count cached, see note below). You can also specify a custom counter
|
1599
|
+
# cache column by providing a column name instead of a +true+/+false+ value to this
|
1600
|
+
# option (e.g., <tt>counter_cache: :my_custom_counter</tt>.)
|
1601
|
+
# Note: Specifying a counter cache will add it to that model's list of readonly attributes
|
1602
|
+
# using +attr_readonly+.
|
1603
|
+
# [:polymorphic]
|
1604
|
+
# Specify this association is a polymorphic association by passing +true+.
|
1605
|
+
# Note: If you've enabled the counter cache, then you may want to add the counter cache attribute
|
1606
|
+
# to the +attr_readonly+ list in the associated classes (e.g. <tt>class Post; attr_readonly :comments_count; end</tt>).
|
1607
|
+
# [:validate]
|
1608
|
+
# When set to +true+, validates new objects added to association when saving the parent object. +false+ by default.
|
1609
|
+
# If you want to ensure associated objects are revalidated on every update, use +validates_associated+.
|
1610
|
+
# [:autosave]
|
1611
|
+
# If true, always save the associated object or destroy it if marked for destruction, when
|
1612
|
+
# saving the parent object.
|
1613
|
+
# If false, never save or destroy the associated object.
|
1614
|
+
# By default, only save the associated object if it's a new record.
|
1615
|
+
#
|
1616
|
+
# Note that NestedAttributes::ClassMethods#accepts_nested_attributes_for
|
1617
|
+
# sets <tt>:autosave</tt> to <tt>true</tt>.
|
1618
|
+
# [:touch]
|
1619
|
+
# If true, the associated object will be touched (the updated_at/on attributes set to current time)
|
1620
|
+
# when this record is either saved or destroyed. If you specify a symbol, that attribute
|
1621
|
+
# will be updated with the current time in addition to the updated_at/on attribute.
|
1622
|
+
# Please note that with touching no validation is performed and only the +after_touch+,
|
1623
|
+
# +after_commit+ and +after_rollback+ callbacks are executed.
|
1624
|
+
# [:inverse_of]
|
1625
|
+
# Specifies the name of the #has_one or #has_many association on the associated
|
1626
|
+
# object that is the inverse of this #belongs_to association.
|
1627
|
+
# See ActiveRecord::Associations::ClassMethods's overview on Bi-directional associations for more detail.
|
1628
|
+
# [:optional]
|
1629
|
+
# When set to +true+, the association will not have its presence validated.
|
1630
|
+
# [:required]
|
1631
|
+
# When set to +true+, the association will also have its presence validated.
|
1632
|
+
# This will validate the association itself, not the id. You can use
|
1633
|
+
# +:inverse_of+ to avoid an extra query during validation.
|
1634
|
+
# NOTE: <tt>required</tt> is set to <tt>true</tt> by default and is deprecated. If
|
1635
|
+
# you don't want to have association presence validated, use <tt>optional: true</tt>.
|
1636
|
+
# [:default]
|
1637
|
+
# Provide a callable (i.e. proc or lambda) to specify that the association should
|
1638
|
+
# be initialized with a particular record before validation.
|
1639
|
+
#
|
1640
|
+
# Option examples:
|
1641
|
+
# belongs_to :firm, foreign_key: "client_of"
|
1642
|
+
# belongs_to :person, primary_key: "name", foreign_key: "person_name"
|
1643
|
+
# belongs_to :author, class_name: "Person", foreign_key: "author_id"
|
1644
|
+
# belongs_to :valid_coupon, ->(o) { where "discounts > ?", o.payments_count },
|
1645
|
+
# class_name: "Coupon", foreign_key: "coupon_id"
|
1646
|
+
# belongs_to :attachable, polymorphic: true
|
1647
|
+
# belongs_to :project, -> { readonly }
|
1648
|
+
# belongs_to :post, counter_cache: true
|
1649
|
+
# belongs_to :comment, touch: true
|
1650
|
+
# belongs_to :company, touch: :employees_last_updated_at
|
1651
|
+
# belongs_to :user, optional: true
|
1652
|
+
# belongs_to :account, default: -> { company.account }
|
1653
|
+
def belongs_to(name, scope = nil, **options)
|
1654
|
+
reflection = Builder::BelongsTo.build(self, name, scope, options)
|
1655
|
+
Reflection.add_reflection self, name, reflection
|
1656
|
+
end
|
1657
|
+
|
1658
|
+
# Specifies a many-to-many relationship with another class. This associates two classes via an
|
1659
|
+
# intermediate join table. Unless the join table is explicitly specified as an option, it is
|
1660
|
+
# guessed using the lexical order of the class names. So a join between Developer and Project
|
1661
|
+
# will give the default join table name of "developers_projects" because "D" precedes "P" alphabetically.
|
1662
|
+
# Note that this precedence is calculated using the <tt><</tt> operator for String. This
|
1663
|
+
# means that if the strings are of different lengths, and the strings are equal when compared
|
1664
|
+
# up to the shortest length, then the longer string is considered of higher
|
1665
|
+
# lexical precedence than the shorter one. For example, one would expect the tables "paper_boxes" and "papers"
|
1666
|
+
# to generate a join table name of "papers_paper_boxes" because of the length of the name "paper_boxes",
|
1667
|
+
# but it in fact generates a join table name of "paper_boxes_papers". Be aware of this caveat, and use the
|
1668
|
+
# custom <tt>:join_table</tt> option if you need to.
|
1669
|
+
# If your tables share a common prefix, it will only appear once at the beginning. For example,
|
1670
|
+
# the tables "catalog_categories" and "catalog_products" generate a join table name of "catalog_categories_products".
|
1671
|
+
#
|
1672
|
+
# The join table should not have a primary key or a model associated with it. You must manually generate the
|
1673
|
+
# join table with a migration such as this:
|
1674
|
+
#
|
1675
|
+
# class CreateDevelopersProjectsJoinTable < ActiveRecord::Migration[5.0]
|
1676
|
+
# def change
|
1677
|
+
# create_join_table :developers, :projects
|
1678
|
+
# end
|
1679
|
+
# end
|
1680
|
+
#
|
1681
|
+
# It's also a good idea to add indexes to each of those columns to speed up the joins process.
|
1682
|
+
# However, in MySQL it is advised to add a compound index for both of the columns as MySQL only
|
1683
|
+
# uses one index per table during the lookup.
|
1684
|
+
#
|
1685
|
+
# Adds the following methods for retrieval and query:
|
1686
|
+
#
|
1687
|
+
# +collection+ is a placeholder for the symbol passed as the +name+ argument, so
|
1688
|
+
# <tt>has_and_belongs_to_many :categories</tt> would add among others <tt>categories.empty?</tt>.
|
1689
|
+
#
|
1690
|
+
# [collection]
|
1691
|
+
# Returns a Relation of all the associated objects.
|
1692
|
+
# An empty Relation is returned if none are found.
|
1693
|
+
# [collection<<(object, ...)]
|
1694
|
+
# Adds one or more objects to the collection by creating associations in the join table
|
1695
|
+
# (<tt>collection.push</tt> and <tt>collection.concat</tt> are aliases to this method).
|
1696
|
+
# Note that this operation instantly fires update SQL without waiting for the save or update call on the
|
1697
|
+
# parent object, unless the parent object is a new record.
|
1698
|
+
# [collection.delete(object, ...)]
|
1699
|
+
# Removes one or more objects from the collection by removing their associations from the join table.
|
1700
|
+
# This does not destroy the objects.
|
1701
|
+
# [collection.destroy(object, ...)]
|
1702
|
+
# Removes one or more objects from the collection by running destroy on each association in the join table, overriding any dependent option.
|
1703
|
+
# This does not destroy the objects.
|
1704
|
+
# [collection=objects]
|
1705
|
+
# Replaces the collection's content by deleting and adding objects as appropriate.
|
1706
|
+
# [collection_singular_ids]
|
1707
|
+
# Returns an array of the associated objects' ids.
|
1708
|
+
# [collection_singular_ids=ids]
|
1709
|
+
# Replace the collection by the objects identified by the primary keys in +ids+.
|
1710
|
+
# [collection.clear]
|
1711
|
+
# Removes every object from the collection. This does not destroy the objects.
|
1712
|
+
# [collection.empty?]
|
1713
|
+
# Returns +true+ if there are no associated objects.
|
1714
|
+
# [collection.size]
|
1715
|
+
# Returns the number of associated objects.
|
1716
|
+
# [collection.find(id)]
|
1717
|
+
# Finds an associated object responding to the +id+ and that
|
1718
|
+
# meets the condition that it has to be associated with this object.
|
1719
|
+
# Uses the same rules as ActiveRecord::FinderMethods#find.
|
1720
|
+
# [collection.exists?(...)]
|
1721
|
+
# Checks whether an associated object with the given conditions exists.
|
1722
|
+
# Uses the same rules as ActiveRecord::FinderMethods#exists?.
|
1723
|
+
# [collection.build(attributes = {})]
|
1724
|
+
# Returns a new object of the collection type that has been instantiated
|
1725
|
+
# with +attributes+ and linked to this object through the join table, but has not yet been saved.
|
1726
|
+
# [collection.create(attributes = {})]
|
1727
|
+
# Returns a new object of the collection type that has been instantiated
|
1728
|
+
# with +attributes+, linked to this object through the join table, and that has already been
|
1729
|
+
# saved (if it passed the validation).
|
1730
|
+
# [collection.reload]
|
1731
|
+
# Returns a Relation of all of the associated objects, forcing a database read.
|
1732
|
+
# An empty Relation is returned if none are found.
|
1733
|
+
#
|
1734
|
+
# === Example
|
1735
|
+
#
|
1736
|
+
# A Developer class declares <tt>has_and_belongs_to_many :projects</tt>, which will add:
|
1737
|
+
# * <tt>Developer#projects</tt>
|
1738
|
+
# * <tt>Developer#projects<<</tt>
|
1739
|
+
# * <tt>Developer#projects.delete</tt>
|
1740
|
+
# * <tt>Developer#projects.destroy</tt>
|
1741
|
+
# * <tt>Developer#projects=</tt>
|
1742
|
+
# * <tt>Developer#project_ids</tt>
|
1743
|
+
# * <tt>Developer#project_ids=</tt>
|
1744
|
+
# * <tt>Developer#projects.clear</tt>
|
1745
|
+
# * <tt>Developer#projects.empty?</tt>
|
1746
|
+
# * <tt>Developer#projects.size</tt>
|
1747
|
+
# * <tt>Developer#projects.find(id)</tt>
|
1748
|
+
# * <tt>Developer#projects.exists?(...)</tt>
|
1749
|
+
# * <tt>Developer#projects.build</tt> (similar to <tt>Project.new(developer_id: id)</tt>)
|
1750
|
+
# * <tt>Developer#projects.create</tt> (similar to <tt>c = Project.new(developer_id: id); c.save; c</tt>)
|
1751
|
+
# * <tt>Developer#projects.reload</tt>
|
1752
|
+
# The declaration may include an +options+ hash to specialize the behavior of the association.
|
1753
|
+
#
|
1754
|
+
# === Scopes
|
1755
|
+
#
|
1756
|
+
# You can pass a second argument +scope+ as a callable (i.e. proc or
|
1757
|
+
# lambda) to retrieve a specific set of records or customize the generated
|
1758
|
+
# query when you access the associated collection.
|
1759
|
+
#
|
1760
|
+
# Scope examples:
|
1761
|
+
# has_and_belongs_to_many :projects, -> { includes(:milestones, :manager) }
|
1762
|
+
# has_and_belongs_to_many :categories, ->(post) {
|
1763
|
+
# where("default_category = ?", post.default_category)
|
1764
|
+
#
|
1765
|
+
# === Extensions
|
1766
|
+
#
|
1767
|
+
# The +extension+ argument allows you to pass a block into a
|
1768
|
+
# has_and_belongs_to_many association. This is useful for adding new
|
1769
|
+
# finders, creators and other factory-type methods to be used as part of
|
1770
|
+
# the association.
|
1771
|
+
#
|
1772
|
+
# Extension examples:
|
1773
|
+
# has_and_belongs_to_many :contractors do
|
1774
|
+
# def find_or_create_by_name(name)
|
1775
|
+
# first_name, last_name = name.split(" ", 2)
|
1776
|
+
# find_or_create_by(first_name: first_name, last_name: last_name)
|
1777
|
+
# end
|
1778
|
+
# end
|
1779
|
+
#
|
1780
|
+
# === Options
|
1781
|
+
#
|
1782
|
+
# [:class_name]
|
1783
|
+
# Specify the class name of the association. Use it only if that name can't be inferred
|
1784
|
+
# from the association name. So <tt>has_and_belongs_to_many :projects</tt> will by default be linked to the
|
1785
|
+
# Project class, but if the real class name is SuperProject, you'll have to specify it with this option.
|
1786
|
+
# [:join_table]
|
1787
|
+
# Specify the name of the join table if the default based on lexical order isn't what you want.
|
1788
|
+
# <b>WARNING:</b> If you're overwriting the table name of either class, the +table_name+ method
|
1789
|
+
# MUST be declared underneath any #has_and_belongs_to_many declaration in order to work.
|
1790
|
+
# [:foreign_key]
|
1791
|
+
# Specify the foreign key used for the association. By default this is guessed to be the name
|
1792
|
+
# of this class in lower-case and "_id" suffixed. So a Person class that makes
|
1793
|
+
# a #has_and_belongs_to_many association to Project will use "person_id" as the
|
1794
|
+
# default <tt>:foreign_key</tt>.
|
1795
|
+
#
|
1796
|
+
# If you are going to modify the association (rather than just read from it), then it is
|
1797
|
+
# a good idea to set the <tt>:inverse_of</tt> option.
|
1798
|
+
# [:association_foreign_key]
|
1799
|
+
# Specify the foreign key used for the association on the receiving side of the association.
|
1800
|
+
# By default this is guessed to be the name of the associated class in lower-case and "_id" suffixed.
|
1801
|
+
# So if a Person class makes a #has_and_belongs_to_many association to Project,
|
1802
|
+
# the association will use "project_id" as the default <tt>:association_foreign_key</tt>.
|
1803
|
+
# [:validate]
|
1804
|
+
# When set to +true+, validates new objects added to association when saving the parent object. +true+ by default.
|
1805
|
+
# If you want to ensure associated objects are revalidated on every update, use +validates_associated+.
|
1806
|
+
# [:autosave]
|
1807
|
+
# If true, always save the associated objects or destroy them if marked for destruction, when
|
1808
|
+
# saving the parent object.
|
1809
|
+
# If false, never save or destroy the associated objects.
|
1810
|
+
# By default, only save associated objects that are new records.
|
1811
|
+
#
|
1812
|
+
# Note that NestedAttributes::ClassMethods#accepts_nested_attributes_for sets
|
1813
|
+
# <tt>:autosave</tt> to <tt>true</tt>.
|
1814
|
+
#
|
1815
|
+
# Option examples:
|
1816
|
+
# has_and_belongs_to_many :projects
|
1817
|
+
# has_and_belongs_to_many :projects, -> { includes(:milestones, :manager) }
|
1818
|
+
# has_and_belongs_to_many :nations, class_name: "Country"
|
1819
|
+
# has_and_belongs_to_many :categories, join_table: "prods_cats"
|
1820
|
+
# has_and_belongs_to_many :categories, -> { readonly }
|
1821
|
+
def has_and_belongs_to_many(name, scope = nil, **options, &extension)
|
1822
|
+
habtm_reflection = ActiveRecord::Reflection::HasAndBelongsToManyReflection.new(name, scope, options, self)
|
1823
|
+
|
1824
|
+
builder = Builder::HasAndBelongsToMany.new name, self, options
|
1825
|
+
|
1826
|
+
join_model = builder.through_model
|
1827
|
+
|
1828
|
+
const_set join_model.name, join_model
|
1829
|
+
private_constant join_model.name
|
1830
|
+
|
1831
|
+
middle_reflection = builder.middle_reflection join_model
|
1832
|
+
|
1833
|
+
Builder::HasMany.define_callbacks self, middle_reflection
|
1834
|
+
Reflection.add_reflection self, middle_reflection.name, middle_reflection
|
1835
|
+
middle_reflection.parent_reflection = habtm_reflection
|
1836
|
+
|
1837
|
+
include Module.new {
|
1838
|
+
class_eval <<-RUBY, __FILE__, __LINE__ + 1
|
1839
|
+
def destroy_associations
|
1840
|
+
association(:#{middle_reflection.name}).delete_all(:delete_all)
|
1841
|
+
association(:#{name}).reset
|
1842
|
+
super
|
1843
|
+
end
|
1844
|
+
RUBY
|
1845
|
+
}
|
1846
|
+
|
1847
|
+
hm_options = {}
|
1848
|
+
hm_options[:through] = middle_reflection.name
|
1849
|
+
hm_options[:source] = join_model.right_reflection.name
|
1850
|
+
|
1851
|
+
[:before_add, :after_add, :before_remove, :after_remove, :autosave, :validate, :join_table, :class_name, :extend].each do |k|
|
1852
|
+
hm_options[k] = options[k] if options.key? k
|
1853
|
+
end
|
1854
|
+
|
1855
|
+
has_many name, scope, hm_options, &extension
|
1856
|
+
_reflections[name.to_s].parent_reflection = habtm_reflection
|
1857
|
+
end
|
1858
|
+
end
|
1859
|
+
end
|
1860
|
+
end
|