factorylabs-castronaut 0.7.5
Sign up to get free protection for your applications and to get access to all the features.
- data/MIT-LICENSE +20 -0
- data/README.textile +67 -0
- data/Rakefile +78 -0
- data/bin/castronaut +75 -0
- data/config/castronaut.example.yml +41 -0
- data/config/castronaut.sample.yml +40 -0
- data/config/castronaut.yml +40 -0
- data/config/nginx_vhost.conf +17 -0
- data/config/thin_config.yml +13 -0
- data/lib/castronaut.rb +50 -0
- data/lib/castronaut/adapters.rb +13 -0
- data/lib/castronaut/adapters/development/adapter.rb +13 -0
- data/lib/castronaut/adapters/development/user.rb +25 -0
- data/lib/castronaut/adapters/ldap/adapter.rb +15 -0
- data/lib/castronaut/adapters/ldap/user.rb +40 -0
- data/lib/castronaut/adapters/restful_authentication/adapter.rb +15 -0
- data/lib/castronaut/adapters/restful_authentication/user.rb +50 -0
- data/lib/castronaut/application.rb +1 -0
- data/lib/castronaut/application/application.rb +70 -0
- data/lib/castronaut/application/public/javascripts/application.js +3 -0
- data/lib/castronaut/application/public/javascripts/jquery.js +32 -0
- data/lib/castronaut/application/public/stylesheets/screen.css +122 -0
- data/lib/castronaut/application/views/layout.erb +27 -0
- data/lib/castronaut/application/views/login.erb +31 -0
- data/lib/castronaut/application/views/logout.erb +13 -0
- data/lib/castronaut/application/views/proxy_validate.erb +21 -0
- data/lib/castronaut/application/views/service_validate.erb +14 -0
- data/lib/castronaut/authentication_result.rb +24 -0
- data/lib/castronaut/configuration.rb +110 -0
- data/lib/castronaut/db/001_create_cas_database.rb +47 -0
- data/lib/castronaut/models/consumeable.rb +18 -0
- data/lib/castronaut/models/dispenser.rb +14 -0
- data/lib/castronaut/models/login_ticket.rb +53 -0
- data/lib/castronaut/models/proxy_granting_ticket.rb +70 -0
- data/lib/castronaut/models/proxy_ticket.rb +43 -0
- data/lib/castronaut/models/service_ticket.rb +91 -0
- data/lib/castronaut/models/ticket_granting_ticket.rb +52 -0
- data/lib/castronaut/presenters/login.rb +84 -0
- data/lib/castronaut/presenters/logout.rb +56 -0
- data/lib/castronaut/presenters/process_login.rb +149 -0
- data/lib/castronaut/presenters/proxy_validate.rb +67 -0
- data/lib/castronaut/presenters/service_validate.rb +68 -0
- data/lib/castronaut/support/sample.rb +21 -0
- data/lib/castronaut/ticket_result.rb +27 -0
- data/lib/castronaut/utilities/random_string.rb +24 -0
- data/spec/app/controllers/application_spec.rb +86 -0
- data/spec/castronaut/adapters/development/adapter_spec.rb +14 -0
- data/spec/castronaut/adapters/development/user_spec.rb +55 -0
- data/spec/castronaut/adapters/ldap/adapter_spec.rb +14 -0
- data/spec/castronaut/adapters/ldap/user_spec.rb +25 -0
- data/spec/castronaut/adapters/restful_authentication/adapter_spec.rb +14 -0
- data/spec/castronaut/adapters/restful_authentication/user_spec.rb +108 -0
- data/spec/castronaut/adapters_spec.rb +13 -0
- data/spec/castronaut/authentication_result_spec.rb +20 -0
- data/spec/castronaut/configuration_spec.rb +172 -0
- data/spec/castronaut/models/consumeable_spec.rb +39 -0
- data/spec/castronaut/models/dispenser_spec.rb +30 -0
- data/spec/castronaut/models/login_ticket_spec.rb +107 -0
- data/spec/castronaut/models/proxy_granting_ticket_spec.rb +302 -0
- data/spec/castronaut/models/proxy_ticket_spec.rb +109 -0
- data/spec/castronaut/models/service_ticket_spec.rb +269 -0
- data/spec/castronaut/models/ticket_granting_ticket_spec.rb +89 -0
- data/spec/castronaut/presenters/login_spec.rb +152 -0
- data/spec/castronaut/presenters/logout_spec.rb +85 -0
- data/spec/castronaut/presenters/process_login_spec.rb +300 -0
- data/spec/castronaut/presenters/proxy_validate_spec.rb +103 -0
- data/spec/castronaut/presenters/service_validate_spec.rb +86 -0
- data/spec/castronaut/ticket_result_spec.rb +42 -0
- data/spec/castronaut/utilities/random_string_spec.rb +14 -0
- data/spec/castronaut_spec.rb +26 -0
- data/spec/spec_controller_helper.rb +17 -0
- data/spec/spec_helper.rb +39 -0
- data/spec/spec_rails_mocks.rb +132 -0
- data/vendor/activerecord/CHANGELOG +5786 -0
- data/vendor/activerecord/README +351 -0
- data/vendor/activerecord/RUNNING_UNIT_TESTS +36 -0
- data/vendor/activerecord/Rakefile +247 -0
- data/vendor/activerecord/examples/associations.png +0 -0
- data/vendor/activerecord/install.rb +30 -0
- data/vendor/activerecord/lib/active_record.rb +81 -0
- data/vendor/activerecord/lib/active_record/aggregations.rb +261 -0
- data/vendor/activerecord/lib/active_record/association_preload.rb +374 -0
- data/vendor/activerecord/lib/active_record/associations.rb +2227 -0
- data/vendor/activerecord/lib/active_record/associations/association_collection.rb +453 -0
- data/vendor/activerecord/lib/active_record/associations/association_proxy.rb +272 -0
- data/vendor/activerecord/lib/active_record/associations/belongs_to_association.rb +58 -0
- data/vendor/activerecord/lib/active_record/associations/belongs_to_polymorphic_association.rb +49 -0
- data/vendor/activerecord/lib/active_record/associations/has_and_belongs_to_many_association.rb +121 -0
- data/vendor/activerecord/lib/active_record/associations/has_many_association.rb +121 -0
- data/vendor/activerecord/lib/active_record/associations/has_many_through_association.rb +256 -0
- data/vendor/activerecord/lib/active_record/associations/has_one_association.rb +115 -0
- data/vendor/activerecord/lib/active_record/associations/has_one_through_association.rb +31 -0
- data/vendor/activerecord/lib/active_record/attribute_methods.rb +387 -0
- data/vendor/activerecord/lib/active_record/base.rb +2967 -0
- data/vendor/activerecord/lib/active_record/calculations.rb +299 -0
- data/vendor/activerecord/lib/active_record/callbacks.rb +331 -0
- data/vendor/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb +355 -0
- data/vendor/activerecord/lib/active_record/connection_adapters/abstract/connection_specification.rb +136 -0
- data/vendor/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb +201 -0
- data/vendor/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb +94 -0
- data/vendor/activerecord/lib/active_record/connection_adapters/abstract/quoting.rb +69 -0
- data/vendor/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb +705 -0
- data/vendor/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb +434 -0
- data/vendor/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb +210 -0
- data/vendor/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb +585 -0
- data/vendor/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb +1065 -0
- data/vendor/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb +34 -0
- data/vendor/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb +418 -0
- data/vendor/activerecord/lib/active_record/dirty.rb +183 -0
- data/vendor/activerecord/lib/active_record/dynamic_finder_match.rb +41 -0
- data/vendor/activerecord/lib/active_record/fixtures.rb +998 -0
- data/vendor/activerecord/lib/active_record/i18n_interpolation_deprecation.rb +26 -0
- data/vendor/activerecord/lib/active_record/locale/en.yml +54 -0
- data/vendor/activerecord/lib/active_record/locking/optimistic.rb +148 -0
- data/vendor/activerecord/lib/active_record/locking/pessimistic.rb +77 -0
- data/vendor/activerecord/lib/active_record/migration.rb +560 -0
- data/vendor/activerecord/lib/active_record/named_scope.rb +181 -0
- data/vendor/activerecord/lib/active_record/observer.rb +197 -0
- data/vendor/activerecord/lib/active_record/query_cache.rb +21 -0
- data/vendor/activerecord/lib/active_record/reflection.rb +307 -0
- data/vendor/activerecord/lib/active_record/schema.rb +51 -0
- data/vendor/activerecord/lib/active_record/schema_dumper.rb +177 -0
- data/vendor/activerecord/lib/active_record/serialization.rb +98 -0
- data/vendor/activerecord/lib/active_record/serializers/json_serializer.rb +80 -0
- data/vendor/activerecord/lib/active_record/serializers/xml_serializer.rb +338 -0
- data/vendor/activerecord/lib/active_record/test_case.rb +60 -0
- data/vendor/activerecord/lib/active_record/timestamp.rb +41 -0
- data/vendor/activerecord/lib/active_record/transactions.rb +185 -0
- data/vendor/activerecord/lib/active_record/validations.rb +1061 -0
- data/vendor/activerecord/lib/active_record/version.rb +9 -0
- data/vendor/activerecord/lib/activerecord.rb +1 -0
- data/vendor/activerecord/test/assets/example.log +1 -0
- data/vendor/activerecord/test/assets/flowers.jpg +0 -0
- data/vendor/activerecord/test/cases/aaa_create_tables_test.rb +24 -0
- data/vendor/activerecord/test/cases/active_schema_test_mysql.rb +100 -0
- data/vendor/activerecord/test/cases/active_schema_test_postgresql.rb +24 -0
- data/vendor/activerecord/test/cases/adapter_test.rb +133 -0
- data/vendor/activerecord/test/cases/aggregations_test.rb +167 -0
- data/vendor/activerecord/test/cases/ar_schema_test.rb +33 -0
- data/vendor/activerecord/test/cases/associations/belongs_to_associations_test.rb +441 -0
- data/vendor/activerecord/test/cases/associations/callbacks_test.rb +161 -0
- data/vendor/activerecord/test/cases/associations/cascaded_eager_loading_test.rb +123 -0
- data/vendor/activerecord/test/cases/associations/eager_load_includes_full_sti_class_test.rb +36 -0
- data/vendor/activerecord/test/cases/associations/eager_load_nested_include_test.rb +101 -0
- data/vendor/activerecord/test/cases/associations/eager_singularization_test.rb +145 -0
- data/vendor/activerecord/test/cases/associations/eager_test.rb +692 -0
- data/vendor/activerecord/test/cases/associations/extension_test.rb +62 -0
- data/vendor/activerecord/test/cases/associations/has_and_belongs_to_many_associations_test.rb +773 -0
- data/vendor/activerecord/test/cases/associations/has_many_associations_test.rb +1101 -0
- data/vendor/activerecord/test/cases/associations/has_many_through_associations_test.rb +247 -0
- data/vendor/activerecord/test/cases/associations/has_one_associations_test.rb +362 -0
- data/vendor/activerecord/test/cases/associations/has_one_through_associations_test.rb +161 -0
- data/vendor/activerecord/test/cases/associations/inner_join_association_test.rb +88 -0
- data/vendor/activerecord/test/cases/associations/join_model_test.rb +714 -0
- data/vendor/activerecord/test/cases/associations_test.rb +262 -0
- data/vendor/activerecord/test/cases/attribute_methods_test.rb +293 -0
- data/vendor/activerecord/test/cases/base_test.rb +2087 -0
- data/vendor/activerecord/test/cases/binary_test.rb +30 -0
- data/vendor/activerecord/test/cases/calculations_test.rb +328 -0
- data/vendor/activerecord/test/cases/callbacks_observers_test.rb +38 -0
- data/vendor/activerecord/test/cases/callbacks_test.rb +400 -0
- data/vendor/activerecord/test/cases/class_inheritable_attributes_test.rb +32 -0
- data/vendor/activerecord/test/cases/column_alias_test.rb +17 -0
- data/vendor/activerecord/test/cases/column_definition_test.rb +36 -0
- data/vendor/activerecord/test/cases/connection_test_firebird.rb +8 -0
- data/vendor/activerecord/test/cases/connection_test_mysql.rb +30 -0
- data/vendor/activerecord/test/cases/copy_table_test_sqlite.rb +69 -0
- data/vendor/activerecord/test/cases/database_statements_test.rb +12 -0
- data/vendor/activerecord/test/cases/datatype_test_postgresql.rb +203 -0
- data/vendor/activerecord/test/cases/date_time_test.rb +37 -0
- data/vendor/activerecord/test/cases/default_test_firebird.rb +16 -0
- data/vendor/activerecord/test/cases/defaults_test.rb +100 -0
- data/vendor/activerecord/test/cases/deprecated_finder_test.rb +30 -0
- data/vendor/activerecord/test/cases/dirty_test.rb +270 -0
- data/vendor/activerecord/test/cases/finder_respond_to_test.rb +76 -0
- data/vendor/activerecord/test/cases/finder_test.rb +1048 -0
- data/vendor/activerecord/test/cases/fixtures_test.rb +655 -0
- data/vendor/activerecord/test/cases/helper.rb +62 -0
- data/vendor/activerecord/test/cases/i18n_test.rb +41 -0
- data/vendor/activerecord/test/cases/inheritance_test.rb +262 -0
- data/vendor/activerecord/test/cases/invalid_date_test.rb +24 -0
- data/vendor/activerecord/test/cases/json_serialization_test.rb +205 -0
- data/vendor/activerecord/test/cases/lifecycle_test.rb +193 -0
- data/vendor/activerecord/test/cases/locking_test.rb +304 -0
- data/vendor/activerecord/test/cases/method_scoping_test.rb +569 -0
- data/vendor/activerecord/test/cases/migration_test.rb +1479 -0
- data/vendor/activerecord/test/cases/migration_test_firebird.rb +124 -0
- data/vendor/activerecord/test/cases/mixin_test.rb +96 -0
- data/vendor/activerecord/test/cases/modules_test.rb +39 -0
- data/vendor/activerecord/test/cases/multiple_db_test.rb +85 -0
- data/vendor/activerecord/test/cases/named_scope_test.rb +280 -0
- data/vendor/activerecord/test/cases/pk_test.rb +101 -0
- data/vendor/activerecord/test/cases/pooled_connections_test.rb +103 -0
- data/vendor/activerecord/test/cases/query_cache_test.rb +127 -0
- data/vendor/activerecord/test/cases/readonly_test.rb +107 -0
- data/vendor/activerecord/test/cases/reflection_test.rb +184 -0
- data/vendor/activerecord/test/cases/reload_models_test.rb +20 -0
- data/vendor/activerecord/test/cases/reserved_word_test_mysql.rb +176 -0
- data/vendor/activerecord/test/cases/sanitize_test.rb +25 -0
- data/vendor/activerecord/test/cases/schema_authorization_test_postgresql.rb +75 -0
- data/vendor/activerecord/test/cases/schema_dumper_test.rb +184 -0
- data/vendor/activerecord/test/cases/schema_test_postgresql.rb +102 -0
- data/vendor/activerecord/test/cases/serialization_test.rb +47 -0
- data/vendor/activerecord/test/cases/synonym_test_oracle.rb +17 -0
- data/vendor/activerecord/test/cases/transactions_test.rb +357 -0
- data/vendor/activerecord/test/cases/unconnected_test.rb +32 -0
- data/vendor/activerecord/test/cases/validations_i18n_test.rb +921 -0
- data/vendor/activerecord/test/cases/validations_test.rb +1552 -0
- data/vendor/activerecord/test/cases/xml_serialization_test.rb +202 -0
- data/vendor/activerecord/test/config.rb +5 -0
- data/vendor/activerecord/test/connections/native_db2/connection.rb +25 -0
- data/vendor/activerecord/test/connections/native_firebird/connection.rb +26 -0
- data/vendor/activerecord/test/connections/native_frontbase/connection.rb +27 -0
- data/vendor/activerecord/test/connections/native_mysql/connection.rb +25 -0
- data/vendor/activerecord/test/connections/native_openbase/connection.rb +21 -0
- data/vendor/activerecord/test/connections/native_oracle/connection.rb +27 -0
- data/vendor/activerecord/test/connections/native_postgresql/connection.rb +21 -0
- data/vendor/activerecord/test/connections/native_sqlite/connection.rb +25 -0
- data/vendor/activerecord/test/connections/native_sqlite3/connection.rb +25 -0
- data/vendor/activerecord/test/connections/native_sqlite3/in_memory_connection.rb +18 -0
- data/vendor/activerecord/test/connections/native_sybase/connection.rb +23 -0
- data/vendor/activerecord/test/fixtures/accounts.yml +28 -0
- data/vendor/activerecord/test/fixtures/all/developers.yml +0 -0
- data/vendor/activerecord/test/fixtures/all/people.csv +0 -0
- data/vendor/activerecord/test/fixtures/all/tasks.yml +0 -0
- data/vendor/activerecord/test/fixtures/author_addresses.yml +5 -0
- data/vendor/activerecord/test/fixtures/author_favorites.yml +4 -0
- data/vendor/activerecord/test/fixtures/authors.yml +9 -0
- data/vendor/activerecord/test/fixtures/binaries.yml +132 -0
- data/vendor/activerecord/test/fixtures/books.yml +7 -0
- data/vendor/activerecord/test/fixtures/categories.yml +14 -0
- data/vendor/activerecord/test/fixtures/categories/special_categories.yml +9 -0
- data/vendor/activerecord/test/fixtures/categories/subsubdir/arbitrary_filename.yml +4 -0
- data/vendor/activerecord/test/fixtures/categories_ordered.yml +7 -0
- data/vendor/activerecord/test/fixtures/categories_posts.yml +23 -0
- data/vendor/activerecord/test/fixtures/categorizations.yml +17 -0
- data/vendor/activerecord/test/fixtures/clubs.yml +6 -0
- data/vendor/activerecord/test/fixtures/comments.yml +59 -0
- data/vendor/activerecord/test/fixtures/companies.yml +56 -0
- data/vendor/activerecord/test/fixtures/computers.yml +4 -0
- data/vendor/activerecord/test/fixtures/courses.yml +7 -0
- data/vendor/activerecord/test/fixtures/customers.yml +26 -0
- data/vendor/activerecord/test/fixtures/developers.yml +21 -0
- data/vendor/activerecord/test/fixtures/developers_projects.yml +17 -0
- data/vendor/activerecord/test/fixtures/edges.yml +6 -0
- data/vendor/activerecord/test/fixtures/entrants.yml +14 -0
- data/vendor/activerecord/test/fixtures/fixture_database.sqlite3 +0 -0
- data/vendor/activerecord/test/fixtures/fixture_database_2.sqlite3 +0 -0
- data/vendor/activerecord/test/fixtures/fk_test_has_fk.yml +3 -0
- data/vendor/activerecord/test/fixtures/fk_test_has_pk.yml +2 -0
- data/vendor/activerecord/test/fixtures/funny_jokes.yml +10 -0
- data/vendor/activerecord/test/fixtures/items.yml +4 -0
- data/vendor/activerecord/test/fixtures/jobs.yml +7 -0
- data/vendor/activerecord/test/fixtures/legacy_things.yml +3 -0
- data/vendor/activerecord/test/fixtures/mateys.yml +4 -0
- data/vendor/activerecord/test/fixtures/members.yml +4 -0
- data/vendor/activerecord/test/fixtures/memberships.yml +20 -0
- data/vendor/activerecord/test/fixtures/minimalistics.yml +2 -0
- data/vendor/activerecord/test/fixtures/mixed_case_monkeys.yml +6 -0
- data/vendor/activerecord/test/fixtures/mixins.yml +29 -0
- data/vendor/activerecord/test/fixtures/movies.yml +7 -0
- data/vendor/activerecord/test/fixtures/naked/csv/accounts.csv +1 -0
- data/vendor/activerecord/test/fixtures/naked/yml/accounts.yml +1 -0
- data/vendor/activerecord/test/fixtures/naked/yml/companies.yml +1 -0
- data/vendor/activerecord/test/fixtures/naked/yml/courses.yml +1 -0
- data/vendor/activerecord/test/fixtures/organizations.yml +5 -0
- data/vendor/activerecord/test/fixtures/owners.yml +7 -0
- data/vendor/activerecord/test/fixtures/parrots.yml +27 -0
- data/vendor/activerecord/test/fixtures/parrots_pirates.yml +7 -0
- data/vendor/activerecord/test/fixtures/people.yml +6 -0
- data/vendor/activerecord/test/fixtures/pets.yml +14 -0
- data/vendor/activerecord/test/fixtures/pirates.yml +9 -0
- data/vendor/activerecord/test/fixtures/posts.yml +49 -0
- data/vendor/activerecord/test/fixtures/price_estimates.yml +7 -0
- data/vendor/activerecord/test/fixtures/projects.yml +7 -0
- data/vendor/activerecord/test/fixtures/readers.yml +9 -0
- data/vendor/activerecord/test/fixtures/references.yml +17 -0
- data/vendor/activerecord/test/fixtures/reserved_words/distinct.yml +5 -0
- data/vendor/activerecord/test/fixtures/reserved_words/distincts_selects.yml +11 -0
- data/vendor/activerecord/test/fixtures/reserved_words/group.yml +14 -0
- data/vendor/activerecord/test/fixtures/reserved_words/select.yml +8 -0
- data/vendor/activerecord/test/fixtures/reserved_words/values.yml +7 -0
- data/vendor/activerecord/test/fixtures/ships.yml +5 -0
- data/vendor/activerecord/test/fixtures/sponsors.yml +9 -0
- data/vendor/activerecord/test/fixtures/subscribers.yml +7 -0
- data/vendor/activerecord/test/fixtures/subscriptions.yml +12 -0
- data/vendor/activerecord/test/fixtures/taggings.yml +28 -0
- data/vendor/activerecord/test/fixtures/tags.yml +7 -0
- data/vendor/activerecord/test/fixtures/tasks.yml +7 -0
- data/vendor/activerecord/test/fixtures/topics.yml +42 -0
- data/vendor/activerecord/test/fixtures/treasures.yml +10 -0
- data/vendor/activerecord/test/fixtures/vertices.yml +4 -0
- data/vendor/activerecord/test/fixtures/warehouse-things.yml +3 -0
- data/vendor/activerecord/test/migrations/broken/100_migration_that_raises_exception.rb +10 -0
- data/vendor/activerecord/test/migrations/decimal/1_give_me_big_numbers.rb +15 -0
- data/vendor/activerecord/test/migrations/duplicate/1_people_have_last_names.rb +9 -0
- data/vendor/activerecord/test/migrations/duplicate/2_we_need_reminders.rb +12 -0
- data/vendor/activerecord/test/migrations/duplicate/3_foo.rb +7 -0
- data/vendor/activerecord/test/migrations/duplicate/3_innocent_jointable.rb +12 -0
- data/vendor/activerecord/test/migrations/duplicate_names/20080507052938_chunky.rb +7 -0
- data/vendor/activerecord/test/migrations/duplicate_names/20080507053028_chunky.rb +7 -0
- data/vendor/activerecord/test/migrations/interleaved/pass_1/3_innocent_jointable.rb +12 -0
- data/vendor/activerecord/test/migrations/interleaved/pass_2/1_people_have_last_names.rb +9 -0
- data/vendor/activerecord/test/migrations/interleaved/pass_2/3_innocent_jointable.rb +12 -0
- data/vendor/activerecord/test/migrations/interleaved/pass_3/1_people_have_last_names.rb +9 -0
- data/vendor/activerecord/test/migrations/interleaved/pass_3/2_i_raise_on_down.rb +8 -0
- data/vendor/activerecord/test/migrations/interleaved/pass_3/3_innocent_jointable.rb +12 -0
- data/vendor/activerecord/test/migrations/missing/1000_people_have_middle_names.rb +9 -0
- data/vendor/activerecord/test/migrations/missing/1_people_have_last_names.rb +9 -0
- data/vendor/activerecord/test/migrations/missing/3_we_need_reminders.rb +12 -0
- data/vendor/activerecord/test/migrations/missing/4_innocent_jointable.rb +12 -0
- data/vendor/activerecord/test/migrations/valid/1_people_have_last_names.rb +9 -0
- data/vendor/activerecord/test/migrations/valid/2_we_need_reminders.rb +12 -0
- data/vendor/activerecord/test/migrations/valid/3_innocent_jointable.rb +12 -0
- data/vendor/activerecord/test/models/author.rb +140 -0
- data/vendor/activerecord/test/models/auto_id.rb +4 -0
- data/vendor/activerecord/test/models/binary.rb +2 -0
- data/vendor/activerecord/test/models/book.rb +4 -0
- data/vendor/activerecord/test/models/categorization.rb +5 -0
- data/vendor/activerecord/test/models/category.rb +33 -0
- data/vendor/activerecord/test/models/citation.rb +6 -0
- data/vendor/activerecord/test/models/club.rb +13 -0
- data/vendor/activerecord/test/models/column_name.rb +3 -0
- data/vendor/activerecord/test/models/comment.rb +25 -0
- data/vendor/activerecord/test/models/company.rb +156 -0
- data/vendor/activerecord/test/models/company_in_module.rb +61 -0
- data/vendor/activerecord/test/models/computer.rb +3 -0
- data/vendor/activerecord/test/models/contact.rb +16 -0
- data/vendor/activerecord/test/models/course.rb +3 -0
- data/vendor/activerecord/test/models/customer.rb +73 -0
- data/vendor/activerecord/test/models/default.rb +2 -0
- data/vendor/activerecord/test/models/developer.rb +79 -0
- data/vendor/activerecord/test/models/edge.rb +5 -0
- data/vendor/activerecord/test/models/entrant.rb +3 -0
- data/vendor/activerecord/test/models/guid.rb +2 -0
- data/vendor/activerecord/test/models/item.rb +7 -0
- data/vendor/activerecord/test/models/job.rb +5 -0
- data/vendor/activerecord/test/models/joke.rb +3 -0
- data/vendor/activerecord/test/models/keyboard.rb +3 -0
- data/vendor/activerecord/test/models/legacy_thing.rb +3 -0
- data/vendor/activerecord/test/models/matey.rb +4 -0
- data/vendor/activerecord/test/models/member.rb +11 -0
- data/vendor/activerecord/test/models/member_detail.rb +4 -0
- data/vendor/activerecord/test/models/membership.rb +9 -0
- data/vendor/activerecord/test/models/minimalistic.rb +2 -0
- data/vendor/activerecord/test/models/mixed_case_monkey.rb +3 -0
- data/vendor/activerecord/test/models/movie.rb +5 -0
- data/vendor/activerecord/test/models/order.rb +4 -0
- data/vendor/activerecord/test/models/organization.rb +4 -0
- data/vendor/activerecord/test/models/owner.rb +4 -0
- data/vendor/activerecord/test/models/parrot.rb +14 -0
- data/vendor/activerecord/test/models/person.rb +10 -0
- data/vendor/activerecord/test/models/pet.rb +4 -0
- data/vendor/activerecord/test/models/pirate.rb +9 -0
- data/vendor/activerecord/test/models/post.rb +88 -0
- data/vendor/activerecord/test/models/price_estimate.rb +3 -0
- data/vendor/activerecord/test/models/project.rb +29 -0
- data/vendor/activerecord/test/models/reader.rb +4 -0
- data/vendor/activerecord/test/models/reference.rb +4 -0
- data/vendor/activerecord/test/models/reply.rb +39 -0
- data/vendor/activerecord/test/models/ship.rb +3 -0
- data/vendor/activerecord/test/models/sponsor.rb +4 -0
- data/vendor/activerecord/test/models/subject.rb +4 -0
- data/vendor/activerecord/test/models/subscriber.rb +8 -0
- data/vendor/activerecord/test/models/subscription.rb +4 -0
- data/vendor/activerecord/test/models/tag.rb +7 -0
- data/vendor/activerecord/test/models/tagging.rb +10 -0
- data/vendor/activerecord/test/models/task.rb +3 -0
- data/vendor/activerecord/test/models/topic.rb +69 -0
- data/vendor/activerecord/test/models/treasure.rb +6 -0
- data/vendor/activerecord/test/models/vertex.rb +9 -0
- data/vendor/activerecord/test/models/warehouse_thing.rb +5 -0
- data/vendor/activerecord/test/schema/mysql_specific_schema.rb +12 -0
- data/vendor/activerecord/test/schema/postgresql_specific_schema.rb +103 -0
- data/vendor/activerecord/test/schema/schema.rb +440 -0
- data/vendor/activerecord/test/schema/schema2.rb +6 -0
- data/vendor/activerecord/test/schema/sqlite_specific_schema.rb +25 -0
- data/vendor/activesupport/CHANGELOG +1257 -0
- data/vendor/activesupport/README +43 -0
- data/vendor/activesupport/lib/active_support.rb +61 -0
- data/vendor/activesupport/lib/active_support/base64.rb +33 -0
- data/vendor/activesupport/lib/active_support/basic_object.rb +24 -0
- data/vendor/activesupport/lib/active_support/buffered_logger.rb +122 -0
- data/vendor/activesupport/lib/active_support/cache.rb +223 -0
- data/vendor/activesupport/lib/active_support/cache/compressed_mem_cache_store.rb +20 -0
- data/vendor/activesupport/lib/active_support/cache/drb_store.rb +15 -0
- data/vendor/activesupport/lib/active_support/cache/file_store.rb +72 -0
- data/vendor/activesupport/lib/active_support/cache/mem_cache_store.rb +127 -0
- data/vendor/activesupport/lib/active_support/cache/memory_store.rb +52 -0
- data/vendor/activesupport/lib/active_support/cache/synchronized_memory_store.rb +47 -0
- data/vendor/activesupport/lib/active_support/callbacks.rb +280 -0
- data/vendor/activesupport/lib/active_support/core_ext.rb +4 -0
- data/vendor/activesupport/lib/active_support/core_ext/array.rb +13 -0
- data/vendor/activesupport/lib/active_support/core_ext/array/access.rb +53 -0
- data/vendor/activesupport/lib/active_support/core_ext/array/conversions.rb +183 -0
- data/vendor/activesupport/lib/active_support/core_ext/array/extract_options.rb +20 -0
- data/vendor/activesupport/lib/active_support/core_ext/array/grouping.rb +106 -0
- data/vendor/activesupport/lib/active_support/core_ext/array/random_access.rb +12 -0
- data/vendor/activesupport/lib/active_support/core_ext/base64.rb +4 -0
- data/vendor/activesupport/lib/active_support/core_ext/base64/encoding.rb +16 -0
- data/vendor/activesupport/lib/active_support/core_ext/benchmark.rb +12 -0
- data/vendor/activesupport/lib/active_support/core_ext/bigdecimal.rb +6 -0
- data/vendor/activesupport/lib/active_support/core_ext/bigdecimal/conversions.rb +37 -0
- data/vendor/activesupport/lib/active_support/core_ext/blank.rb +58 -0
- data/vendor/activesupport/lib/active_support/core_ext/cgi.rb +5 -0
- data/vendor/activesupport/lib/active_support/core_ext/cgi/escape_skipping_slashes.rb +14 -0
- data/vendor/activesupport/lib/active_support/core_ext/class.rb +4 -0
- data/vendor/activesupport/lib/active_support/core_ext/class/attribute_accessors.rb +54 -0
- data/vendor/activesupport/lib/active_support/core_ext/class/delegating_attributes.rb +46 -0
- data/vendor/activesupport/lib/active_support/core_ext/class/inheritable_attributes.rb +140 -0
- data/vendor/activesupport/lib/active_support/core_ext/class/removal.rb +50 -0
- data/vendor/activesupport/lib/active_support/core_ext/date.rb +10 -0
- data/vendor/activesupport/lib/active_support/core_ext/date/behavior.rb +42 -0
- data/vendor/activesupport/lib/active_support/core_ext/date/calculations.rb +230 -0
- data/vendor/activesupport/lib/active_support/core_ext/date/conversions.rb +107 -0
- data/vendor/activesupport/lib/active_support/core_ext/date_time.rb +12 -0
- data/vendor/activesupport/lib/active_support/core_ext/date_time/calculations.rb +126 -0
- data/vendor/activesupport/lib/active_support/core_ext/date_time/conversions.rb +96 -0
- data/vendor/activesupport/lib/active_support/core_ext/duplicable.rb +43 -0
- data/vendor/activesupport/lib/active_support/core_ext/enumerable.rb +107 -0
- data/vendor/activesupport/lib/active_support/core_ext/exception.rb +41 -0
- data/vendor/activesupport/lib/active_support/core_ext/file.rb +5 -0
- data/vendor/activesupport/lib/active_support/core_ext/file/atomic.rb +46 -0
- data/vendor/activesupport/lib/active_support/core_ext/float.rb +7 -0
- data/vendor/activesupport/lib/active_support/core_ext/float/rounding.rb +24 -0
- data/vendor/activesupport/lib/active_support/core_ext/float/time.rb +27 -0
- data/vendor/activesupport/lib/active_support/core_ext/hash.rb +14 -0
- data/vendor/activesupport/lib/active_support/core_ext/hash/conversions.rb +259 -0
- data/vendor/activesupport/lib/active_support/core_ext/hash/deep_merge.rb +23 -0
- data/vendor/activesupport/lib/active_support/core_ext/hash/diff.rb +19 -0
- data/vendor/activesupport/lib/active_support/core_ext/hash/except.rb +25 -0
- data/vendor/activesupport/lib/active_support/core_ext/hash/indifferent_access.rb +137 -0
- data/vendor/activesupport/lib/active_support/core_ext/hash/keys.rb +52 -0
- data/vendor/activesupport/lib/active_support/core_ext/hash/reverse_merge.rb +35 -0
- data/vendor/activesupport/lib/active_support/core_ext/hash/slice.rb +33 -0
- data/vendor/activesupport/lib/active_support/core_ext/integer.rb +9 -0
- data/vendor/activesupport/lib/active_support/core_ext/integer/even_odd.rb +29 -0
- data/vendor/activesupport/lib/active_support/core_ext/integer/inflections.rb +20 -0
- data/vendor/activesupport/lib/active_support/core_ext/integer/time.rb +45 -0
- data/vendor/activesupport/lib/active_support/core_ext/kernel.rb +5 -0
- data/vendor/activesupport/lib/active_support/core_ext/kernel/agnostics.rb +11 -0
- data/vendor/activesupport/lib/active_support/core_ext/kernel/daemonizing.rb +7 -0
- data/vendor/activesupport/lib/active_support/core_ext/kernel/debugger.rb +13 -0
- data/vendor/activesupport/lib/active_support/core_ext/kernel/reporting.rb +59 -0
- data/vendor/activesupport/lib/active_support/core_ext/kernel/requires.rb +24 -0
- data/vendor/activesupport/lib/active_support/core_ext/load_error.rb +38 -0
- data/vendor/activesupport/lib/active_support/core_ext/logger.rb +143 -0
- data/vendor/activesupport/lib/active_support/core_ext/module.rb +23 -0
- data/vendor/activesupport/lib/active_support/core_ext/module/aliasing.rb +74 -0
- data/vendor/activesupport/lib/active_support/core_ext/module/attr_accessor_with_default.rb +31 -0
- data/vendor/activesupport/lib/active_support/core_ext/module/attr_internal.rb +32 -0
- data/vendor/activesupport/lib/active_support/core_ext/module/attribute_accessors.rb +58 -0
- data/vendor/activesupport/lib/active_support/core_ext/module/delegation.rb +95 -0
- data/vendor/activesupport/lib/active_support/core_ext/module/inclusion.rb +30 -0
- data/vendor/activesupport/lib/active_support/core_ext/module/introspection.rb +90 -0
- data/vendor/activesupport/lib/active_support/core_ext/module/loading.rb +23 -0
- data/vendor/activesupport/lib/active_support/core_ext/module/model_naming.rb +23 -0
- data/vendor/activesupport/lib/active_support/core_ext/module/synchronization.rb +39 -0
- data/vendor/activesupport/lib/active_support/core_ext/name_error.rb +17 -0
- data/vendor/activesupport/lib/active_support/core_ext/numeric.rb +9 -0
- data/vendor/activesupport/lib/active_support/core_ext/numeric/bytes.rb +44 -0
- data/vendor/activesupport/lib/active_support/core_ext/numeric/conversions.rb +19 -0
- data/vendor/activesupport/lib/active_support/core_ext/numeric/time.rb +81 -0
- data/vendor/activesupport/lib/active_support/core_ext/object.rb +5 -0
- data/vendor/activesupport/lib/active_support/core_ext/object/conversions.rb +14 -0
- data/vendor/activesupport/lib/active_support/core_ext/object/extending.rb +80 -0
- data/vendor/activesupport/lib/active_support/core_ext/object/instance_variables.rb +74 -0
- data/vendor/activesupport/lib/active_support/core_ext/object/metaclass.rb +13 -0
- data/vendor/activesupport/lib/active_support/core_ext/object/misc.rb +74 -0
- data/vendor/activesupport/lib/active_support/core_ext/pathname.rb +7 -0
- data/vendor/activesupport/lib/active_support/core_ext/pathname/clean_within.rb +14 -0
- data/vendor/activesupport/lib/active_support/core_ext/proc.rb +12 -0
- data/vendor/activesupport/lib/active_support/core_ext/process.rb +1 -0
- data/vendor/activesupport/lib/active_support/core_ext/process/daemon.rb +25 -0
- data/vendor/activesupport/lib/active_support/core_ext/range.rb +11 -0
- data/vendor/activesupport/lib/active_support/core_ext/range/blockless_step.rb +32 -0
- data/vendor/activesupport/lib/active_support/core_ext/range/conversions.rb +27 -0
- data/vendor/activesupport/lib/active_support/core_ext/range/include_range.rb +30 -0
- data/vendor/activesupport/lib/active_support/core_ext/range/overlaps.rb +15 -0
- data/vendor/activesupport/lib/active_support/core_ext/rexml.rb +36 -0
- data/vendor/activesupport/lib/active_support/core_ext/string.rb +22 -0
- data/vendor/activesupport/lib/active_support/core_ext/string/access.rb +82 -0
- data/vendor/activesupport/lib/active_support/core_ext/string/behavior.rb +13 -0
- data/vendor/activesupport/lib/active_support/core_ext/string/conversions.rb +28 -0
- data/vendor/activesupport/lib/active_support/core_ext/string/filters.rb +26 -0
- data/vendor/activesupport/lib/active_support/core_ext/string/inflections.rb +167 -0
- data/vendor/activesupport/lib/active_support/core_ext/string/iterators.rb +21 -0
- data/vendor/activesupport/lib/active_support/core_ext/string/multibyte.rb +81 -0
- data/vendor/activesupport/lib/active_support/core_ext/string/starts_ends_with.rb +35 -0
- data/vendor/activesupport/lib/active_support/core_ext/string/xchar.rb +11 -0
- data/vendor/activesupport/lib/active_support/core_ext/symbol.rb +14 -0
- data/vendor/activesupport/lib/active_support/core_ext/time.rb +42 -0
- data/vendor/activesupport/lib/active_support/core_ext/time/behavior.rb +13 -0
- data/vendor/activesupport/lib/active_support/core_ext/time/calculations.rb +303 -0
- data/vendor/activesupport/lib/active_support/core_ext/time/conversions.rb +90 -0
- data/vendor/activesupport/lib/active_support/core_ext/time/zones.rb +86 -0
- data/vendor/activesupport/lib/active_support/dependencies.rb +621 -0
- data/vendor/activesupport/lib/active_support/deprecation.rb +243 -0
- data/vendor/activesupport/lib/active_support/duration.rb +96 -0
- data/vendor/activesupport/lib/active_support/gzip.rb +25 -0
- data/vendor/activesupport/lib/active_support/inflections.rb +55 -0
- data/vendor/activesupport/lib/active_support/inflector.rb +397 -0
- data/vendor/activesupport/lib/active_support/json.rb +23 -0
- data/vendor/activesupport/lib/active_support/json/decoding.rb +63 -0
- data/vendor/activesupport/lib/active_support/json/encoders/date.rb +21 -0
- data/vendor/activesupport/lib/active_support/json/encoders/date_time.rb +21 -0
- data/vendor/activesupport/lib/active_support/json/encoders/enumerable.rb +12 -0
- data/vendor/activesupport/lib/active_support/json/encoders/false_class.rb +5 -0
- data/vendor/activesupport/lib/active_support/json/encoders/hash.rb +47 -0
- data/vendor/activesupport/lib/active_support/json/encoders/nil_class.rb +5 -0
- data/vendor/activesupport/lib/active_support/json/encoders/numeric.rb +5 -0
- data/vendor/activesupport/lib/active_support/json/encoders/object.rb +6 -0
- data/vendor/activesupport/lib/active_support/json/encoders/regexp.rb +5 -0
- data/vendor/activesupport/lib/active_support/json/encoders/string.rb +36 -0
- data/vendor/activesupport/lib/active_support/json/encoders/symbol.rb +5 -0
- data/vendor/activesupport/lib/active_support/json/encoders/time.rb +21 -0
- data/vendor/activesupport/lib/active_support/json/encoders/true_class.rb +5 -0
- data/vendor/activesupport/lib/active_support/json/encoding.rb +37 -0
- data/vendor/activesupport/lib/active_support/json/variable.rb +10 -0
- data/vendor/activesupport/lib/active_support/locale/en.yml +32 -0
- data/vendor/activesupport/lib/active_support/memoizable.rb +82 -0
- data/vendor/activesupport/lib/active_support/multibyte.rb +33 -0
- data/vendor/activesupport/lib/active_support/multibyte/chars.rb +679 -0
- data/vendor/activesupport/lib/active_support/multibyte/exceptions.rb +8 -0
- data/vendor/activesupport/lib/active_support/multibyte/unicode_database.rb +71 -0
- data/vendor/activesupport/lib/active_support/option_merger.rb +17 -0
- data/vendor/activesupport/lib/active_support/ordered_hash.rb +58 -0
- data/vendor/activesupport/lib/active_support/ordered_options.rb +19 -0
- data/vendor/activesupport/lib/active_support/rescuable.rb +108 -0
- data/vendor/activesupport/lib/active_support/secure_random.rb +197 -0
- data/vendor/activesupport/lib/active_support/string_inquirer.rb +21 -0
- data/vendor/activesupport/lib/active_support/test_case.rb +24 -0
- data/vendor/activesupport/lib/active_support/testing/core_ext/test.rb +6 -0
- data/vendor/activesupport/lib/active_support/testing/core_ext/test/unit/assertions.rb +72 -0
- data/vendor/activesupport/lib/active_support/testing/default.rb +9 -0
- data/vendor/activesupport/lib/active_support/testing/performance.rb +452 -0
- data/vendor/activesupport/lib/active_support/testing/setup_and_teardown.rb +120 -0
- data/vendor/activesupport/lib/active_support/time_with_zone.rb +328 -0
- data/vendor/activesupport/lib/active_support/values/time_zone.rb +403 -0
- data/vendor/activesupport/lib/active_support/values/unicode_tables.dat +0 -0
- data/vendor/activesupport/lib/active_support/vendor.rb +34 -0
- data/vendor/activesupport/lib/active_support/vendor/builder-2.1.2/blankslate.rb +113 -0
- data/vendor/activesupport/lib/active_support/vendor/builder-2.1.2/builder.rb +13 -0
- data/vendor/activesupport/lib/active_support/vendor/builder-2.1.2/builder/blankslate.rb +20 -0
- data/vendor/activesupport/lib/active_support/vendor/builder-2.1.2/builder/css.rb +250 -0
- data/vendor/activesupport/lib/active_support/vendor/builder-2.1.2/builder/xchar.rb +115 -0
- data/vendor/activesupport/lib/active_support/vendor/builder-2.1.2/builder/xmlbase.rb +139 -0
- data/vendor/activesupport/lib/active_support/vendor/builder-2.1.2/builder/xmlevents.rb +63 -0
- data/vendor/activesupport/lib/active_support/vendor/builder-2.1.2/builder/xmlmarkup.rb +328 -0
- data/vendor/activesupport/lib/active_support/vendor/i18n-0.0.1/i18n.rb +194 -0
- data/vendor/activesupport/lib/active_support/vendor/i18n-0.0.1/i18n/backend/simple.rb +216 -0
- data/vendor/activesupport/lib/active_support/vendor/i18n-0.0.1/i18n/exceptions.rb +53 -0
- data/vendor/activesupport/lib/active_support/vendor/memcache-client-1.5.1/memcache.rb +849 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo.rb +33 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/data_timezone.rb +47 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/data_timezone_info.rb +228 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Africa/Algiers.rb +55 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Africa/Cairo.rb +219 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Africa/Casablanca.rb +40 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Africa/Harare.rb +18 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Africa/Johannesburg.rb +25 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Africa/Monrovia.rb +22 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Africa/Nairobi.rb +23 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Argentina/Buenos_Aires.rb +166 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Argentina/San_Juan.rb +86 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Bogota.rb +23 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Caracas.rb +23 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Chicago.rb +283 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Chihuahua.rb +136 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Denver.rb +204 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Godthab.rb +161 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Guatemala.rb +27 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Halifax.rb +274 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Indiana/Indianapolis.rb +149 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Juneau.rb +194 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/La_Paz.rb +22 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Lima.rb +35 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Los_Angeles.rb +232 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Mazatlan.rb +139 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Mexico_City.rb +144 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Monterrey.rb +131 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/New_York.rb +282 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Phoenix.rb +30 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Regina.rb +74 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Santiago.rb +205 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Sao_Paulo.rb +171 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/St_Johns.rb +288 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Tijuana.rb +196 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Almaty.rb +67 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Baghdad.rb +73 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Baku.rb +161 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Bangkok.rb +20 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Chongqing.rb +33 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Colombo.rb +30 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Dhaka.rb +27 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Hong_Kong.rb +87 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Irkutsk.rb +165 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Jakarta.rb +30 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Jerusalem.rb +163 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Kabul.rb +20 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Kamchatka.rb +163 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Karachi.rb +30 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Katmandu.rb +20 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Kolkata.rb +25 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Krasnoyarsk.rb +163 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Kuala_Lumpur.rb +31 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Kuwait.rb +18 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Magadan.rb +163 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Muscat.rb +18 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Novosibirsk.rb +164 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Rangoon.rb +24 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Riyadh.rb +18 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Seoul.rb +34 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Shanghai.rb +35 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Singapore.rb +33 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Taipei.rb +59 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Tashkent.rb +47 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Tbilisi.rb +78 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Tehran.rb +121 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Tokyo.rb +30 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Ulaanbaatar.rb +65 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Urumqi.rb +33 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Vladivostok.rb +164 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Yakutsk.rb +163 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Yekaterinburg.rb +165 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Yerevan.rb +165 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Atlantic/Azores.rb +270 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Atlantic/Cape_Verde.rb +23 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Atlantic/South_Georgia.rb +18 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Australia/Adelaide.rb +187 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Australia/Brisbane.rb +35 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Australia/Darwin.rb +29 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Australia/Hobart.rb +193 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Australia/Melbourne.rb +185 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Australia/Perth.rb +37 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Australia/Sydney.rb +185 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Etc/UTC.rb +16 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Amsterdam.rb +228 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Athens.rb +185 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Belgrade.rb +163 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Berlin.rb +188 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Bratislava.rb +13 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Brussels.rb +232 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Bucharest.rb +181 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Budapest.rb +197 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Copenhagen.rb +179 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Dublin.rb +276 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Helsinki.rb +163 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Istanbul.rb +218 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Kiev.rb +168 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Lisbon.rb +268 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Ljubljana.rb +13 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/London.rb +288 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Madrid.rb +211 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Minsk.rb +170 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Moscow.rb +181 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Paris.rb +232 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Prague.rb +187 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Riga.rb +176 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Rome.rb +215 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Sarajevo.rb +13 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Skopje.rb +13 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Sofia.rb +173 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Stockholm.rb +165 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Tallinn.rb +172 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Vienna.rb +183 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Vilnius.rb +170 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Warsaw.rb +212 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Zagreb.rb +13 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Pacific/Auckland.rb +202 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Pacific/Fiji.rb +23 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Pacific/Guam.rb +22 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Pacific/Honolulu.rb +28 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Pacific/Majuro.rb +20 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Pacific/Midway.rb +25 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Pacific/Noumea.rb +25 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Pacific/Pago_Pago.rb +26 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Pacific/Port_Moresby.rb +20 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Pacific/Tongatapu.rb +27 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/info_timezone.rb +52 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/linked_timezone.rb +51 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/linked_timezone_info.rb +44 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/offset_rationals.rb +98 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/ruby_core_support.rb +56 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/time_or_datetime.rb +292 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/timezone.rb +508 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/timezone_definition.rb +56 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/timezone_info.rb +40 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/timezone_offset_info.rb +94 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/timezone_period.rb +198 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/timezone_transition_info.rb +129 -0
- data/vendor/activesupport/lib/active_support/vendor/xml-simple-1.0.11/xmlsimple.rb +1021 -0
- data/vendor/activesupport/lib/active_support/version.rb +9 -0
- data/vendor/activesupport/lib/active_support/whiny_nil.rb +58 -0
- data/vendor/activesupport/lib/activesupport.rb +1 -0
- data/vendor/isaac/LICENSE +26 -0
- data/vendor/isaac/README +78 -0
- data/vendor/isaac/TODO +3 -0
- data/vendor/isaac/VERSIONS +3 -0
- data/vendor/isaac/crypt/ISAAC.rb +171 -0
- data/vendor/isaac/isaac.gemspec +39 -0
- data/vendor/isaac/setup.rb +596 -0
- data/vendor/isaac/test/TC_ISAAC.rb +76 -0
- data/vendor/json/CHANGES +93 -0
- data/vendor/json/GPL +340 -0
- data/vendor/json/README +78 -0
- data/vendor/json/RUBY +58 -0
- data/vendor/json/Rakefile +309 -0
- data/vendor/json/TODO +1 -0
- data/vendor/json/VERSION +1 -0
- data/vendor/json/benchmarks/benchmark.txt +133 -0
- data/vendor/json/benchmarks/benchmark_generator.rb +48 -0
- data/vendor/json/benchmarks/benchmark_parser.rb +26 -0
- data/vendor/json/benchmarks/benchmark_rails.rb +26 -0
- data/vendor/json/bin/edit_json.rb +10 -0
- data/vendor/json/bin/prettify_json.rb +76 -0
- data/vendor/json/data/example.json +1 -0
- data/vendor/json/data/index.html +38 -0
- data/vendor/json/data/prototype.js +4184 -0
- data/vendor/json/ext/json/ext/generator/extconf.rb +9 -0
- data/vendor/json/ext/json/ext/generator/generator.c +875 -0
- data/vendor/json/ext/json/ext/generator/unicode.c +182 -0
- data/vendor/json/ext/json/ext/generator/unicode.h +53 -0
- data/vendor/json/ext/json/ext/parser/extconf.rb +9 -0
- data/vendor/json/ext/json/ext/parser/parser.c +1758 -0
- data/vendor/json/ext/json/ext/parser/parser.rl +638 -0
- data/vendor/json/ext/json/ext/parser/unicode.c +154 -0
- data/vendor/json/ext/json/ext/parser/unicode.h +58 -0
- data/vendor/json/install.rb +26 -0
- data/vendor/json/lib/json.rb +235 -0
- data/vendor/json/lib/json/Array.xpm +21 -0
- data/vendor/json/lib/json/FalseClass.xpm +21 -0
- data/vendor/json/lib/json/Hash.xpm +21 -0
- data/vendor/json/lib/json/Key.xpm +73 -0
- data/vendor/json/lib/json/NilClass.xpm +21 -0
- data/vendor/json/lib/json/Numeric.xpm +28 -0
- data/vendor/json/lib/json/String.xpm +96 -0
- data/vendor/json/lib/json/TrueClass.xpm +21 -0
- data/vendor/json/lib/json/add/core.rb +135 -0
- data/vendor/json/lib/json/add/rails.rb +58 -0
- data/vendor/json/lib/json/common.rb +354 -0
- data/vendor/json/lib/json/editor.rb +1362 -0
- data/vendor/json/lib/json/ext.rb +13 -0
- data/vendor/json/lib/json/json.xpm +1499 -0
- data/vendor/json/lib/json/pure.rb +75 -0
- data/vendor/json/lib/json/pure/generator.rb +394 -0
- data/vendor/json/lib/json/pure/parser.rb +259 -0
- data/vendor/json/lib/json/version.rb +9 -0
- data/vendor/json/tests/fixtures/fail1.json +1 -0
- data/vendor/json/tests/fixtures/fail10.json +1 -0
- data/vendor/json/tests/fixtures/fail11.json +1 -0
- data/vendor/json/tests/fixtures/fail12.json +1 -0
- data/vendor/json/tests/fixtures/fail13.json +1 -0
- data/vendor/json/tests/fixtures/fail14.json +1 -0
- data/vendor/json/tests/fixtures/fail18.json +1 -0
- data/vendor/json/tests/fixtures/fail19.json +1 -0
- data/vendor/json/tests/fixtures/fail2.json +1 -0
- data/vendor/json/tests/fixtures/fail20.json +1 -0
- data/vendor/json/tests/fixtures/fail21.json +1 -0
- data/vendor/json/tests/fixtures/fail22.json +1 -0
- data/vendor/json/tests/fixtures/fail23.json +1 -0
- data/vendor/json/tests/fixtures/fail24.json +1 -0
- data/vendor/json/tests/fixtures/fail25.json +1 -0
- data/vendor/json/tests/fixtures/fail27.json +2 -0
- data/vendor/json/tests/fixtures/fail28.json +2 -0
- data/vendor/json/tests/fixtures/fail3.json +1 -0
- data/vendor/json/tests/fixtures/fail4.json +1 -0
- data/vendor/json/tests/fixtures/fail5.json +1 -0
- data/vendor/json/tests/fixtures/fail6.json +1 -0
- data/vendor/json/tests/fixtures/fail7.json +1 -0
- data/vendor/json/tests/fixtures/fail8.json +1 -0
- data/vendor/json/tests/fixtures/fail9.json +1 -0
- data/vendor/json/tests/fixtures/pass1.json +56 -0
- data/vendor/json/tests/fixtures/pass15.json +1 -0
- data/vendor/json/tests/fixtures/pass16.json +1 -0
- data/vendor/json/tests/fixtures/pass17.json +1 -0
- data/vendor/json/tests/fixtures/pass2.json +1 -0
- data/vendor/json/tests/fixtures/pass26.json +1 -0
- data/vendor/json/tests/fixtures/pass3.json +6 -0
- data/vendor/json/tests/runner.rb +25 -0
- data/vendor/json/tests/test_json.rb +293 -0
- data/vendor/json/tests/test_json_addition.rb +161 -0
- data/vendor/json/tests/test_json_fixtures.rb +30 -0
- data/vendor/json/tests/test_json_generate.rb +100 -0
- data/vendor/json/tests/test_json_rails.rb +118 -0
- data/vendor/json/tests/test_json_unicode.rb +61 -0
- data/vendor/json/tools/fuzz.rb +140 -0
- data/vendor/json/tools/server.rb +62 -0
- metadata +841 -0
Binary file
|
@@ -0,0 +1,30 @@
|
|
1
|
+
require 'rbconfig'
|
2
|
+
require 'find'
|
3
|
+
require 'ftools'
|
4
|
+
|
5
|
+
include Config
|
6
|
+
|
7
|
+
# this was adapted from rdoc's install.rb by ways of Log4r
|
8
|
+
|
9
|
+
$sitedir = CONFIG["sitelibdir"]
|
10
|
+
unless $sitedir
|
11
|
+
version = CONFIG["MAJOR"] + "." + CONFIG["MINOR"]
|
12
|
+
$libdir = File.join(CONFIG["libdir"], "ruby", version)
|
13
|
+
$sitedir = $:.find {|x| x =~ /site_ruby/ }
|
14
|
+
if !$sitedir
|
15
|
+
$sitedir = File.join($libdir, "site_ruby")
|
16
|
+
elsif $sitedir !~ Regexp.quote(version)
|
17
|
+
$sitedir = File.join($sitedir, version)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
# the actual gruntwork
|
22
|
+
Dir.chdir("lib")
|
23
|
+
|
24
|
+
Find.find("active_record", "active_record.rb") { |f|
|
25
|
+
if f[-3..-1] == ".rb"
|
26
|
+
File::install(f, File.join($sitedir, *f.split(/\//)), 0644, true)
|
27
|
+
else
|
28
|
+
File::makedirs(File.join($sitedir, *f.split(/\//)))
|
29
|
+
end
|
30
|
+
}
|
@@ -0,0 +1,81 @@
|
|
1
|
+
#--
|
2
|
+
# Copyright (c) 2004-2008 David Heinemeier Hansson
|
3
|
+
#
|
4
|
+
# Permission is hereby granted, free of charge, to any person obtaining
|
5
|
+
# a copy of this software and associated documentation files (the
|
6
|
+
# "Software"), to deal in the Software without restriction, including
|
7
|
+
# without limitation the rights to use, copy, modify, merge, publish,
|
8
|
+
# distribute, sublicense, and/or sell copies of the Software, and to
|
9
|
+
# permit persons to whom the Software is furnished to do so, subject to
|
10
|
+
# the following conditions:
|
11
|
+
#
|
12
|
+
# The above copyright notice and this permission notice shall be
|
13
|
+
# included in all copies or substantial portions of the Software.
|
14
|
+
#
|
15
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
16
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
17
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
18
|
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
19
|
+
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
20
|
+
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
21
|
+
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
22
|
+
#++
|
23
|
+
|
24
|
+
begin
|
25
|
+
require 'active_support'
|
26
|
+
rescue LoadError
|
27
|
+
activesupport_path = "#{File.dirname(__FILE__)}/../../activesupport/lib"
|
28
|
+
if File.directory?(activesupport_path)
|
29
|
+
$:.unshift activesupport_path
|
30
|
+
require 'active_support'
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
require 'active_record/base'
|
35
|
+
require 'active_record/named_scope'
|
36
|
+
require 'active_record/observer'
|
37
|
+
require 'active_record/query_cache'
|
38
|
+
require 'active_record/validations'
|
39
|
+
require 'active_record/callbacks'
|
40
|
+
require 'active_record/reflection'
|
41
|
+
require 'active_record/associations'
|
42
|
+
require 'active_record/association_preload'
|
43
|
+
require 'active_record/aggregations'
|
44
|
+
require 'active_record/transactions'
|
45
|
+
require 'active_record/timestamp'
|
46
|
+
require 'active_record/locking/optimistic'
|
47
|
+
require 'active_record/locking/pessimistic'
|
48
|
+
require 'active_record/migration'
|
49
|
+
require 'active_record/schema'
|
50
|
+
require 'active_record/calculations'
|
51
|
+
require 'active_record/serialization'
|
52
|
+
require 'active_record/attribute_methods'
|
53
|
+
require 'active_record/dirty'
|
54
|
+
require 'active_record/dynamic_finder_match'
|
55
|
+
|
56
|
+
ActiveRecord::Base.class_eval do
|
57
|
+
extend ActiveRecord::QueryCache
|
58
|
+
include ActiveRecord::Validations
|
59
|
+
include ActiveRecord::Locking::Optimistic
|
60
|
+
include ActiveRecord::Locking::Pessimistic
|
61
|
+
include ActiveRecord::AttributeMethods
|
62
|
+
include ActiveRecord::Dirty
|
63
|
+
include ActiveRecord::Callbacks
|
64
|
+
include ActiveRecord::Observing
|
65
|
+
include ActiveRecord::Timestamp
|
66
|
+
include ActiveRecord::Associations
|
67
|
+
include ActiveRecord::NamedScope
|
68
|
+
include ActiveRecord::AssociationPreload
|
69
|
+
include ActiveRecord::Aggregations
|
70
|
+
include ActiveRecord::Transactions
|
71
|
+
include ActiveRecord::Reflection
|
72
|
+
include ActiveRecord::Calculations
|
73
|
+
include ActiveRecord::Serialization
|
74
|
+
end
|
75
|
+
|
76
|
+
require 'active_record/connection_adapters/abstract_adapter'
|
77
|
+
|
78
|
+
require 'active_record/schema_dumper'
|
79
|
+
|
80
|
+
require 'active_record/i18n_interpolation_deprecation'
|
81
|
+
I18n.load_path << File.dirname(__FILE__) + '/active_record/locale/en.yml'
|
@@ -0,0 +1,261 @@
|
|
1
|
+
module ActiveRecord
|
2
|
+
module Aggregations # :nodoc:
|
3
|
+
def self.included(base)
|
4
|
+
base.extend(ClassMethods)
|
5
|
+
end
|
6
|
+
|
7
|
+
def clear_aggregation_cache #:nodoc:
|
8
|
+
self.class.reflect_on_all_aggregations.to_a.each do |assoc|
|
9
|
+
instance_variable_set "@#{assoc.name}", nil
|
10
|
+
end unless self.new_record?
|
11
|
+
end
|
12
|
+
|
13
|
+
# Active Record implements aggregation through a macro-like class method called +composed_of+ for representing attributes
|
14
|
+
# as value objects. It expresses relationships like "Account [is] composed of Money [among other things]" or "Person [is]
|
15
|
+
# composed of [an] address". Each call to the macro adds a description of how the value objects are created from the
|
16
|
+
# attributes of the entity object (when the entity is initialized either as a new object or from finding an existing object)
|
17
|
+
# and how it can be turned back into attributes (when the entity is saved to the database). Example:
|
18
|
+
#
|
19
|
+
# class Customer < ActiveRecord::Base
|
20
|
+
# composed_of :balance, :class_name => "Money", :mapping => %w(balance amount)
|
21
|
+
# composed_of :address, :mapping => [ %w(address_street street), %w(address_city city) ]
|
22
|
+
# end
|
23
|
+
#
|
24
|
+
# The customer class now has the following methods to manipulate the value objects:
|
25
|
+
# * <tt>Customer#balance, Customer#balance=(money)</tt>
|
26
|
+
# * <tt>Customer#address, Customer#address=(address)</tt>
|
27
|
+
#
|
28
|
+
# These methods will operate with value objects like the ones described below:
|
29
|
+
#
|
30
|
+
# class Money
|
31
|
+
# include Comparable
|
32
|
+
# attr_reader :amount, :currency
|
33
|
+
# EXCHANGE_RATES = { "USD_TO_DKK" => 6 }
|
34
|
+
#
|
35
|
+
# def initialize(amount, currency = "USD")
|
36
|
+
# @amount, @currency = amount, currency
|
37
|
+
# end
|
38
|
+
#
|
39
|
+
# def exchange_to(other_currency)
|
40
|
+
# exchanged_amount = (amount * EXCHANGE_RATES["#{currency}_TO_#{other_currency}"]).floor
|
41
|
+
# Money.new(exchanged_amount, other_currency)
|
42
|
+
# end
|
43
|
+
#
|
44
|
+
# def ==(other_money)
|
45
|
+
# amount == other_money.amount && currency == other_money.currency
|
46
|
+
# end
|
47
|
+
#
|
48
|
+
# def <=>(other_money)
|
49
|
+
# if currency == other_money.currency
|
50
|
+
# amount <=> amount
|
51
|
+
# else
|
52
|
+
# amount <=> other_money.exchange_to(currency).amount
|
53
|
+
# end
|
54
|
+
# end
|
55
|
+
# end
|
56
|
+
#
|
57
|
+
# class Address
|
58
|
+
# attr_reader :street, :city
|
59
|
+
# def initialize(street, city)
|
60
|
+
# @street, @city = street, city
|
61
|
+
# end
|
62
|
+
#
|
63
|
+
# def close_to?(other_address)
|
64
|
+
# city == other_address.city
|
65
|
+
# end
|
66
|
+
#
|
67
|
+
# def ==(other_address)
|
68
|
+
# city == other_address.city && street == other_address.street
|
69
|
+
# end
|
70
|
+
# end
|
71
|
+
#
|
72
|
+
# Now it's possible to access attributes from the database through the value objects instead. If you choose to name the
|
73
|
+
# composition the same as the attribute's name, it will be the only way to access that attribute. That's the case with our
|
74
|
+
# +balance+ attribute. You interact with the value objects just like you would any other attribute, though:
|
75
|
+
#
|
76
|
+
# customer.balance = Money.new(20) # sets the Money value object and the attribute
|
77
|
+
# customer.balance # => Money value object
|
78
|
+
# customer.balance.exchange_to("DKK") # => Money.new(120, "DKK")
|
79
|
+
# customer.balance > Money.new(10) # => true
|
80
|
+
# customer.balance == Money.new(20) # => true
|
81
|
+
# customer.balance < Money.new(5) # => false
|
82
|
+
#
|
83
|
+
# Value objects can also be composed of multiple attributes, such as the case of Address. The order of the mappings will
|
84
|
+
# determine the order of the parameters. Example:
|
85
|
+
#
|
86
|
+
# customer.address_street = "Hyancintvej"
|
87
|
+
# customer.address_city = "Copenhagen"
|
88
|
+
# customer.address # => Address.new("Hyancintvej", "Copenhagen")
|
89
|
+
# customer.address = Address.new("May Street", "Chicago")
|
90
|
+
# customer.address_street # => "May Street"
|
91
|
+
# customer.address_city # => "Chicago"
|
92
|
+
#
|
93
|
+
# == Writing value objects
|
94
|
+
#
|
95
|
+
# Value objects are immutable and interchangeable objects that represent a given value, such as a Money object representing
|
96
|
+
# $5. Two Money objects both representing $5 should be equal (through methods such as <tt>==</tt> and <tt><=></tt> from Comparable if ranking
|
97
|
+
# makes sense). This is unlike entity objects where equality is determined by identity. An entity class such as Customer can
|
98
|
+
# easily have two different objects that both have an address on Hyancintvej. Entity identity is determined by object or
|
99
|
+
# relational unique identifiers (such as primary keys). Normal ActiveRecord::Base classes are entity objects.
|
100
|
+
#
|
101
|
+
# It's also important to treat the value objects as immutable. Don't allow the Money object to have its amount changed after
|
102
|
+
# creation. Create a new Money object with the new value instead. This is exemplified by the Money#exchange_to method that
|
103
|
+
# returns a new value object instead of changing its own values. Active Record won't persist value objects that have been
|
104
|
+
# changed through means other than the writer method.
|
105
|
+
#
|
106
|
+
# The immutable requirement is enforced by Active Record by freezing any object assigned as a value object. Attempting to
|
107
|
+
# change it afterwards will result in a ActiveSupport::FrozenObjectError.
|
108
|
+
#
|
109
|
+
# Read more about value objects on http://c2.com/cgi/wiki?ValueObject and on the dangers of not keeping value objects
|
110
|
+
# immutable on http://c2.com/cgi/wiki?ValueObjectsShouldBeImmutable
|
111
|
+
#
|
112
|
+
# == Custom constructors and converters
|
113
|
+
#
|
114
|
+
# By default value objects are initialized by calling the <tt>new</tt> constructor of the value class passing each of the
|
115
|
+
# mapped attributes, in the order specified by the <tt>:mapping</tt> option, as arguments. If the value class doesn't support
|
116
|
+
# this convention then +composed_of+ allows a custom constructor to be specified.
|
117
|
+
#
|
118
|
+
# When a new value is assigned to the value object the default assumption is that the new value is an instance of the value
|
119
|
+
# class. Specifying a custom converter allows the new value to be automatically converted to an instance of value class if
|
120
|
+
# necessary.
|
121
|
+
#
|
122
|
+
# For example, the NetworkResource model has +network_address+ and +cidr_range+ attributes that should be aggregated using the
|
123
|
+
# NetAddr::CIDR value class (http://netaddr.rubyforge.org). The constructor for the value class is called +create+ and it
|
124
|
+
# expects a CIDR address string as a parameter. New values can be assigned to the value object using either another
|
125
|
+
# NetAddr::CIDR object, a string or an array. The <tt>:constructor</tt> and <tt>:converter</tt> options can be used to
|
126
|
+
# meet these requirements:
|
127
|
+
#
|
128
|
+
# class NetworkResource < ActiveRecord::Base
|
129
|
+
# composed_of :cidr,
|
130
|
+
# :class_name => 'NetAddr::CIDR',
|
131
|
+
# :mapping => [ %w(network_address network), %w(cidr_range bits) ],
|
132
|
+
# :allow_nil => true,
|
133
|
+
# :constructor => Proc.new { |network_address, cidr_range| NetAddr::CIDR.create("#{network_address}/#{cidr_range}") },
|
134
|
+
# :converter => Proc.new { |value| NetAddr::CIDR.create(value.is_a?(Array) ? value.join('/') : value) }
|
135
|
+
# end
|
136
|
+
#
|
137
|
+
# # This calls the :constructor
|
138
|
+
# network_resource = NetworkResource.new(:network_address => '192.168.0.1', :cidr_range => 24)
|
139
|
+
#
|
140
|
+
# # These assignments will both use the :converter
|
141
|
+
# network_resource.cidr = [ '192.168.2.1', 8 ]
|
142
|
+
# network_resource.cidr = '192.168.0.1/24'
|
143
|
+
#
|
144
|
+
# # This assignment won't use the :converter as the value is already an instance of the value class
|
145
|
+
# network_resource.cidr = NetAddr::CIDR.create('192.168.2.1/8')
|
146
|
+
#
|
147
|
+
# # Saving and then reloading will use the :constructor on reload
|
148
|
+
# network_resource.save
|
149
|
+
# network_resource.reload
|
150
|
+
#
|
151
|
+
# == Finding records by a value object
|
152
|
+
#
|
153
|
+
# Once a +composed_of+ relationship is specified for a model, records can be loaded from the database by specifying an instance
|
154
|
+
# of the value object in the conditions hash. The following example finds all customers with +balance_amount+ equal to 20 and
|
155
|
+
# +balance_currency+ equal to "USD":
|
156
|
+
#
|
157
|
+
# Customer.find(:all, :conditions => {:balance => Money.new(20, "USD")})
|
158
|
+
#
|
159
|
+
module ClassMethods
|
160
|
+
# Adds reader and writer methods for manipulating a value object:
|
161
|
+
# <tt>composed_of :address</tt> adds <tt>address</tt> and <tt>address=(new_address)</tt> methods.
|
162
|
+
#
|
163
|
+
# Options are:
|
164
|
+
# * <tt>:class_name</tt> - Specifies the class name of the association. Use it only if that name can't be inferred
|
165
|
+
# from the part id. So <tt>composed_of :address</tt> will by default be linked to the Address class, but
|
166
|
+
# if the real class name is CompanyAddress, you'll have to specify it with this option.
|
167
|
+
# * <tt>:mapping</tt> - Specifies the mapping of entity attributes to attributes of the value object. Each mapping
|
168
|
+
# is represented as an array where the first item is the name of the entity attribute and the second item is the
|
169
|
+
# name the attribute in the value object. The order in which mappings are defined determine the order in which
|
170
|
+
# attributes are sent to the value class constructor.
|
171
|
+
# * <tt>:allow_nil</tt> - Specifies that the value object will not be instantiated when all mapped
|
172
|
+
# attributes are +nil+. Setting the value object to +nil+ has the effect of writing +nil+ to all mapped attributes.
|
173
|
+
# This defaults to +false+.
|
174
|
+
# * <tt>:constructor</tt> - A symbol specifying the name of the constructor method or a Proc that is called to
|
175
|
+
# initialize the value object. The constructor is passed all of the mapped attributes, in the order that they
|
176
|
+
# are defined in the <tt>:mapping option</tt>, as arguments and uses them to instantiate a <tt>:class_name</tt> object.
|
177
|
+
# The default is <tt>:new</tt>.
|
178
|
+
# * <tt>:converter</tt> - A symbol specifying the name of a class method of <tt>:class_name</tt> or a Proc that is
|
179
|
+
# called when a new value is assigned to the value object. The converter is passed the single value that is used
|
180
|
+
# in the assignment and is only called if the new value is not an instance of <tt>:class_name</tt>.
|
181
|
+
#
|
182
|
+
# Option examples:
|
183
|
+
# composed_of :temperature, :mapping => %w(reading celsius)
|
184
|
+
# composed_of :balance, :class_name => "Money", :mapping => %w(balance amount), :converter => Proc.new { |balance| balance.to_money }
|
185
|
+
# composed_of :address, :mapping => [ %w(address_street street), %w(address_city city) ]
|
186
|
+
# composed_of :gps_location
|
187
|
+
# composed_of :gps_location, :allow_nil => true
|
188
|
+
# composed_of :ip_address,
|
189
|
+
# :class_name => 'IPAddr',
|
190
|
+
# :mapping => %w(ip to_i),
|
191
|
+
# :constructor => Proc.new { |ip| IPAddr.new(ip, Socket::AF_INET) },
|
192
|
+
# :converter => Proc.new { |ip| ip.is_a?(Integer) ? IPAddr.new(ip, Socket::AF_INET) : IPAddr.new(ip.to_s) }
|
193
|
+
#
|
194
|
+
def composed_of(part_id, options = {}, &block)
|
195
|
+
options.assert_valid_keys(:class_name, :mapping, :allow_nil, :constructor, :converter)
|
196
|
+
|
197
|
+
name = part_id.id2name
|
198
|
+
class_name = options[:class_name] || name.camelize
|
199
|
+
mapping = options[:mapping] || [ name, name ]
|
200
|
+
mapping = [ mapping ] unless mapping.first.is_a?(Array)
|
201
|
+
allow_nil = options[:allow_nil] || false
|
202
|
+
constructor = options[:constructor] || :new
|
203
|
+
converter = options[:converter] || block
|
204
|
+
|
205
|
+
ActiveSupport::Deprecation.warn('The conversion block has been deprecated, use the :converter option instead.', caller) if block_given?
|
206
|
+
|
207
|
+
reader_method(name, class_name, mapping, allow_nil, constructor)
|
208
|
+
writer_method(name, class_name, mapping, allow_nil, converter)
|
209
|
+
|
210
|
+
create_reflection(:composed_of, part_id, options, self)
|
211
|
+
end
|
212
|
+
|
213
|
+
private
|
214
|
+
def reader_method(name, class_name, mapping, allow_nil, constructor)
|
215
|
+
module_eval do
|
216
|
+
define_method(name) do |*args|
|
217
|
+
force_reload = args.first || false
|
218
|
+
if (instance_variable_get("@#{name}").nil? || force_reload) && (!allow_nil || mapping.any? {|pair| !read_attribute(pair.first).nil? })
|
219
|
+
attrs = mapping.collect {|pair| read_attribute(pair.first)}
|
220
|
+
object = case constructor
|
221
|
+
when Symbol
|
222
|
+
class_name.constantize.send(constructor, *attrs)
|
223
|
+
when Proc, Method
|
224
|
+
constructor.call(*attrs)
|
225
|
+
else
|
226
|
+
raise ArgumentError, 'Constructor must be a symbol denoting the constructor method to call or a Proc to be invoked.'
|
227
|
+
end
|
228
|
+
instance_variable_set("@#{name}", object)
|
229
|
+
end
|
230
|
+
instance_variable_get("@#{name}")
|
231
|
+
end
|
232
|
+
end
|
233
|
+
|
234
|
+
end
|
235
|
+
|
236
|
+
def writer_method(name, class_name, mapping, allow_nil, converter)
|
237
|
+
module_eval do
|
238
|
+
define_method("#{name}=") do |part|
|
239
|
+
if part.nil? && allow_nil
|
240
|
+
mapping.each { |pair| self[pair.first] = nil }
|
241
|
+
instance_variable_set("@#{name}", nil)
|
242
|
+
else
|
243
|
+
unless part.is_a?(class_name.constantize) || converter.nil?
|
244
|
+
part = case converter
|
245
|
+
when Symbol
|
246
|
+
class_name.constantize.send(converter, part)
|
247
|
+
when Proc, Method
|
248
|
+
converter.call(part)
|
249
|
+
else
|
250
|
+
raise ArgumentError, 'Converter must be a symbol denoting the converter method to call or a Proc to be invoked.'
|
251
|
+
end
|
252
|
+
end
|
253
|
+
mapping.each { |pair| self[pair.first] = part.send(pair.last) }
|
254
|
+
instance_variable_set("@#{name}", part.freeze)
|
255
|
+
end
|
256
|
+
end
|
257
|
+
end
|
258
|
+
end
|
259
|
+
end
|
260
|
+
end
|
261
|
+
end
|
@@ -0,0 +1,374 @@
|
|
1
|
+
module ActiveRecord
|
2
|
+
# See ActiveRecord::AssociationPreload::ClassMethods for documentation.
|
3
|
+
module AssociationPreload #:nodoc:
|
4
|
+
def self.included(base)
|
5
|
+
base.extend(ClassMethods)
|
6
|
+
end
|
7
|
+
|
8
|
+
# Implements the details of eager loading of ActiveRecord associations.
|
9
|
+
# Application developers should not use this module directly.
|
10
|
+
#
|
11
|
+
# ActiveRecord::Base is extended with this module. The source code in
|
12
|
+
# ActiveRecord::Base references methods defined in this module.
|
13
|
+
#
|
14
|
+
# Note that 'eager loading' and 'preloading' are actually the same thing.
|
15
|
+
# However, there are two different eager loading strategies.
|
16
|
+
#
|
17
|
+
# The first one is by using table joins. This was only strategy available
|
18
|
+
# prior to Rails 2.1. Suppose that you have an Author model with columns
|
19
|
+
# 'name' and 'age', and a Book model with columns 'name' and 'sales'. Using
|
20
|
+
# this strategy, ActiveRecord would try to retrieve all data for an author
|
21
|
+
# and all of its books via a single query:
|
22
|
+
#
|
23
|
+
# SELECT * FROM authors
|
24
|
+
# LEFT OUTER JOIN books ON authors.id = books.id
|
25
|
+
# WHERE authors.name = 'Ken Akamatsu'
|
26
|
+
#
|
27
|
+
# However, this could result in many rows that contain redundant data. After
|
28
|
+
# having received the first row, we already have enough data to instantiate
|
29
|
+
# the Author object. In all subsequent rows, only the data for the joined
|
30
|
+
# 'books' table is useful; the joined 'authors' data is just redundant, and
|
31
|
+
# processing this redundant data takes memory and CPU time. The problem
|
32
|
+
# quickly becomes worse and worse as the level of eager loading increases
|
33
|
+
# (i.e. if ActiveRecord is to eager load the associations' assocations as
|
34
|
+
# well).
|
35
|
+
#
|
36
|
+
# The second strategy is to use multiple database queries, one for each
|
37
|
+
# level of association. Since Rails 2.1, this is the default strategy. In
|
38
|
+
# situations where a table join is necessary (e.g. when the +:conditions+
|
39
|
+
# option references an association's column), it will fallback to the table
|
40
|
+
# join strategy.
|
41
|
+
#
|
42
|
+
# See also ActiveRecord::Associations::ClassMethods, which explains eager
|
43
|
+
# loading in a more high-level (application developer-friendly) manner.
|
44
|
+
module ClassMethods
|
45
|
+
protected
|
46
|
+
|
47
|
+
# Eager loads the named associations for the given ActiveRecord record(s).
|
48
|
+
#
|
49
|
+
# In this description, 'association name' shall refer to the name passed
|
50
|
+
# to an association creation method. For example, a model that specifies
|
51
|
+
# <tt>belongs_to :author</tt>, <tt>has_many :buyers</tt> has association
|
52
|
+
# names +:author+ and +:buyers+.
|
53
|
+
#
|
54
|
+
# == Parameters
|
55
|
+
# +records+ is an array of ActiveRecord::Base. This array needs not be flat,
|
56
|
+
# i.e. +records+ itself may also contain arrays of records. In any case,
|
57
|
+
# +preload_associations+ will preload the associations all records by
|
58
|
+
# flattening +records+.
|
59
|
+
#
|
60
|
+
# +associations+ specifies one or more associations that you want to
|
61
|
+
# preload. It may be:
|
62
|
+
# - a Symbol or a String which specifies a single association name. For
|
63
|
+
# example, specifiying +:books+ allows this method to preload all books
|
64
|
+
# for an Author.
|
65
|
+
# - an Array which specifies multiple association names. This array
|
66
|
+
# is processed recursively. For example, specifying <tt>[:avatar, :books]</tt>
|
67
|
+
# allows this method to preload an author's avatar as well as all of his
|
68
|
+
# books.
|
69
|
+
# - a Hash which specifies multiple association names, as well as
|
70
|
+
# association names for the to-be-preloaded association objects. For
|
71
|
+
# example, specifying <tt>{ :author => :avatar }</tt> will preload a
|
72
|
+
# book's author, as well as that author's avatar.
|
73
|
+
#
|
74
|
+
# +:associations+ has the same format as the +:include+ option for
|
75
|
+
# <tt>ActiveRecord::Base.find</tt>. So +associations+ could look like this:
|
76
|
+
#
|
77
|
+
# :books
|
78
|
+
# [ :books, :author ]
|
79
|
+
# { :author => :avatar }
|
80
|
+
# [ :books, { :author => :avatar } ]
|
81
|
+
#
|
82
|
+
# +preload_options+ contains options that will be passed to ActiveRecord#find
|
83
|
+
# (which is called under the hood for preloading records). But it is passed
|
84
|
+
# only one level deep in the +associations+ argument, i.e. it's not passed
|
85
|
+
# to the child associations when +associations+ is a Hash.
|
86
|
+
def preload_associations(records, associations, preload_options={})
|
87
|
+
records = [records].flatten.compact.uniq
|
88
|
+
return if records.empty?
|
89
|
+
case associations
|
90
|
+
when Array then associations.each {|association| preload_associations(records, association, preload_options)}
|
91
|
+
when Symbol, String then preload_one_association(records, associations.to_sym, preload_options)
|
92
|
+
when Hash then
|
93
|
+
associations.each do |parent, child|
|
94
|
+
raise "parent must be an association name" unless parent.is_a?(String) || parent.is_a?(Symbol)
|
95
|
+
preload_associations(records, parent, preload_options)
|
96
|
+
reflection = reflections[parent]
|
97
|
+
parents = records.map {|record| record.send(reflection.name)}.flatten
|
98
|
+
unless parents.empty? || parents.first.nil?
|
99
|
+
parents.first.class.preload_associations(parents, child)
|
100
|
+
end
|
101
|
+
end
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
105
|
+
private
|
106
|
+
|
107
|
+
# Preloads a specific named association for the given records. This is
|
108
|
+
# called by +preload_associations+ as its base case.
|
109
|
+
def preload_one_association(records, association, preload_options={})
|
110
|
+
class_to_reflection = {}
|
111
|
+
# Not all records have the same class, so group then preload
|
112
|
+
# group on the reflection itself so that if various subclass share the same association then we do not split them
|
113
|
+
# unnecessarily
|
114
|
+
records.group_by {|record| class_to_reflection[record.class] ||= record.class.reflections[association]}.each do |reflection, records|
|
115
|
+
raise ConfigurationError, "Association named '#{ association }' was not found; perhaps you misspelled it?" unless reflection
|
116
|
+
|
117
|
+
# 'reflection.macro' can return 'belongs_to', 'has_many', etc. Thus,
|
118
|
+
# the following could call 'preload_belongs_to_association',
|
119
|
+
# 'preload_has_many_association', etc.
|
120
|
+
send("preload_#{reflection.macro}_association", records, reflection, preload_options)
|
121
|
+
end
|
122
|
+
end
|
123
|
+
|
124
|
+
def add_preloaded_records_to_collection(parent_records, reflection_name, associated_record)
|
125
|
+
parent_records.each do |parent_record|
|
126
|
+
association_proxy = parent_record.send(reflection_name)
|
127
|
+
association_proxy.loaded
|
128
|
+
association_proxy.target.push(*[associated_record].flatten)
|
129
|
+
end
|
130
|
+
end
|
131
|
+
|
132
|
+
def add_preloaded_record_to_collection(parent_records, reflection_name, associated_record)
|
133
|
+
parent_records.each do |parent_record|
|
134
|
+
parent_record.send("set_#{reflection_name}_target", associated_record)
|
135
|
+
end
|
136
|
+
end
|
137
|
+
|
138
|
+
def set_association_collection_records(id_to_record_map, reflection_name, associated_records, key)
|
139
|
+
associated_records.each do |associated_record|
|
140
|
+
mapped_records = id_to_record_map[associated_record[key].to_s]
|
141
|
+
add_preloaded_records_to_collection(mapped_records, reflection_name, associated_record)
|
142
|
+
end
|
143
|
+
end
|
144
|
+
|
145
|
+
def set_association_single_records(id_to_record_map, reflection_name, associated_records, key)
|
146
|
+
seen_keys = {}
|
147
|
+
associated_records.each do |associated_record|
|
148
|
+
#this is a has_one or belongs_to: there should only be one record.
|
149
|
+
#Unfortunately we can't (in portable way) ask the database for 'all records where foo_id in (x,y,z), but please
|
150
|
+
# only one row per distinct foo_id' so this where we enforce that
|
151
|
+
next if seen_keys[associated_record[key].to_s]
|
152
|
+
seen_keys[associated_record[key].to_s] = true
|
153
|
+
mapped_records = id_to_record_map[associated_record[key].to_s]
|
154
|
+
mapped_records.each do |mapped_record|
|
155
|
+
mapped_record.send("set_#{reflection_name}_target", associated_record)
|
156
|
+
end
|
157
|
+
end
|
158
|
+
end
|
159
|
+
|
160
|
+
# Given a collection of ActiveRecord objects, constructs a Hash which maps
|
161
|
+
# the objects' IDs to the relevant objects. Returns a 2-tuple
|
162
|
+
# <tt>(id_to_record_map, ids)</tt> where +id_to_record_map+ is the Hash,
|
163
|
+
# and +ids+ is an Array of record IDs.
|
164
|
+
def construct_id_map(records, primary_key=nil)
|
165
|
+
id_to_record_map = {}
|
166
|
+
ids = []
|
167
|
+
records.each do |record|
|
168
|
+
primary_key ||= record.class.primary_key
|
169
|
+
ids << record[primary_key]
|
170
|
+
mapped_records = (id_to_record_map[ids.last.to_s] ||= [])
|
171
|
+
mapped_records << record
|
172
|
+
end
|
173
|
+
ids.uniq!
|
174
|
+
return id_to_record_map, ids
|
175
|
+
end
|
176
|
+
|
177
|
+
def preload_has_and_belongs_to_many_association(records, reflection, preload_options={})
|
178
|
+
table_name = reflection.klass.quoted_table_name
|
179
|
+
id_to_record_map, ids = construct_id_map(records)
|
180
|
+
records.each {|record| record.send(reflection.name).loaded}
|
181
|
+
options = reflection.options
|
182
|
+
|
183
|
+
conditions = "t0.#{reflection.primary_key_name} #{in_or_equals_for_ids(ids)}"
|
184
|
+
conditions << append_conditions(reflection, preload_options)
|
185
|
+
|
186
|
+
associated_records = reflection.klass.find(:all, :conditions => [conditions, ids],
|
187
|
+
:include => options[:include],
|
188
|
+
:joins => "INNER JOIN #{connection.quote_table_name options[:join_table]} as t0 ON #{reflection.klass.quoted_table_name}.#{reflection.klass.primary_key} = t0.#{reflection.association_foreign_key}",
|
189
|
+
:select => "#{options[:select] || table_name+'.*'}, t0.#{reflection.primary_key_name} as the_parent_record_id",
|
190
|
+
:order => options[:order])
|
191
|
+
|
192
|
+
set_association_collection_records(id_to_record_map, reflection.name, associated_records, 'the_parent_record_id')
|
193
|
+
end
|
194
|
+
|
195
|
+
def preload_has_one_association(records, reflection, preload_options={})
|
196
|
+
return if records.first.send("loaded_#{reflection.name}?")
|
197
|
+
id_to_record_map, ids = construct_id_map(records)
|
198
|
+
options = reflection.options
|
199
|
+
records.each {|record| record.send("set_#{reflection.name}_target", nil)}
|
200
|
+
if options[:through]
|
201
|
+
through_records = preload_through_records(records, reflection, options[:through])
|
202
|
+
through_reflection = reflections[options[:through]]
|
203
|
+
through_primary_key = through_reflection.primary_key_name
|
204
|
+
unless through_records.empty?
|
205
|
+
source = reflection.source_reflection.name
|
206
|
+
through_records.first.class.preload_associations(through_records, source)
|
207
|
+
through_records.each do |through_record|
|
208
|
+
add_preloaded_record_to_collection(id_to_record_map[through_record[through_primary_key].to_s],
|
209
|
+
reflection.name, through_record.send(source))
|
210
|
+
end
|
211
|
+
end
|
212
|
+
else
|
213
|
+
set_association_single_records(id_to_record_map, reflection.name, find_associated_records(ids, reflection, preload_options), reflection.primary_key_name)
|
214
|
+
end
|
215
|
+
end
|
216
|
+
|
217
|
+
def preload_has_many_association(records, reflection, preload_options={})
|
218
|
+
return if records.first.send(reflection.name).loaded?
|
219
|
+
options = reflection.options
|
220
|
+
|
221
|
+
primary_key_name = reflection.through_reflection_primary_key_name
|
222
|
+
id_to_record_map, ids = construct_id_map(records, primary_key_name)
|
223
|
+
records.each {|record| record.send(reflection.name).loaded}
|
224
|
+
|
225
|
+
if options[:through]
|
226
|
+
through_records = preload_through_records(records, reflection, options[:through])
|
227
|
+
through_reflection = reflections[options[:through]]
|
228
|
+
unless through_records.empty?
|
229
|
+
source = reflection.source_reflection.name
|
230
|
+
through_records.first.class.preload_associations(through_records, source, options)
|
231
|
+
through_records.each do |through_record|
|
232
|
+
through_record_id = through_record[reflection.through_reflection_primary_key].to_s
|
233
|
+
add_preloaded_records_to_collection(id_to_record_map[through_record_id], reflection.name, through_record.send(source))
|
234
|
+
end
|
235
|
+
end
|
236
|
+
|
237
|
+
else
|
238
|
+
set_association_collection_records(id_to_record_map, reflection.name, find_associated_records(ids, reflection, preload_options),
|
239
|
+
reflection.primary_key_name)
|
240
|
+
end
|
241
|
+
end
|
242
|
+
|
243
|
+
def preload_through_records(records, reflection, through_association)
|
244
|
+
through_reflection = reflections[through_association]
|
245
|
+
through_primary_key = through_reflection.primary_key_name
|
246
|
+
|
247
|
+
if reflection.options[:source_type]
|
248
|
+
interface = reflection.source_reflection.options[:foreign_type]
|
249
|
+
preload_options = {:conditions => ["#{connection.quote_column_name interface} = ?", reflection.options[:source_type]]}
|
250
|
+
|
251
|
+
records.compact!
|
252
|
+
records.first.class.preload_associations(records, through_association, preload_options)
|
253
|
+
|
254
|
+
# Dont cache the association - we would only be caching a subset
|
255
|
+
through_records = []
|
256
|
+
records.each do |record|
|
257
|
+
proxy = record.send(through_association)
|
258
|
+
|
259
|
+
if proxy.respond_to?(:target)
|
260
|
+
through_records << proxy.target
|
261
|
+
proxy.reset
|
262
|
+
else # this is a has_one :through reflection
|
263
|
+
through_records << proxy if proxy
|
264
|
+
end
|
265
|
+
end
|
266
|
+
through_records.flatten!
|
267
|
+
else
|
268
|
+
records.first.class.preload_associations(records, through_association)
|
269
|
+
through_records = records.map {|record| record.send(through_association)}.flatten
|
270
|
+
end
|
271
|
+
through_records.compact!
|
272
|
+
through_records
|
273
|
+
end
|
274
|
+
|
275
|
+
def preload_belongs_to_association(records, reflection, preload_options={})
|
276
|
+
return if records.first.send("loaded_#{reflection.name}?")
|
277
|
+
options = reflection.options
|
278
|
+
primary_key_name = reflection.primary_key_name
|
279
|
+
|
280
|
+
if options[:polymorphic]
|
281
|
+
polymorph_type = options[:foreign_type]
|
282
|
+
klasses_and_ids = {}
|
283
|
+
|
284
|
+
# Construct a mapping from klass to a list of ids to load and a mapping of those ids back to their parent_records
|
285
|
+
records.each do |record|
|
286
|
+
if klass = record.send(polymorph_type)
|
287
|
+
klass_id = record.send(primary_key_name)
|
288
|
+
if klass_id
|
289
|
+
id_map = klasses_and_ids[klass] ||= {}
|
290
|
+
id_list_for_klass_id = (id_map[klass_id.to_s] ||= [])
|
291
|
+
id_list_for_klass_id << record
|
292
|
+
end
|
293
|
+
end
|
294
|
+
end
|
295
|
+
klasses_and_ids = klasses_and_ids.to_a
|
296
|
+
else
|
297
|
+
id_map = {}
|
298
|
+
records.each do |record|
|
299
|
+
key = record.send(primary_key_name)
|
300
|
+
if key
|
301
|
+
mapped_records = (id_map[key.to_s] ||= [])
|
302
|
+
mapped_records << record
|
303
|
+
end
|
304
|
+
end
|
305
|
+
klasses_and_ids = [[reflection.klass.name, id_map]]
|
306
|
+
end
|
307
|
+
|
308
|
+
klasses_and_ids.each do |klass_and_id|
|
309
|
+
klass_name, id_map = *klass_and_id
|
310
|
+
klass = klass_name.constantize
|
311
|
+
|
312
|
+
table_name = klass.quoted_table_name
|
313
|
+
primary_key = klass.primary_key
|
314
|
+
column_type = klass.columns.detect{|c| c.name == primary_key}.type
|
315
|
+
ids = id_map.keys.map do |id|
|
316
|
+
if column_type == :integer
|
317
|
+
id.to_i
|
318
|
+
elsif column_type == :float
|
319
|
+
id.to_f
|
320
|
+
else
|
321
|
+
id
|
322
|
+
end
|
323
|
+
end
|
324
|
+
conditions = "#{table_name}.#{connection.quote_column_name(primary_key)} #{in_or_equals_for_ids(ids)}"
|
325
|
+
conditions << append_conditions(reflection, preload_options)
|
326
|
+
associated_records = klass.find(:all, :conditions => [conditions, ids],
|
327
|
+
:include => options[:include],
|
328
|
+
:select => options[:select],
|
329
|
+
:joins => options[:joins],
|
330
|
+
:order => options[:order])
|
331
|
+
set_association_single_records(id_map, reflection.name, associated_records, primary_key)
|
332
|
+
end
|
333
|
+
end
|
334
|
+
|
335
|
+
def find_associated_records(ids, reflection, preload_options)
|
336
|
+
options = reflection.options
|
337
|
+
table_name = reflection.klass.quoted_table_name
|
338
|
+
|
339
|
+
if interface = reflection.options[:as]
|
340
|
+
conditions = "#{reflection.klass.quoted_table_name}.#{connection.quote_column_name "#{interface}_id"} #{in_or_equals_for_ids(ids)} and #{reflection.klass.quoted_table_name}.#{connection.quote_column_name "#{interface}_type"} = '#{self.base_class.sti_name}'"
|
341
|
+
else
|
342
|
+
foreign_key = reflection.primary_key_name
|
343
|
+
conditions = "#{reflection.klass.quoted_table_name}.#{foreign_key} #{in_or_equals_for_ids(ids)}"
|
344
|
+
end
|
345
|
+
|
346
|
+
conditions << append_conditions(reflection, preload_options)
|
347
|
+
|
348
|
+
reflection.klass.find(:all,
|
349
|
+
:select => (preload_options[:select] || options[:select] || "#{table_name}.*"),
|
350
|
+
:include => preload_options[:include] || options[:include],
|
351
|
+
:conditions => [conditions, ids],
|
352
|
+
:joins => options[:joins],
|
353
|
+
:group => preload_options[:group] || options[:group],
|
354
|
+
:order => preload_options[:order] || options[:order])
|
355
|
+
end
|
356
|
+
|
357
|
+
|
358
|
+
def interpolate_sql_for_preload(sql)
|
359
|
+
instance_eval("%@#{sql.gsub('@', '\@')}@")
|
360
|
+
end
|
361
|
+
|
362
|
+
def append_conditions(reflection, preload_options)
|
363
|
+
sql = ""
|
364
|
+
sql << " AND (#{interpolate_sql_for_preload(reflection.sanitized_conditions)})" if reflection.sanitized_conditions
|
365
|
+
sql << " AND (#{sanitize_sql preload_options[:conditions]})" if preload_options[:conditions]
|
366
|
+
sql
|
367
|
+
end
|
368
|
+
|
369
|
+
def in_or_equals_for_ids(ids)
|
370
|
+
ids.size > 1 ? "IN (?)" : "= ?"
|
371
|
+
end
|
372
|
+
end
|
373
|
+
end
|
374
|
+
end
|