activejob-lock 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +14 -0
- data/Gemfile +21 -0
- data/LICENSE.txt +22 -0
- data/README.md +48 -0
- data/Rakefile +77 -0
- data/activejob-lock.gemspec +30 -0
- data/lib/activejob/lock/queue_adapters/resque_adapter.rb +44 -0
- data/lib/activejob/lock/queue_adapters.rb +1 -0
- data/lib/activejob/lock/version.rb +5 -0
- data/lib/activejob/lock.rb +38 -0
- data/rails/.gitignore +21 -0
- data/rails/.travis.yml +62 -0
- data/rails/.yardopts +4 -0
- data/rails/CONTRIBUTING.md +17 -0
- data/rails/Gemfile +126 -0
- data/rails/Gemfile.lock +273 -0
- data/rails/RAILS_VERSION +1 -0
- data/rails/README.md +85 -0
- data/rails/RELEASING_RAILS.rdoc +217 -0
- data/rails/Rakefile +67 -0
- data/rails/actionmailer/CHANGELOG.md +63 -0
- data/rails/actionmailer/MIT-LICENSE +21 -0
- data/rails/actionmailer/README.rdoc +176 -0
- data/rails/actionmailer/Rakefile +35 -0
- data/rails/actionmailer/actionmailer.gemspec +28 -0
- data/rails/actionmailer/lib/action_mailer/base.rb +947 -0
- data/rails/actionmailer/lib/action_mailer/collector.rb +30 -0
- data/rails/actionmailer/lib/action_mailer/delivery_job.rb +13 -0
- data/rails/actionmailer/lib/action_mailer/delivery_methods.rb +84 -0
- data/rails/actionmailer/lib/action_mailer/gem_version.rb +15 -0
- data/rails/actionmailer/lib/action_mailer/log_subscriber.rb +39 -0
- data/rails/actionmailer/lib/action_mailer/mail_helper.rb +58 -0
- data/rails/actionmailer/lib/action_mailer/message_delivery.rb +115 -0
- data/rails/actionmailer/lib/action_mailer/preview.rb +118 -0
- data/rails/actionmailer/lib/action_mailer/railtie.rb +64 -0
- data/rails/actionmailer/lib/action_mailer/test_case.rb +104 -0
- data/rails/actionmailer/lib/action_mailer/test_helper.rb +62 -0
- data/rails/actionmailer/lib/action_mailer/version.rb +9 -0
- data/rails/actionmailer/lib/action_mailer.rb +50 -0
- data/rails/actionmailer/lib/rails/generators/mailer/USAGE +17 -0
- data/rails/actionmailer/lib/rails/generators/mailer/mailer_generator.rb +19 -0
- data/rails/actionmailer/lib/rails/generators/mailer/templates/application_mailer.rb +4 -0
- data/rails/actionmailer/lib/rails/generators/mailer/templates/mailer.rb +17 -0
- data/rails/actionmailer/test/abstract_unit.rb +49 -0
- data/rails/actionmailer/test/assert_select_email_test.rb +47 -0
- data/rails/actionmailer/test/asset_host_test.rb +37 -0
- data/rails/actionmailer/test/base_test.rb +885 -0
- data/rails/actionmailer/test/delivery_methods_test.rb +237 -0
- data/rails/actionmailer/test/fixtures/anonymous/welcome.erb +1 -0
- data/rails/actionmailer/test/fixtures/another.path/base_mailer/welcome.erb +1 -0
- data/rails/actionmailer/test/fixtures/asset_host_mailer/email_with_asset.html.erb +1 -0
- data/rails/actionmailer/test/fixtures/asset_mailer/welcome.html.erb +1 -0
- data/rails/actionmailer/test/fixtures/async_mailer/welcome.erb +1 -0
- data/rails/actionmailer/test/fixtures/attachments/foo.jpg +0 -0
- data/rails/actionmailer/test/fixtures/attachments/test.jpg +0 -0
- data/rails/actionmailer/test/fixtures/auto_layout_mailer/hello.html.erb +1 -0
- data/rails/actionmailer/test/fixtures/auto_layout_mailer/multipart.html.erb +1 -0
- data/rails/actionmailer/test/fixtures/auto_layout_mailer/multipart.text.erb +1 -0
- data/rails/actionmailer/test/fixtures/base_mailer/attachment_with_content.erb +1 -0
- data/rails/actionmailer/test/fixtures/base_mailer/attachment_with_hash.html.erb +0 -0
- data/rails/actionmailer/test/fixtures/base_mailer/attachment_with_hash_default_encoding.html.erb +0 -0
- data/rails/actionmailer/test/fixtures/base_mailer/different_layout.html.erb +1 -0
- data/rails/actionmailer/test/fixtures/base_mailer/different_layout.text.erb +1 -0
- data/rails/actionmailer/test/fixtures/base_mailer/email_custom_layout.text.html.erb +1 -0
- data/rails/actionmailer/test/fixtures/base_mailer/email_with_translations.html.erb +1 -0
- data/rails/actionmailer/test/fixtures/base_mailer/explicit_multipart_templates.html.erb +1 -0
- data/rails/actionmailer/test/fixtures/base_mailer/explicit_multipart_templates.text.erb +1 -0
- data/rails/actionmailer/test/fixtures/base_mailer/explicit_multipart_with_one_template.erb +1 -0
- data/rails/actionmailer/test/fixtures/base_mailer/html_only.html.erb +1 -0
- data/rails/actionmailer/test/fixtures/base_mailer/implicit_multipart.html.erb +1 -0
- data/rails/actionmailer/test/fixtures/base_mailer/implicit_multipart.text.erb +1 -0
- data/rails/actionmailer/test/fixtures/base_mailer/implicit_with_locale.en.html.erb +1 -0
- data/rails/actionmailer/test/fixtures/base_mailer/implicit_with_locale.html.erb +1 -0
- data/rails/actionmailer/test/fixtures/base_mailer/implicit_with_locale.pl.text.erb +1 -0
- data/rails/actionmailer/test/fixtures/base_mailer/implicit_with_locale.text.erb +1 -0
- data/rails/actionmailer/test/fixtures/base_mailer/inline_attachment.html.erb +5 -0
- data/rails/actionmailer/test/fixtures/base_mailer/inline_attachment.text.erb +4 -0
- data/rails/actionmailer/test/fixtures/base_mailer/plain_text_only.text.erb +1 -0
- data/rails/actionmailer/test/fixtures/base_mailer/welcome.erb +1 -0
- data/rails/actionmailer/test/fixtures/base_mailer/welcome_with_headers.html.erb +0 -0
- data/rails/actionmailer/test/fixtures/base_mailer/without_mail_call.erb +1 -0
- data/rails/actionmailer/test/fixtures/base_test/after_action_mailer/welcome.html.erb +0 -0
- data/rails/actionmailer/test/fixtures/base_test/before_action_mailer/welcome.html.erb +0 -0
- data/rails/actionmailer/test/fixtures/base_test/default_inline_attachment_mailer/welcome.html.erb +0 -0
- data/rails/actionmailer/test/fixtures/base_test/late_inline_attachment_mailer/on_render.erb +7 -0
- data/rails/actionmailer/test/fixtures/explicit_layout_mailer/logout.html.erb +1 -0
- data/rails/actionmailer/test/fixtures/explicit_layout_mailer/signup.html.erb +1 -0
- data/rails/actionmailer/test/fixtures/first_mailer/share.erb +1 -0
- data/rails/actionmailer/test/fixtures/i18n_test_mailer/mail_with_i18n_subject.erb +4 -0
- data/rails/actionmailer/test/fixtures/layouts/auto_layout_mailer.html.erb +1 -0
- data/rails/actionmailer/test/fixtures/layouts/auto_layout_mailer.text.erb +1 -0
- data/rails/actionmailer/test/fixtures/layouts/different_layout.html.erb +1 -0
- data/rails/actionmailer/test/fixtures/layouts/different_layout.text.erb +1 -0
- data/rails/actionmailer/test/fixtures/layouts/spam.html.erb +1 -0
- data/rails/actionmailer/test/fixtures/mail_delivery_test/delivery_mailer/welcome.html.erb +0 -0
- data/rails/actionmailer/test/fixtures/nested_layout_mailer/signup.html.erb +1 -0
- data/rails/actionmailer/test/fixtures/path.with.dots/funky_path_mailer/multipart_with_template_path_with_dots.erb +1 -0
- data/rails/actionmailer/test/fixtures/proc_mailer/welcome.html.erb +0 -0
- data/rails/actionmailer/test/fixtures/raw_email +14 -0
- data/rails/actionmailer/test/fixtures/second_mailer/share.erb +1 -0
- data/rails/actionmailer/test/fixtures/templates/signed_up.erb +3 -0
- data/rails/actionmailer/test/fixtures/test_helper_mailer/welcome +1 -0
- data/rails/actionmailer/test/fixtures/test_mailer/_subtemplate.text.erb +1 -0
- data/rails/actionmailer/test/fixtures/test_mailer/custom_templating_extension.html.haml +6 -0
- data/rails/actionmailer/test/fixtures/test_mailer/custom_templating_extension.text.haml +6 -0
- data/rails/actionmailer/test/fixtures/test_mailer/implicitly_multipart_example.html.erb +10 -0
- data/rails/actionmailer/test/fixtures/test_mailer/implicitly_multipart_example.html.erb~ +10 -0
- data/rails/actionmailer/test/fixtures/test_mailer/implicitly_multipart_example.ignored.erb +1 -0
- data/rails/actionmailer/test/fixtures/test_mailer/implicitly_multipart_example.rhtml.bak +1 -0
- data/rails/actionmailer/test/fixtures/test_mailer/implicitly_multipart_example.text.erb +2 -0
- data/rails/actionmailer/test/fixtures/test_mailer/implicitly_multipart_example.yaml.erb +1 -0
- data/rails/actionmailer/test/fixtures/test_mailer/included_subtemplate.text.erb +1 -0
- data/rails/actionmailer/test/fixtures/test_mailer/multipart_alternative.html.erb +1 -0
- data/rails/actionmailer/test/fixtures/test_mailer/multipart_alternative.plain.erb +1 -0
- data/rails/actionmailer/test/fixtures/test_mailer/rxml_template.rxml +2 -0
- data/rails/actionmailer/test/fixtures/test_mailer/signed_up.html.erb +3 -0
- data/rails/actionmailer/test/fixtures/url_test_mailer/exercise_url_for.erb +1 -0
- data/rails/actionmailer/test/fixtures/url_test_mailer/signed_up_with_url.erb +5 -0
- data/rails/actionmailer/test/i18n_with_controller_test.rb +70 -0
- data/rails/actionmailer/test/log_subscriber_test.rb +47 -0
- data/rails/actionmailer/test/mail_helper_test.rb +111 -0
- data/rails/actionmailer/test/mail_layout_test.rb +95 -0
- data/rails/actionmailer/test/mailers/asset_mailer.rb +7 -0
- data/rails/actionmailer/test/mailers/base_mailer.rb +130 -0
- data/rails/actionmailer/test/mailers/delayed_mailer.rb +6 -0
- data/rails/actionmailer/test/mailers/proc_mailer.rb +17 -0
- data/rails/actionmailer/test/message_delivery_test.rb +104 -0
- data/rails/actionmailer/test/test_case_test.rb +28 -0
- data/rails/actionmailer/test/test_helper_test.rb +135 -0
- data/rails/actionmailer/test/url_test.rb +138 -0
- data/rails/actionpack/CHANGELOG.md +501 -0
- data/rails/actionpack/MIT-LICENSE +21 -0
- data/rails/actionpack/README.rdoc +58 -0
- data/rails/actionpack/Rakefile +53 -0
- data/rails/actionpack/actionpack.gemspec +31 -0
- data/rails/actionpack/lib/abstract_controller/asset_paths.rb +10 -0
- data/rails/actionpack/lib/abstract_controller/base.rb +269 -0
- data/rails/actionpack/lib/abstract_controller/callbacks.rb +196 -0
- data/rails/actionpack/lib/abstract_controller/collector.rb +46 -0
- data/rails/actionpack/lib/abstract_controller/helpers.rb +194 -0
- data/rails/actionpack/lib/abstract_controller/logger.rb +12 -0
- data/rails/actionpack/lib/abstract_controller/railties/routes_helpers.rb +18 -0
- data/rails/actionpack/lib/abstract_controller/rendering.rb +120 -0
- data/rails/actionpack/lib/abstract_controller/translation.rb +28 -0
- data/rails/actionpack/lib/abstract_controller/url_for.rb +33 -0
- data/rails/actionpack/lib/abstract_controller.rb +20 -0
- data/rails/actionpack/lib/action_controller/base.rb +268 -0
- data/rails/actionpack/lib/action_controller/caching/fragments.rb +103 -0
- data/rails/actionpack/lib/action_controller/caching.rb +89 -0
- data/rails/actionpack/lib/action_controller/log_subscriber.rb +83 -0
- data/rails/actionpack/lib/action_controller/metal/conditional_get.rb +200 -0
- data/rails/actionpack/lib/action_controller/metal/cookies.rb +16 -0
- data/rails/actionpack/lib/action_controller/metal/data_streaming.rb +171 -0
- data/rails/actionpack/lib/action_controller/metal/etag_with_template_digest.rb +50 -0
- data/rails/actionpack/lib/action_controller/metal/exceptions.rb +59 -0
- data/rails/actionpack/lib/action_controller/metal/flash.rb +60 -0
- data/rails/actionpack/lib/action_controller/metal/force_ssl.rb +97 -0
- data/rails/actionpack/lib/action_controller/metal/head.rb +56 -0
- data/rails/actionpack/lib/action_controller/metal/helpers.rb +113 -0
- data/rails/actionpack/lib/action_controller/metal/hide_actions.rb +40 -0
- data/rails/actionpack/lib/action_controller/metal/http_authentication.rb +507 -0
- data/rails/actionpack/lib/action_controller/metal/implicit_render.rb +19 -0
- data/rails/actionpack/lib/action_controller/metal/instrumentation.rb +109 -0
- data/rails/actionpack/lib/action_controller/metal/live.rb +328 -0
- data/rails/actionpack/lib/action_controller/metal/mime_responds.rb +324 -0
- data/rails/actionpack/lib/action_controller/metal/params_wrapper.rb +285 -0
- data/rails/actionpack/lib/action_controller/metal/rack_delegation.rb +32 -0
- data/rails/actionpack/lib/action_controller/metal/redirecting.rb +112 -0
- data/rails/actionpack/lib/action_controller/metal/renderers.rb +140 -0
- data/rails/actionpack/lib/action_controller/metal/rendering.rb +100 -0
- data/rails/actionpack/lib/action_controller/metal/request_forgery_protection.rb +334 -0
- data/rails/actionpack/lib/action_controller/metal/rescue.rb +35 -0
- data/rails/actionpack/lib/action_controller/metal/streaming.rb +221 -0
- data/rails/actionpack/lib/action_controller/metal/strong_parameters.rb +667 -0
- data/rails/actionpack/lib/action_controller/metal/testing.rb +31 -0
- data/rails/actionpack/lib/action_controller/metal/url_for.rb +49 -0
- data/rails/actionpack/lib/action_controller/metal.rb +241 -0
- data/rails/actionpack/lib/action_controller/middleware.rb +39 -0
- data/rails/actionpack/lib/action_controller/model_naming.rb +12 -0
- data/rails/actionpack/lib/action_controller/railtie.rb +71 -0
- data/rails/actionpack/lib/action_controller/railties/helpers.rb +22 -0
- data/rails/actionpack/lib/action_controller/test_case.rb +754 -0
- data/rails/actionpack/lib/action_controller.rb +58 -0
- data/rails/actionpack/lib/action_dispatch/http/cache.rb +176 -0
- data/rails/actionpack/lib/action_dispatch/http/filter_parameters.rb +78 -0
- data/rails/actionpack/lib/action_dispatch/http/filter_redirect.rb +38 -0
- data/rails/actionpack/lib/action_dispatch/http/headers.rb +99 -0
- data/rails/actionpack/lib/action_dispatch/http/mime_negotiation.rb +156 -0
- data/rails/actionpack/lib/action_dispatch/http/mime_type.rb +315 -0
- data/rails/actionpack/lib/action_dispatch/http/mime_types.rb +36 -0
- data/rails/actionpack/lib/action_dispatch/http/parameter_filter.rb +72 -0
- data/rails/actionpack/lib/action_dispatch/http/parameters.rb +67 -0
- data/rails/actionpack/lib/action_dispatch/http/rack_cache.rb +61 -0
- data/rails/actionpack/lib/action_dispatch/http/request.rb +348 -0
- data/rails/actionpack/lib/action_dispatch/http/response.rb +406 -0
- data/rails/actionpack/lib/action_dispatch/http/upload.rb +72 -0
- data/rails/actionpack/lib/action_dispatch/http/url.rb +268 -0
- data/rails/actionpack/lib/action_dispatch/journey/backwards.rb +5 -0
- data/rails/actionpack/lib/action_dispatch/journey/formatter.rb +166 -0
- data/rails/actionpack/lib/action_dispatch/journey/gtg/builder.rb +162 -0
- data/rails/actionpack/lib/action_dispatch/journey/gtg/simulator.rb +47 -0
- data/rails/actionpack/lib/action_dispatch/journey/gtg/transition_table.rb +157 -0
- data/rails/actionpack/lib/action_dispatch/journey/nfa/builder.rb +76 -0
- data/rails/actionpack/lib/action_dispatch/journey/nfa/dot.rb +36 -0
- data/rails/actionpack/lib/action_dispatch/journey/nfa/simulator.rb +47 -0
- data/rails/actionpack/lib/action_dispatch/journey/nfa/transition_table.rb +163 -0
- data/rails/actionpack/lib/action_dispatch/journey/nodes/node.rb +128 -0
- data/rails/actionpack/lib/action_dispatch/journey/parser.rb +198 -0
- data/rails/actionpack/lib/action_dispatch/journey/parser.y +49 -0
- data/rails/actionpack/lib/action_dispatch/journey/parser_extras.rb +23 -0
- data/rails/actionpack/lib/action_dispatch/journey/path/pattern.rb +193 -0
- data/rails/actionpack/lib/action_dispatch/journey/route.rb +125 -0
- data/rails/actionpack/lib/action_dispatch/journey/router/strexp.rb +27 -0
- data/rails/actionpack/lib/action_dispatch/journey/router/utils.rb +93 -0
- data/rails/actionpack/lib/action_dispatch/journey/router.rb +144 -0
- data/rails/actionpack/lib/action_dispatch/journey/routes.rb +76 -0
- data/rails/actionpack/lib/action_dispatch/journey/scanner.rb +61 -0
- data/rails/actionpack/lib/action_dispatch/journey/visitors.rb +221 -0
- data/rails/actionpack/lib/action_dispatch/journey/visualizer/fsm.css +30 -0
- data/rails/actionpack/lib/action_dispatch/journey/visualizer/fsm.js +134 -0
- data/rails/actionpack/lib/action_dispatch/journey/visualizer/index.html.erb +52 -0
- data/rails/actionpack/lib/action_dispatch/journey.rb +5 -0
- data/rails/actionpack/lib/action_dispatch/middleware/callbacks.rb +37 -0
- data/rails/actionpack/lib/action_dispatch/middleware/cookies.rb +574 -0
- data/rails/actionpack/lib/action_dispatch/middleware/debug_exceptions.rb +110 -0
- data/rails/actionpack/lib/action_dispatch/middleware/exception_wrapper.rb +148 -0
- data/rails/actionpack/lib/action_dispatch/middleware/flash.rb +276 -0
- data/rails/actionpack/lib/action_dispatch/middleware/params_parser.rb +60 -0
- data/rails/actionpack/lib/action_dispatch/middleware/public_exceptions.rb +55 -0
- data/rails/actionpack/lib/action_dispatch/middleware/reloader.rb +98 -0
- data/rails/actionpack/lib/action_dispatch/middleware/remote_ip.rb +173 -0
- data/rails/actionpack/lib/action_dispatch/middleware/request_id.rb +35 -0
- data/rails/actionpack/lib/action_dispatch/middleware/session/abstract_store.rb +90 -0
- data/rails/actionpack/lib/action_dispatch/middleware/session/cache_store.rb +49 -0
- data/rails/actionpack/lib/action_dispatch/middleware/session/cookie_store.rb +123 -0
- data/rails/actionpack/lib/action_dispatch/middleware/session/mem_cache_store.rb +22 -0
- data/rails/actionpack/lib/action_dispatch/middleware/show_exceptions.rb +58 -0
- data/rails/actionpack/lib/action_dispatch/middleware/ssl.rb +72 -0
- data/rails/actionpack/lib/action_dispatch/middleware/stack.rb +129 -0
- data/rails/actionpack/lib/action_dispatch/middleware/static.rb +116 -0
- data/rails/actionpack/lib/action_dispatch/middleware/templates/rescues/_request_and_response.html.erb +34 -0
- data/rails/actionpack/lib/action_dispatch/middleware/templates/rescues/_request_and_response.text.erb +23 -0
- data/rails/actionpack/lib/action_dispatch/middleware/templates/rescues/_source.erb +27 -0
- data/rails/actionpack/lib/action_dispatch/middleware/templates/rescues/_trace.html.erb +52 -0
- data/rails/actionpack/lib/action_dispatch/middleware/templates/rescues/_trace.text.erb +9 -0
- data/rails/actionpack/lib/action_dispatch/middleware/templates/rescues/diagnostics.html.erb +16 -0
- data/rails/actionpack/lib/action_dispatch/middleware/templates/rescues/diagnostics.text.erb +9 -0
- data/rails/actionpack/lib/action_dispatch/middleware/templates/rescues/layout.erb +160 -0
- data/rails/actionpack/lib/action_dispatch/middleware/templates/rescues/missing_template.html.erb +11 -0
- data/rails/actionpack/lib/action_dispatch/middleware/templates/rescues/missing_template.text.erb +3 -0
- data/rails/actionpack/lib/action_dispatch/middleware/templates/rescues/routing_error.html.erb +32 -0
- data/rails/actionpack/lib/action_dispatch/middleware/templates/rescues/routing_error.text.erb +11 -0
- data/rails/actionpack/lib/action_dispatch/middleware/templates/rescues/template_error.html.erb +20 -0
- data/rails/actionpack/lib/action_dispatch/middleware/templates/rescues/template_error.text.erb +7 -0
- data/rails/actionpack/lib/action_dispatch/middleware/templates/rescues/unknown_action.html.erb +6 -0
- data/rails/actionpack/lib/action_dispatch/middleware/templates/rescues/unknown_action.text.erb +3 -0
- data/rails/actionpack/lib/action_dispatch/middleware/templates/routes/_route.html.erb +16 -0
- data/rails/actionpack/lib/action_dispatch/middleware/templates/routes/_table.html.erb +200 -0
- data/rails/actionpack/lib/action_dispatch/railtie.rb +45 -0
- data/rails/actionpack/lib/action_dispatch/request/session.rb +193 -0
- data/rails/actionpack/lib/action_dispatch/request/utils.rb +35 -0
- data/rails/actionpack/lib/action_dispatch/routing/endpoint.rb +10 -0
- data/rails/actionpack/lib/action_dispatch/routing/inspector.rb +234 -0
- data/rails/actionpack/lib/action_dispatch/routing/mapper.rb +1979 -0
- data/rails/actionpack/lib/action_dispatch/routing/polymorphic_routes.rb +330 -0
- data/rails/actionpack/lib/action_dispatch/routing/redirection.rb +191 -0
- data/rails/actionpack/lib/action_dispatch/routing/route_set.rb +862 -0
- data/rails/actionpack/lib/action_dispatch/routing/routes_proxy.rb +41 -0
- data/rails/actionpack/lib/action_dispatch/routing/url_for.rb +195 -0
- data/rails/actionpack/lib/action_dispatch/routing.rb +261 -0
- data/rails/actionpack/lib/action_dispatch/testing/assertions/dom.rb +3 -0
- data/rails/actionpack/lib/action_dispatch/testing/assertions/response.rb +82 -0
- data/rails/actionpack/lib/action_dispatch/testing/assertions/routing.rb +212 -0
- data/rails/actionpack/lib/action_dispatch/testing/assertions/selector.rb +3 -0
- data/rails/actionpack/lib/action_dispatch/testing/assertions/tag.rb +3 -0
- data/rails/actionpack/lib/action_dispatch/testing/assertions.rb +22 -0
- data/rails/actionpack/lib/action_dispatch/testing/integration.rb +511 -0
- data/rails/actionpack/lib/action_dispatch/testing/test_process.rb +44 -0
- data/rails/actionpack/lib/action_dispatch/testing/test_request.rb +78 -0
- data/rails/actionpack/lib/action_dispatch/testing/test_response.rb +36 -0
- data/rails/actionpack/lib/action_dispatch.rb +105 -0
- data/rails/actionpack/lib/action_pack/gem_version.rb +15 -0
- data/rails/actionpack/lib/action_pack/version.rb +8 -0
- data/rails/actionpack/lib/action_pack.rb +24 -0
- data/rails/actionpack/test/abstract/callbacks_test.rb +315 -0
- data/rails/actionpack/test/abstract/collector_test.rb +63 -0
- data/rails/actionpack/test/abstract/translation_test.rb +50 -0
- data/rails/actionpack/test/abstract_unit.rb +521 -0
- data/rails/actionpack/test/assertions/response_assertions_test.rb +63 -0
- data/rails/actionpack/test/controller/action_pack_assertions_test.rb +657 -0
- data/rails/actionpack/test/controller/base_test.rb +342 -0
- data/rails/actionpack/test/controller/caching_test.rb +351 -0
- data/rails/actionpack/test/controller/content_type_test.rb +167 -0
- data/rails/actionpack/test/controller/controller_fixtures/app/controllers/admin/user_controller.rb +0 -0
- data/rails/actionpack/test/controller/controller_fixtures/app/controllers/user_controller.rb +0 -0
- data/rails/actionpack/test/controller/controller_fixtures/vendor/plugins/bad_plugin/lib/plugin_controller.rb +0 -0
- data/rails/actionpack/test/controller/default_url_options_with_before_action_test.rb +29 -0
- data/rails/actionpack/test/controller/filters_test.rb +1047 -0
- data/rails/actionpack/test/controller/flash_hash_test.rb +211 -0
- data/rails/actionpack/test/controller/flash_test.rb +335 -0
- data/rails/actionpack/test/controller/force_ssl_test.rb +324 -0
- data/rails/actionpack/test/controller/helper_test.rb +297 -0
- data/rails/actionpack/test/controller/http_basic_authentication_test.rb +144 -0
- data/rails/actionpack/test/controller/http_digest_authentication_test.rb +289 -0
- data/rails/actionpack/test/controller/http_token_authentication_test.rb +200 -0
- data/rails/actionpack/test/controller/integration_test.rb +899 -0
- data/rails/actionpack/test/controller/live_stream_test.rb +454 -0
- data/rails/actionpack/test/controller/localized_templates_test.rb +46 -0
- data/rails/actionpack/test/controller/log_subscriber_test.rb +345 -0
- data/rails/actionpack/test/controller/mime/accept_format_test.rb +92 -0
- data/rails/actionpack/test/controller/mime/respond_to_test.rb +784 -0
- data/rails/actionpack/test/controller/mime/responders_test.rb +32 -0
- data/rails/actionpack/test/controller/new_base/bare_metal_test.rb +153 -0
- data/rails/actionpack/test/controller/new_base/base_test.rb +132 -0
- data/rails/actionpack/test/controller/new_base/content_negotiation_test.rb +27 -0
- data/rails/actionpack/test/controller/new_base/content_type_test.rb +112 -0
- data/rails/actionpack/test/controller/new_base/metal_test.rb +45 -0
- data/rails/actionpack/test/controller/new_base/middleware_test.rb +110 -0
- data/rails/actionpack/test/controller/new_base/render_action_test.rb +315 -0
- data/rails/actionpack/test/controller/new_base/render_body_test.rb +170 -0
- data/rails/actionpack/test/controller/new_base/render_context_test.rb +54 -0
- data/rails/actionpack/test/controller/new_base/render_file_test.rb +70 -0
- data/rails/actionpack/test/controller/new_base/render_html_test.rb +190 -0
- data/rails/actionpack/test/controller/new_base/render_implicit_action_test.rb +57 -0
- data/rails/actionpack/test/controller/new_base/render_layout_test.rb +127 -0
- data/rails/actionpack/test/controller/new_base/render_partial_test.rb +63 -0
- data/rails/actionpack/test/controller/new_base/render_plain_test.rb +168 -0
- data/rails/actionpack/test/controller/new_base/render_streaming_test.rb +114 -0
- data/rails/actionpack/test/controller/new_base/render_template_test.rb +239 -0
- data/rails/actionpack/test/controller/new_base/render_test.rb +136 -0
- data/rails/actionpack/test/controller/new_base/render_text_test.rb +158 -0
- data/rails/actionpack/test/controller/new_base/render_xml_test.rb +11 -0
- data/rails/actionpack/test/controller/output_escaping_test.rb +17 -0
- data/rails/actionpack/test/controller/parameters/accessors_test.rb +125 -0
- data/rails/actionpack/test/controller/parameters/always_permitted_parameters_test.rb +29 -0
- data/rails/actionpack/test/controller/parameters/log_on_unpermitted_params_test.rb +72 -0
- data/rails/actionpack/test/controller/parameters/multi_parameter_attributes_test.rb +38 -0
- data/rails/actionpack/test/controller/parameters/mutators_test.rb +99 -0
- data/rails/actionpack/test/controller/parameters/nested_parameters_test.rb +187 -0
- data/rails/actionpack/test/controller/parameters/parameters_permit_test.rb +289 -0
- data/rails/actionpack/test/controller/parameters/raise_on_unpermitted_params_test.rb +33 -0
- data/rails/actionpack/test/controller/params_wrapper_test.rb +362 -0
- data/rails/actionpack/test/controller/permitted_params_test.rb +25 -0
- data/rails/actionpack/test/controller/redirect_test.rb +354 -0
- data/rails/actionpack/test/controller/render_js_test.rb +34 -0
- data/rails/actionpack/test/controller/render_json_test.rb +136 -0
- data/rails/actionpack/test/controller/render_other_test.rb +24 -0
- data/rails/actionpack/test/controller/render_test.rb +579 -0
- data/rails/actionpack/test/controller/render_xml_test.rb +97 -0
- data/rails/actionpack/test/controller/request/test_request_test.rb +35 -0
- data/rails/actionpack/test/controller/request_forgery_protection_test.rb +510 -0
- data/rails/actionpack/test/controller/required_params_test.rb +51 -0
- data/rails/actionpack/test/controller/rescue_test.rb +348 -0
- data/rails/actionpack/test/controller/resources_test.rb +1334 -0
- data/rails/actionpack/test/controller/routing_test.rb +2026 -0
- data/rails/actionpack/test/controller/runner_test.rb +22 -0
- data/rails/actionpack/test/controller/send_file_test.rb +209 -0
- data/rails/actionpack/test/controller/show_exceptions_test.rb +112 -0
- data/rails/actionpack/test/controller/streaming_test.rb +26 -0
- data/rails/actionpack/test/controller/test_case_test.rb +913 -0
- data/rails/actionpack/test/controller/url_for_integration_test.rb +188 -0
- data/rails/actionpack/test/controller/url_for_test.rb +446 -0
- data/rails/actionpack/test/controller/url_rewriter_test.rb +90 -0
- data/rails/actionpack/test/controller/webservice_test.rb +114 -0
- data/rails/actionpack/test/dispatch/callbacks_test.rb +58 -0
- data/rails/actionpack/test/dispatch/cookies_test.rb +1159 -0
- data/rails/actionpack/test/dispatch/debug_exceptions_test.rb +350 -0
- data/rails/actionpack/test/dispatch/exception_wrapper_test.rb +97 -0
- data/rails/actionpack/test/dispatch/header_test.rb +139 -0
- data/rails/actionpack/test/dispatch/live_response_test.rb +94 -0
- data/rails/actionpack/test/dispatch/mapper_test.rb +112 -0
- data/rails/actionpack/test/dispatch/middleware_stack/middleware_test.rb +77 -0
- data/rails/actionpack/test/dispatch/middleware_stack_test.rb +117 -0
- data/rails/actionpack/test/dispatch/mime_type_test.rb +203 -0
- data/rails/actionpack/test/dispatch/mount_test.rb +93 -0
- data/rails/actionpack/test/dispatch/prefix_generation_test.rb +465 -0
- data/rails/actionpack/test/dispatch/rack_cache_test.rb +21 -0
- data/rails/actionpack/test/dispatch/reloader_test.rb +176 -0
- data/rails/actionpack/test/dispatch/request/json_params_parsing_test.rb +164 -0
- data/rails/actionpack/test/dispatch/request/multipart_params_parsing_test.rb +186 -0
- data/rails/actionpack/test/dispatch/request/query_string_parsing_test.rb +171 -0
- data/rails/actionpack/test/dispatch/request/session_test.rb +116 -0
- data/rails/actionpack/test/dispatch/request/url_encoded_params_parsing_test.rb +177 -0
- data/rails/actionpack/test/dispatch/request_id_test.rb +65 -0
- data/rails/actionpack/test/dispatch/request_test.rb +1159 -0
- data/rails/actionpack/test/dispatch/response_test.rb +344 -0
- data/rails/actionpack/test/dispatch/routing/concerns_test.rb +120 -0
- data/rails/actionpack/test/dispatch/routing/inspector_test.rb +326 -0
- data/rails/actionpack/test/dispatch/routing/route_set_test.rb +205 -0
- data/rails/actionpack/test/dispatch/routing_assertions_test.rb +131 -0
- data/rails/actionpack/test/dispatch/routing_test.rb +4475 -0
- data/rails/actionpack/test/dispatch/session/abstract_store_test.rb +56 -0
- data/rails/actionpack/test/dispatch/session/cache_store_test.rb +179 -0
- data/rails/actionpack/test/dispatch/session/cookie_store_test.rb +356 -0
- data/rails/actionpack/test/dispatch/session/mem_cache_store_test.rb +201 -0
- data/rails/actionpack/test/dispatch/session/test_session_test.rb +43 -0
- data/rails/actionpack/test/dispatch/show_exceptions_test.rb +115 -0
- data/rails/actionpack/test/dispatch/ssl_test.rb +219 -0
- data/rails/actionpack/test/dispatch/static_test.rb +239 -0
- data/rails/actionpack/test/dispatch/template_assertions_test.rb +110 -0
- data/rails/actionpack/test/dispatch/test_request_test.rb +99 -0
- data/rails/actionpack/test/dispatch/test_response_test.rb +21 -0
- data/rails/actionpack/test/dispatch/uploaded_file_test.rb +105 -0
- data/rails/actionpack/test/dispatch/url_generation_test.rb +134 -0
- data/rails/actionpack/test/fixtures/_top_level_partial_only.erb +1 -0
- data/rails/actionpack/test/fixtures/alternate_helpers/foo_helper.rb +3 -0
- data/rails/actionpack/test/fixtures/bad_customers/_bad_customer.html.erb +1 -0
- data/rails/actionpack/test/fixtures/company.rb +9 -0
- data/rails/actionpack/test/fixtures/filter_test/implicit_actions/edit.html.erb +1 -0
- data/rails/actionpack/test/fixtures/filter_test/implicit_actions/show.html.erb +1 -0
- data/rails/actionpack/test/fixtures/functional_caching/_partial.erb +3 -0
- data/rails/actionpack/test/fixtures/functional_caching/formatted_fragment_cached.html.erb +3 -0
- data/rails/actionpack/test/fixtures/functional_caching/formatted_fragment_cached.xml.builder +5 -0
- data/rails/actionpack/test/fixtures/functional_caching/formatted_fragment_cached_with_variant.html+phone.erb +3 -0
- data/rails/actionpack/test/fixtures/functional_caching/fragment_cached.html.erb +3 -0
- data/rails/actionpack/test/fixtures/functional_caching/fragment_cached_without_digest.html.erb +3 -0
- data/rails/actionpack/test/fixtures/functional_caching/html_fragment_cached_with_partial.html.erb +1 -0
- data/rails/actionpack/test/fixtures/functional_caching/inline_fragment_cached.html.erb +2 -0
- data/rails/actionpack/test/fixtures/helpers/abc_helper.rb +3 -0
- data/rails/actionpack/test/fixtures/helpers/fun/games_helper.rb +5 -0
- data/rails/actionpack/test/fixtures/helpers/fun/pdf_helper.rb +5 -0
- data/rails/actionpack/test/fixtures/helpers/just_me_helper.rb +3 -0
- data/rails/actionpack/test/fixtures/helpers/me_too_helper.rb +3 -0
- data/rails/actionpack/test/fixtures/helpers1_pack/pack1_helper.rb +5 -0
- data/rails/actionpack/test/fixtures/helpers2_pack/pack2_helper.rb +5 -0
- data/rails/actionpack/test/fixtures/helpers_typo/admin/users_helper.rb +5 -0
- data/rails/actionpack/test/fixtures/layouts/_customers.erb +1 -0
- data/rails/actionpack/test/fixtures/layouts/block_with_layout.erb +3 -0
- data/rails/actionpack/test/fixtures/layouts/builder.builder +3 -0
- data/rails/actionpack/test/fixtures/layouts/partial_with_layout.erb +3 -0
- data/rails/actionpack/test/fixtures/layouts/standard.html.erb +1 -0
- data/rails/actionpack/test/fixtures/layouts/talk_from_action.erb +2 -0
- data/rails/actionpack/test/fixtures/layouts/with_html_partial.html.erb +1 -0
- data/rails/actionpack/test/fixtures/layouts/xhr.html.erb +2 -0
- data/rails/actionpack/test/fixtures/layouts/yield.erb +2 -0
- data/rails/actionpack/test/fixtures/localized/hello_world.de.html +1 -0
- data/rails/actionpack/test/fixtures/localized/hello_world.en.html +1 -0
- data/rails/actionpack/test/fixtures/localized/hello_world.it.erb +1 -0
- data/rails/actionpack/test/fixtures/multipart/binary_file +0 -0
- data/rails/actionpack/test/fixtures/multipart/boundary_problem_file +10 -0
- data/rails/actionpack/test/fixtures/multipart/bracketed_param +5 -0
- data/rails/actionpack/test/fixtures/multipart/bracketed_utf8_param +5 -0
- data/rails/actionpack/test/fixtures/multipart/empty +10 -0
- data/rails/actionpack/test/fixtures/multipart/hello.txt +1 -0
- data/rails/actionpack/test/fixtures/multipart/large_text_file +10 -0
- data/rails/actionpack/test/fixtures/multipart/mixed_files +0 -0
- data/rails/actionpack/test/fixtures/multipart/mona_lisa.jpg +0 -0
- data/rails/actionpack/test/fixtures/multipart/none +9 -0
- data/rails/actionpack/test/fixtures/multipart/single_parameter +5 -0
- data/rails/actionpack/test/fixtures/multipart/single_utf8_param +5 -0
- data/rails/actionpack/test/fixtures/multipart/text_file +10 -0
- data/rails/actionpack/test/fixtures/old_content_type/render_default_content_types_for_respond_to.xml.erb +1 -0
- data/rails/actionpack/test/fixtures/old_content_type/render_default_for_builder.builder +1 -0
- data/rails/actionpack/test/fixtures/old_content_type/render_default_for_erb.erb +1 -0
- data/rails/actionpack/test/fixtures/post_test/layouts/post.html.erb +1 -0
- data/rails/actionpack/test/fixtures/post_test/layouts/super_post.iphone.erb +1 -0
- data/rails/actionpack/test/fixtures/post_test/post/index.html.erb +1 -0
- data/rails/actionpack/test/fixtures/post_test/post/index.iphone.erb +1 -0
- data/rails/actionpack/test/fixtures/post_test/super_post/index.html.erb +1 -0
- data/rails/actionpack/test/fixtures/post_test/super_post/index.iphone.erb +1 -0
- data/rails/actionpack/test/fixtures/public/400.html +1 -0
- data/rails/actionpack/test/fixtures/public/404.html +1 -0
- data/rails/actionpack/test/fixtures/public/500.da.html +1 -0
- data/rails/actionpack/test/fixtures/public/500.html +1 -0
- data/rails/actionpack/test/fixtures/public/bar/index.html +1 -0
- data/rails/actionpack/test/fixtures/public/bar.html +1 -0
- data/rails/actionpack/test/fixtures/public/foo/bar.html +1 -0
- data/rails/actionpack/test/fixtures/public/foo/baz.css +3 -0
- data/rails/actionpack/test/fixtures/public/foo/index.html +1 -0
- data/rails/actionpack/test/fixtures/public/foo//343/201/223/343/202/223/343/201/253/343/201/241/343/201/257.html +1 -0
- data/rails/actionpack/test/fixtures/public/gzip/application-a71b3024f80aea3181c09774ca17e712.js +4 -0
- data/rails/actionpack/test/fixtures/public/gzip/application-a71b3024f80aea3181c09774ca17e712.js.gz +0 -0
- data/rails/actionpack/test/fixtures/public/gzip/foo.zoo +4 -0
- data/rails/actionpack/test/fixtures/public/gzip/foo.zoo.gz +0 -0
- data/rails/actionpack/test/fixtures/public/index.html +1 -0
- data/rails/actionpack/test/fixtures/respond_to/all_types_with_layout.html.erb +1 -0
- data/rails/actionpack/test/fixtures/respond_to/custom_constant_handling_without_block.mobile.erb +1 -0
- data/rails/actionpack/test/fixtures/respond_to/iphone_with_html_response_type.html.erb +1 -0
- data/rails/actionpack/test/fixtures/respond_to/iphone_with_html_response_type.iphone.erb +1 -0
- data/rails/actionpack/test/fixtures/respond_to/layouts/missing.html.erb +1 -0
- data/rails/actionpack/test/fixtures/respond_to/layouts/standard.html.erb +1 -0
- data/rails/actionpack/test/fixtures/respond_to/layouts/standard.iphone.erb +1 -0
- data/rails/actionpack/test/fixtures/respond_to/using_defaults.html.erb +1 -0
- data/rails/actionpack/test/fixtures/respond_to/using_defaults.xml.builder +1 -0
- data/rails/actionpack/test/fixtures/respond_to/using_defaults_with_all.html.erb +1 -0
- data/rails/actionpack/test/fixtures/respond_to/using_defaults_with_type_list.html.erb +1 -0
- data/rails/actionpack/test/fixtures/respond_to/using_defaults_with_type_list.xml.builder +1 -0
- data/rails/actionpack/test/fixtures/respond_to/variant_any_implicit_render.html+phablet.erb +1 -0
- data/rails/actionpack/test/fixtures/respond_to/variant_any_implicit_render.html+tablet.erb +1 -0
- data/rails/actionpack/test/fixtures/respond_to/variant_inline_syntax_without_block.html+phone.erb +1 -0
- data/rails/actionpack/test/fixtures/respond_to/variant_plus_none_for_format.html.erb +1 -0
- data/rails/actionpack/test/fixtures/respond_to/variant_with_implicit_rendering.html+mobile.erb +1 -0
- data/rails/actionpack/test/fixtures/ruby_template.ruby +2 -0
- data/rails/actionpack/test/fixtures/session_autoload_test/session_autoload_test/foo.rb +10 -0
- data/rails/actionpack/test/fixtures/shared.html.erb +1 -0
- data/rails/actionpack/test/fixtures/star_star_mime/index.js.erb +1 -0
- data/rails/actionpack/test/fixtures/symlink_parent/symlinked_layout.erb +5 -0
- data/rails/actionpack/test/fixtures/test/_partial.erb +1 -0
- data/rails/actionpack/test/fixtures/test/_partial.html.erb +1 -0
- data/rails/actionpack/test/fixtures/test/_partial.js.erb +1 -0
- data/rails/actionpack/test/fixtures/test/dot.directory/render_file_with_ivar.erb +1 -0
- data/rails/actionpack/test/fixtures/test/formatted_xml_erb.builder +1 -0
- data/rails/actionpack/test/fixtures/test/formatted_xml_erb.html.erb +1 -0
- data/rails/actionpack/test/fixtures/test/formatted_xml_erb.xml.erb +1 -0
- data/rails/actionpack/test/fixtures/test/hello/hello.erb +1 -0
- data/rails/actionpack/test/fixtures/test/hello_world.erb +1 -0
- data/rails/actionpack/test/fixtures/test/hello_world_with_partial.html.erb +2 -0
- data/rails/actionpack/test/fixtures/test/hello_xml_world.builder +11 -0
- data/rails/actionpack/test/fixtures/test/implicit_content_type.atom.builder +2 -0
- data/rails/actionpack/test/fixtures/test/render_file_with_ivar.erb +1 -0
- data/rails/actionpack/test/fixtures/test/render_file_with_locals.erb +1 -0
- data/rails/actionpack/test/fixtures//345/205/254/345/205/261/bar/index.html +1 -0
- data/rails/actionpack/test/fixtures//345/205/254/345/205/261/bar.html +1 -0
- data/rails/actionpack/test/fixtures//345/205/254/345/205/261/foo/bar.html +1 -0
- data/rails/actionpack/test/fixtures//345/205/254/345/205/261/foo/baz.css +3 -0
- data/rails/actionpack/test/fixtures//345/205/254/345/205/261/foo/index.html +1 -0
- data/rails/actionpack/test/fixtures//345/205/254/345/205/261/foo//343/201/223/343/202/223/343/201/253/343/201/241/343/201/257.html +1 -0
- data/rails/actionpack/test/fixtures//345/205/254/345/205/261/gzip/application-a71b3024f80aea3181c09774ca17e712.js +4 -0
- data/rails/actionpack/test/fixtures//345/205/254/345/205/261/gzip/application-a71b3024f80aea3181c09774ca17e712.js.gz +0 -0
- data/rails/actionpack/test/fixtures//345/205/254/345/205/261/gzip/foo.zoo +4 -0
- data/rails/actionpack/test/fixtures//345/205/254/345/205/261/gzip/foo.zoo.gz +0 -0
- data/rails/actionpack/test/fixtures//345/205/254/345/205/261/index.html +1 -0
- data/rails/actionpack/test/journey/gtg/builder_test.rb +79 -0
- data/rails/actionpack/test/journey/gtg/transition_table_test.rb +115 -0
- data/rails/actionpack/test/journey/nfa/simulator_test.rb +98 -0
- data/rails/actionpack/test/journey/nfa/transition_table_test.rb +72 -0
- data/rails/actionpack/test/journey/nodes/symbol_test.rb +17 -0
- data/rails/actionpack/test/journey/path/pattern_test.rb +284 -0
- data/rails/actionpack/test/journey/route/definition/parser_test.rb +110 -0
- data/rails/actionpack/test/journey/route/definition/scanner_test.rb +69 -0
- data/rails/actionpack/test/journey/route_test.rb +106 -0
- data/rails/actionpack/test/journey/router/utils_test.rb +38 -0
- data/rails/actionpack/test/journey/router_test.rb +622 -0
- data/rails/actionpack/test/journey/routes_test.rb +53 -0
- data/rails/actionpack/test/lib/controller/fake_controllers.rb +35 -0
- data/rails/actionpack/test/lib/controller/fake_models.rb +73 -0
- data/rails/actionpack/test/routing/helper_test.rb +45 -0
- data/rails/actionpack/test/tmp/.gitignore +0 -0
- data/rails/actionview/CHANGELOG.md +228 -0
- data/rails/actionview/MIT-LICENSE +21 -0
- data/rails/actionview/README.rdoc +39 -0
- data/rails/actionview/RUNNING_UNIT_TESTS.rdoc +27 -0
- data/rails/actionview/Rakefile +83 -0
- data/rails/actionview/actionview.gemspec +31 -0
- data/rails/actionview/lib/action_view/base.rb +205 -0
- data/rails/actionview/lib/action_view/buffers.rb +50 -0
- data/rails/actionview/lib/action_view/context.rb +36 -0
- data/rails/actionview/lib/action_view/dependency_tracker.rb +141 -0
- data/rails/actionview/lib/action_view/digestor.rb +122 -0
- data/rails/actionview/lib/action_view/flows.rb +76 -0
- data/rails/actionview/lib/action_view/gem_version.rb +15 -0
- data/rails/actionview/lib/action_view/helpers/active_model_helper.rb +49 -0
- data/rails/actionview/lib/action_view/helpers/asset_tag_helper.rb +329 -0
- data/rails/actionview/lib/action_view/helpers/asset_url_helper.rb +366 -0
- data/rails/actionview/lib/action_view/helpers/atom_feed_helper.rb +203 -0
- data/rails/actionview/lib/action_view/helpers/cache_helper.rb +200 -0
- data/rails/actionview/lib/action_view/helpers/capture_helper.rb +207 -0
- data/rails/actionview/lib/action_view/helpers/controller_helper.rb +25 -0
- data/rails/actionview/lib/action_view/helpers/csrf_helper.rb +33 -0
- data/rails/actionview/lib/action_view/helpers/date_helper.rb +1098 -0
- data/rails/actionview/lib/action_view/helpers/debug_helper.rb +35 -0
- data/rails/actionview/lib/action_view/helpers/form_helper.rb +1942 -0
- data/rails/actionview/lib/action_view/helpers/form_options_helper.rb +841 -0
- data/rails/actionview/lib/action_view/helpers/form_tag_helper.rb +877 -0
- data/rails/actionview/lib/action_view/helpers/javascript_helper.rb +81 -0
- data/rails/actionview/lib/action_view/helpers/number_helper.rb +432 -0
- data/rails/actionview/lib/action_view/helpers/output_safety_helper.rb +38 -0
- data/rails/actionview/lib/action_view/helpers/record_tag_helper.rb +108 -0
- data/rails/actionview/lib/action_view/helpers/rendering_helper.rb +98 -0
- data/rails/actionview/lib/action_view/helpers/sanitize_helper.rb +172 -0
- data/rails/actionview/lib/action_view/helpers/tag_helper.rb +188 -0
- data/rails/actionview/lib/action_view/helpers/tags/base.rb +155 -0
- data/rails/actionview/lib/action_view/helpers/tags/check_box.rb +64 -0
- data/rails/actionview/lib/action_view/helpers/tags/checkable.rb +16 -0
- data/rails/actionview/lib/action_view/helpers/tags/collection_check_boxes.rb +57 -0
- data/rails/actionview/lib/action_view/helpers/tags/collection_helpers.rb +85 -0
- data/rails/actionview/lib/action_view/helpers/tags/collection_radio_buttons.rb +36 -0
- data/rails/actionview/lib/action_view/helpers/tags/collection_select.rb +28 -0
- data/rails/actionview/lib/action_view/helpers/tags/color_field.rb +25 -0
- data/rails/actionview/lib/action_view/helpers/tags/date_field.rb +13 -0
- data/rails/actionview/lib/action_view/helpers/tags/date_select.rb +72 -0
- data/rails/actionview/lib/action_view/helpers/tags/datetime_field.rb +30 -0
- data/rails/actionview/lib/action_view/helpers/tags/datetime_local_field.rb +19 -0
- data/rails/actionview/lib/action_view/helpers/tags/datetime_select.rb +8 -0
- data/rails/actionview/lib/action_view/helpers/tags/email_field.rb +8 -0
- data/rails/actionview/lib/action_view/helpers/tags/file_field.rb +8 -0
- data/rails/actionview/lib/action_view/helpers/tags/grouped_collection_select.rb +29 -0
- data/rails/actionview/lib/action_view/helpers/tags/hidden_field.rb +8 -0
- data/rails/actionview/lib/action_view/helpers/tags/label.rb +79 -0
- data/rails/actionview/lib/action_view/helpers/tags/month_field.rb +13 -0
- data/rails/actionview/lib/action_view/helpers/tags/number_field.rb +18 -0
- data/rails/actionview/lib/action_view/helpers/tags/password_field.rb +12 -0
- data/rails/actionview/lib/action_view/helpers/tags/placeholderable.rb +22 -0
- data/rails/actionview/lib/action_view/helpers/tags/radio_button.rb +31 -0
- data/rails/actionview/lib/action_view/helpers/tags/range_field.rb +8 -0
- data/rails/actionview/lib/action_view/helpers/tags/search_field.rb +22 -0
- data/rails/actionview/lib/action_view/helpers/tags/select.rb +41 -0
- data/rails/actionview/lib/action_view/helpers/tags/tel_field.rb +8 -0
- data/rails/actionview/lib/action_view/helpers/tags/text_area.rb +22 -0
- data/rails/actionview/lib/action_view/helpers/tags/text_field.rb +33 -0
- data/rails/actionview/lib/action_view/helpers/tags/time_field.rb +13 -0
- data/rails/actionview/lib/action_view/helpers/tags/time_select.rb +8 -0
- data/rails/actionview/lib/action_view/helpers/tags/time_zone_select.rb +20 -0
- data/rails/actionview/lib/action_view/helpers/tags/translator.rb +40 -0
- data/rails/actionview/lib/action_view/helpers/tags/url_field.rb +8 -0
- data/rails/actionview/lib/action_view/helpers/tags/week_field.rb +13 -0
- data/rails/actionview/lib/action_view/helpers/tags.rb +42 -0
- data/rails/actionview/lib/action_view/helpers/text_helper.rb +467 -0
- data/rails/actionview/lib/action_view/helpers/translation_helper.rb +106 -0
- data/rails/actionview/lib/action_view/helpers/url_helper.rb +620 -0
- data/rails/actionview/lib/action_view/helpers.rb +64 -0
- data/rails/actionview/lib/action_view/layouts.rb +426 -0
- data/rails/actionview/lib/action_view/locale/en.yml +56 -0
- data/rails/actionview/lib/action_view/log_subscriber.rb +44 -0
- data/rails/actionview/lib/action_view/lookup_context.rb +255 -0
- data/rails/actionview/lib/action_view/model_naming.rb +12 -0
- data/rails/actionview/lib/action_view/path_set.rb +77 -0
- data/rails/actionview/lib/action_view/railtie.rb +49 -0
- data/rails/actionview/lib/action_view/record_identifier.rb +84 -0
- data/rails/actionview/lib/action_view/renderer/abstract_renderer.rb +49 -0
- data/rails/actionview/lib/action_view/renderer/partial_renderer.rb +548 -0
- data/rails/actionview/lib/action_view/renderer/renderer.rb +50 -0
- data/rails/actionview/lib/action_view/renderer/streaming_template_renderer.rb +103 -0
- data/rails/actionview/lib/action_view/renderer/template_renderer.rb +101 -0
- data/rails/actionview/lib/action_view/rendering.rb +146 -0
- data/rails/actionview/lib/action_view/routing_url_for.rb +134 -0
- data/rails/actionview/lib/action_view/tasks/dependencies.rake +21 -0
- data/rails/actionview/lib/action_view/template/error.rb +141 -0
- data/rails/actionview/lib/action_view/template/handlers/builder.rb +26 -0
- data/rails/actionview/lib/action_view/template/handlers/erb.rb +145 -0
- data/rails/actionview/lib/action_view/template/handlers/raw.rb +11 -0
- data/rails/actionview/lib/action_view/template/handlers.rb +62 -0
- data/rails/actionview/lib/action_view/template/html.rb +34 -0
- data/rails/actionview/lib/action_view/template/resolver.rb +349 -0
- data/rails/actionview/lib/action_view/template/text.rb +34 -0
- data/rails/actionview/lib/action_view/template/types.rb +57 -0
- data/rails/actionview/lib/action_view/template.rb +336 -0
- data/rails/actionview/lib/action_view/test_case.rb +278 -0
- data/rails/actionview/lib/action_view/testing/resolvers.rb +54 -0
- data/rails/actionview/lib/action_view/version.rb +8 -0
- data/rails/actionview/lib/action_view/view_paths.rb +111 -0
- data/rails/actionview/lib/action_view.rb +96 -0
- data/rails/actionview/test/abstract_unit.rb +345 -0
- data/rails/actionview/test/actionpack/abstract/abstract_controller_test.rb +310 -0
- data/rails/actionview/test/actionpack/abstract/helper_test.rb +127 -0
- data/rails/actionview/test/actionpack/abstract/layouts_test.rb +384 -0
- data/rails/actionview/test/actionpack/abstract/render_test.rb +103 -0
- data/rails/actionview/test/actionpack/abstract/views/abstract_controller/testing/me3/formatted.html.erb +1 -0
- data/rails/actionview/test/actionpack/abstract/views/abstract_controller/testing/me3/index.erb +1 -0
- data/rails/actionview/test/actionpack/abstract/views/abstract_controller/testing/me4/index.erb +1 -0
- data/rails/actionview/test/actionpack/abstract/views/abstract_controller/testing/me5/index.erb +1 -0
- data/rails/actionview/test/actionpack/abstract/views/action_with_ivars.erb +1 -0
- data/rails/actionview/test/actionpack/abstract/views/helper_test.erb +1 -0
- data/rails/actionview/test/actionpack/abstract/views/index.erb +1 -0
- data/rails/actionview/test/actionpack/abstract/views/layouts/abstract_controller/testing/me4.erb +1 -0
- data/rails/actionview/test/actionpack/abstract/views/layouts/application.erb +1 -0
- data/rails/actionview/test/actionpack/abstract/views/naked_render.erb +1 -0
- data/rails/actionview/test/actionpack/controller/capture_test.rb +81 -0
- data/rails/actionview/test/actionpack/controller/layout_test.rb +269 -0
- data/rails/actionview/test/actionpack/controller/render_test.rb +1344 -0
- data/rails/actionview/test/actionpack/controller/view_paths_test.rb +174 -0
- data/rails/actionview/test/active_record_unit.rb +91 -0
- data/rails/actionview/test/activerecord/controller_runtime_test.rb +93 -0
- data/rails/actionview/test/activerecord/debug_helper_test.rb +8 -0
- data/rails/actionview/test/activerecord/form_helper_activerecord_test.rb +92 -0
- data/rails/actionview/test/activerecord/polymorphic_routes_test.rb +733 -0
- data/rails/actionview/test/activerecord/render_partial_with_record_identification_test.rb +210 -0
- data/rails/actionview/test/fixtures/_top_level_partial.html.erb +1 -0
- data/rails/actionview/test/fixtures/_top_level_partial_only.erb +1 -0
- data/rails/actionview/test/fixtures/actionpack/bad_customers/_bad_customer.html.erb +1 -0
- data/rails/actionview/test/fixtures/actionpack/customers/_customer.html.erb +1 -0
- data/rails/actionview/test/fixtures/actionpack/fun/games/_form.erb +1 -0
- data/rails/actionview/test/fixtures/actionpack/fun/games/hello_world.erb +1 -0
- data/rails/actionview/test/fixtures/actionpack/good_customers/_good_customer.html.erb +1 -0
- data/rails/actionview/test/fixtures/actionpack/hello.html +1 -0
- data/rails/actionview/test/fixtures/actionpack/layout_tests/alt/layouts/alt.erb +0 -0
- data/rails/actionview/test/fixtures/actionpack/layout_tests/layouts/controller_name_space/nested.erb +1 -0
- data/rails/actionview/test/fixtures/actionpack/layout_tests/layouts/item.erb +1 -0
- data/rails/actionview/test/fixtures/actionpack/layout_tests/layouts/layout_test.erb +1 -0
- data/rails/actionview/test/fixtures/actionpack/layout_tests/layouts/multiple_extensions.html.erb +1 -0
- data/rails/actionview/test/fixtures/actionpack/layout_tests/layouts/symlinked/symlinked_layout.erb +5 -0
- data/rails/actionview/test/fixtures/actionpack/layout_tests/layouts/third_party_template_library.mab +1 -0
- data/rails/actionview/test/fixtures/actionpack/layout_tests/views/goodbye.erb +1 -0
- data/rails/actionview/test/fixtures/actionpack/layout_tests/views/hello.erb +1 -0
- data/rails/actionview/test/fixtures/actionpack/layouts/_column.html.erb +2 -0
- data/rails/actionview/test/fixtures/actionpack/layouts/_customers.erb +1 -0
- data/rails/actionview/test/fixtures/actionpack/layouts/_partial_and_yield.erb +2 -0
- data/rails/actionview/test/fixtures/actionpack/layouts/_yield_only.erb +1 -0
- data/rails/actionview/test/fixtures/actionpack/layouts/_yield_with_params.erb +1 -0
- data/rails/actionview/test/fixtures/actionpack/layouts/block_with_layout.erb +3 -0
- data/rails/actionview/test/fixtures/actionpack/layouts/builder.builder +3 -0
- data/rails/actionview/test/fixtures/actionpack/layouts/partial_with_layout.erb +3 -0
- data/rails/actionview/test/fixtures/actionpack/layouts/standard.html.erb +1 -0
- data/rails/actionview/test/fixtures/actionpack/layouts/streaming.erb +4 -0
- data/rails/actionview/test/fixtures/actionpack/layouts/talk_from_action.erb +2 -0
- data/rails/actionview/test/fixtures/actionpack/layouts/with_html_partial.html.erb +1 -0
- data/rails/actionview/test/fixtures/actionpack/layouts/xhr.html.erb +2 -0
- data/rails/actionview/test/fixtures/actionpack/layouts/yield.erb +2 -0
- data/rails/actionview/test/fixtures/actionpack/layouts/yield_with_render_inline_inside.erb +2 -0
- data/rails/actionview/test/fixtures/actionpack/layouts/yield_with_render_partial_inside.erb +2 -0
- data/rails/actionview/test/fixtures/actionpack/quiz/questions/_question.html.erb +1 -0
- data/rails/actionview/test/fixtures/actionpack/shared.html.erb +1 -0
- data/rails/actionview/test/fixtures/actionpack/test/_changing_priority.html.erb +1 -0
- data/rails/actionview/test/fixtures/actionpack/test/_changing_priority.json.erb +1 -0
- data/rails/actionview/test/fixtures/actionpack/test/_counter.html.erb +1 -0
- data/rails/actionview/test/fixtures/actionpack/test/_customer.erb +1 -0
- data/rails/actionview/test/fixtures/actionpack/test/_customer_counter.erb +1 -0
- data/rails/actionview/test/fixtures/actionpack/test/_customer_counter_with_as.erb +1 -0
- data/rails/actionview/test/fixtures/actionpack/test/_customer_greeting.erb +1 -0
- data/rails/actionview/test/fixtures/actionpack/test/_customer_iteration.erb +1 -0
- data/rails/actionview/test/fixtures/actionpack/test/_customer_iteration_with_as.erb +1 -0
- data/rails/actionview/test/fixtures/actionpack/test/_customer_with_var.erb +1 -0
- data/rails/actionview/test/fixtures/actionpack/test/_directory/_partial_with_locales.html.erb +1 -0
- data/rails/actionview/test/fixtures/actionpack/test/_first_json_partial.json.erb +1 -0
- data/rails/actionview/test/fixtures/actionpack/test/_form.erb +1 -0
- data/rails/actionview/test/fixtures/actionpack/test/_hash_greeting.erb +1 -0
- data/rails/actionview/test/fixtures/actionpack/test/_hash_object.erb +2 -0
- data/rails/actionview/test/fixtures/actionpack/test/_hello.builder +1 -0
- data/rails/actionview/test/fixtures/actionpack/test/_json_change_priority.json.erb +0 -0
- data/rails/actionview/test/fixtures/actionpack/test/_labelling_form.erb +1 -0
- data/rails/actionview/test/fixtures/actionpack/test/_layout_for_partial.html.erb +3 -0
- data/rails/actionview/test/fixtures/actionpack/test/_partial.erb +1 -0
- data/rails/actionview/test/fixtures/actionpack/test/_partial.html.erb +1 -0
- data/rails/actionview/test/fixtures/actionpack/test/_partial.js.erb +1 -0
- data/rails/actionview/test/fixtures/actionpack/test/_partial_for_use_in_layout.html.erb +1 -0
- data/rails/actionview/test/fixtures/actionpack/test/_partial_html_erb.html.erb +1 -0
- data/rails/actionview/test/fixtures/actionpack/test/_partial_name_local_variable.erb +1 -0
- data/rails/actionview/test/fixtures/actionpack/test/_partial_only.erb +1 -0
- data/rails/actionview/test/fixtures/actionpack/test/_partial_only_html.html +1 -0
- data/rails/actionview/test/fixtures/actionpack/test/_partial_with_partial.erb +2 -0
- data/rails/actionview/test/fixtures/actionpack/test/_person.erb +2 -0
- data/rails/actionview/test/fixtures/actionpack/test/_raise_indentation.html.erb +13 -0
- data/rails/actionview/test/fixtures/actionpack/test/_second_json_partial.json.erb +1 -0
- data/rails/actionview/test/fixtures/actionpack/test/action_talk_to_layout.erb +2 -0
- data/rails/actionview/test/fixtures/actionpack/test/calling_partial_with_layout.html.erb +1 -0
- data/rails/actionview/test/fixtures/actionpack/test/capturing.erb +4 -0
- data/rails/actionview/test/fixtures/actionpack/test/change_priority.html.erb +2 -0
- data/rails/actionview/test/fixtures/actionpack/test/content_for.erb +1 -0
- data/rails/actionview/test/fixtures/actionpack/test/content_for_concatenated.erb +3 -0
- data/rails/actionview/test/fixtures/actionpack/test/content_for_with_parameter.erb +2 -0
- data/rails/actionview/test/fixtures/actionpack/test/dot.directory/render_file_with_ivar.erb +1 -0
- data/rails/actionview/test/fixtures/actionpack/test/formatted_html_erb.html.erb +1 -0
- data/rails/actionview/test/fixtures/actionpack/test/formatted_xml_erb.builder +1 -0
- data/rails/actionview/test/fixtures/actionpack/test/formatted_xml_erb.html.erb +1 -0
- data/rails/actionview/test/fixtures/actionpack/test/formatted_xml_erb.xml.erb +1 -0
- data/rails/actionview/test/fixtures/actionpack/test/greeting.html.erb +1 -0
- data/rails/actionview/test/fixtures/actionpack/test/greeting.xml.erb +1 -0
- data/rails/actionview/test/fixtures/actionpack/test/hello/hello.erb +1 -0
- data/rails/actionview/test/fixtures/actionpack/test/hello,world.erb +1 -0
- data/rails/actionview/test/fixtures/actionpack/test/hello.builder +4 -0
- data/rails/actionview/test/fixtures/actionpack/test/hello_world.erb +1 -0
- data/rails/actionview/test/fixtures/actionpack/test/hello_world_container.builder +3 -0
- data/rails/actionview/test/fixtures/actionpack/test/hello_world_from_rxml.builder +3 -0
- data/rails/actionview/test/fixtures/actionpack/test/hello_world_with_layout_false.erb +1 -0
- data/rails/actionview/test/fixtures/actionpack/test/hello_world_with_partial.html.erb +2 -0
- data/rails/actionview/test/fixtures/actionpack/test/hello_xml_world.builder +11 -0
- data/rails/actionview/test/fixtures/actionpack/test/html_template.html.erb +1 -0
- data/rails/actionview/test/fixtures/actionpack/test/hyphen-ated.erb +1 -0
- data/rails/actionview/test/fixtures/actionpack/test/implicit_content_type.atom.builder +2 -0
- data/rails/actionview/test/fixtures/actionpack/test/list.erb +1 -0
- data/rails/actionview/test/fixtures/actionpack/test/non_erb_block_content_for.builder +4 -0
- data/rails/actionview/test/fixtures/actionpack/test/potential_conflicts.erb +4 -0
- data/rails/actionview/test/fixtures/actionpack/test/proper_block_detection.erb +1 -0
- data/rails/actionview/test/fixtures/actionpack/test/render_file_from_template.html.erb +1 -0
- data/rails/actionview/test/fixtures/actionpack/test/render_file_with_ivar.erb +1 -0
- data/rails/actionview/test/fixtures/actionpack/test/render_file_with_locals.erb +1 -0
- data/rails/actionview/test/fixtures/actionpack/test/render_file_with_locals_and_default.erb +1 -0
- data/rails/actionview/test/fixtures/actionpack/test/render_implicit_html_template_from_xhr_request.da.html.erb +1 -0
- data/rails/actionview/test/fixtures/actionpack/test/render_implicit_html_template_from_xhr_request.html.erb +1 -0
- data/rails/actionview/test/fixtures/actionpack/test/render_implicit_js_template_without_layout.js.erb +1 -0
- data/rails/actionview/test/fixtures/actionpack/test/render_partial_inside_directory.html.erb +1 -0
- data/rails/actionview/test/fixtures/actionpack/test/render_to_string_test.erb +1 -0
- data/rails/actionview/test/fixtures/actionpack/test/render_two_partials.html.erb +2 -0
- data/rails/actionview/test/fixtures/actionpack/test/using_layout_around_block.html.erb +1 -0
- data/rails/actionview/test/fixtures/actionpack/test/with_html_partial.html.erb +1 -0
- data/rails/actionview/test/fixtures/actionpack/test/with_partial.html.erb +1 -0
- data/rails/actionview/test/fixtures/actionpack/test/with_partial.text.erb +1 -0
- data/rails/actionview/test/fixtures/actionpack/test/with_xml_template.html.erb +1 -0
- data/rails/actionview/test/fixtures/blog_public/.gitignore +1 -0
- data/rails/actionview/test/fixtures/blog_public/blog.html +1 -0
- data/rails/actionview/test/fixtures/blog_public/index.html +1 -0
- data/rails/actionview/test/fixtures/blog_public/subdir/index.html +1 -0
- data/rails/actionview/test/fixtures/comments/empty.de.html.erb +1 -0
- data/rails/actionview/test/fixtures/comments/empty.html.builder +1 -0
- data/rails/actionview/test/fixtures/comments/empty.html.erb +1 -0
- data/rails/actionview/test/fixtures/comments/empty.xml.erb +1 -0
- data/rails/actionview/test/fixtures/companies.yml +24 -0
- data/rails/actionview/test/fixtures/company.rb +9 -0
- data/rails/actionview/test/fixtures/custom_pattern/another.html.erb +1 -0
- data/rails/actionview/test/fixtures/custom_pattern/html/another.erb +1 -0
- data/rails/actionview/test/fixtures/custom_pattern/html/path.erb +1 -0
- data/rails/actionview/test/fixtures/customers/_customer.html.erb +1 -0
- data/rails/actionview/test/fixtures/customers/_customer.xml.erb +1 -0
- data/rails/actionview/test/fixtures/db_definitions/sqlite.sql +49 -0
- data/rails/actionview/test/fixtures/developer.rb +6 -0
- data/rails/actionview/test/fixtures/developers/_developer.erb +1 -0
- data/rails/actionview/test/fixtures/developers.yml +21 -0
- data/rails/actionview/test/fixtures/developers_projects.yml +13 -0
- data/rails/actionview/test/fixtures/digestor/comments/_comment.html.erb +1 -0
- data/rails/actionview/test/fixtures/digestor/comments/_comments.html.erb +1 -0
- data/rails/actionview/test/fixtures/digestor/events/_event.html.erb +0 -0
- data/rails/actionview/test/fixtures/digestor/level/_recursion.html.erb +1 -0
- data/rails/actionview/test/fixtures/digestor/level/below/_header.html.erb +0 -0
- data/rails/actionview/test/fixtures/digestor/level/below/index.html.erb +1 -0
- data/rails/actionview/test/fixtures/digestor/level/recursion.html.erb +1 -0
- data/rails/actionview/test/fixtures/digestor/messages/_form.html.erb +0 -0
- data/rails/actionview/test/fixtures/digestor/messages/_header.html.erb +0 -0
- data/rails/actionview/test/fixtures/digestor/messages/_message.html.erb +1 -0
- data/rails/actionview/test/fixtures/digestor/messages/actions/_move.html.erb +0 -0
- data/rails/actionview/test/fixtures/digestor/messages/edit.html.erb +5 -0
- data/rails/actionview/test/fixtures/digestor/messages/index.html.erb +2 -0
- data/rails/actionview/test/fixtures/digestor/messages/new.html+iphone.erb +15 -0
- data/rails/actionview/test/fixtures/digestor/messages/show.html.erb +14 -0
- data/rails/actionview/test/fixtures/fun/games/_game.erb +1 -0
- data/rails/actionview/test/fixtures/fun/games/hello_world.erb +1 -0
- data/rails/actionview/test/fixtures/fun/serious/games/_game.erb +1 -0
- data/rails/actionview/test/fixtures/functional_caching/fragment_cached_without_digest.html.erb +3 -0
- data/rails/actionview/test/fixtures/games/_game.erb +1 -0
- data/rails/actionview/test/fixtures/good_customers/_good_customer.html.erb +1 -0
- data/rails/actionview/test/fixtures/happy_path/render_action/hello_world.erb +1 -0
- data/rails/actionview/test/fixtures/helpers/abc_helper.rb +3 -0
- data/rails/actionview/test/fixtures/helpers/helpery_test_helper.rb +5 -0
- data/rails/actionview/test/fixtures/helpers_missing/invalid_require_helper.rb +5 -0
- data/rails/actionview/test/fixtures/layout_tests/alt/hello.erb +1 -0
- data/rails/actionview/test/fixtures/layouts/_column.html.erb +2 -0
- data/rails/actionview/test/fixtures/layouts/_customers.erb +1 -0
- data/rails/actionview/test/fixtures/layouts/_partial_and_yield.erb +2 -0
- data/rails/actionview/test/fixtures/layouts/_yield_only.erb +1 -0
- data/rails/actionview/test/fixtures/layouts/_yield_with_params.erb +1 -0
- data/rails/actionview/test/fixtures/layouts/streaming.erb +4 -0
- data/rails/actionview/test/fixtures/layouts/yield.erb +2 -0
- data/rails/actionview/test/fixtures/layouts/yield_with_render_inline_inside.erb +2 -0
- data/rails/actionview/test/fixtures/layouts/yield_with_render_partial_inside.erb +2 -0
- data/rails/actionview/test/fixtures/mascot.rb +3 -0
- data/rails/actionview/test/fixtures/mascots/_mascot.html.erb +1 -0
- data/rails/actionview/test/fixtures/mascots.yml +4 -0
- data/rails/actionview/test/fixtures/multipart/bracketed_utf8_param +5 -0
- data/rails/actionview/test/fixtures/multipart/single_utf8_param +5 -0
- data/rails/actionview/test/fixtures/override/test/hello_world.erb +1 -0
- data/rails/actionview/test/fixtures/override2/layouts/test/sub.erb +1 -0
- data/rails/actionview/test/fixtures/plain_text.raw +1 -0
- data/rails/actionview/test/fixtures/plain_text_with_characters.raw +1 -0
- data/rails/actionview/test/fixtures/project.rb +3 -0
- data/rails/actionview/test/fixtures/projects/_project.erb +1 -0
- data/rails/actionview/test/fixtures/projects.yml +7 -0
- data/rails/actionview/test/fixtures/public/.gitignore +1 -0
- data/rails/actionview/test/fixtures/public/elsewhere/cools.js +1 -0
- data/rails/actionview/test/fixtures/public/elsewhere/file.css +1 -0
- data/rails/actionview/test/fixtures/public/foo/baz.css +3 -0
- data/rails/actionview/test/fixtures/public/javascripts/application.js +1 -0
- data/rails/actionview/test/fixtures/public/javascripts/bank.js +1 -0
- data/rails/actionview/test/fixtures/public/javascripts/common.javascript +1 -0
- data/rails/actionview/test/fixtures/public/javascripts/controls.js +1 -0
- data/rails/actionview/test/fixtures/public/javascripts/dragdrop.js +1 -0
- data/rails/actionview/test/fixtures/public/javascripts/effects.js +1 -0
- data/rails/actionview/test/fixtures/public/javascripts/prototype.js +1 -0
- data/rails/actionview/test/fixtures/public/javascripts/robber.js +1 -0
- data/rails/actionview/test/fixtures/public/javascripts/subdir/subdir.js +1 -0
- data/rails/actionview/test/fixtures/public/javascripts/version.1.0.js +1 -0
- data/rails/actionview/test/fixtures/public/stylesheets/bank.css +1 -0
- data/rails/actionview/test/fixtures/public/stylesheets/random.styles +1 -0
- data/rails/actionview/test/fixtures/public/stylesheets/robber.css +1 -0
- data/rails/actionview/test/fixtures/public/stylesheets/subdir/subdir.css +1 -0
- data/rails/actionview/test/fixtures/public/stylesheets/version.1.0.css +1 -0
- data/rails/actionview/test/fixtures/replies/_reply.erb +1 -0
- data/rails/actionview/test/fixtures/replies.yml +15 -0
- data/rails/actionview/test/fixtures/reply.rb +7 -0
- data/rails/actionview/test/fixtures/respond_to/using_defaults_with_all.html.erb +1 -0
- data/rails/actionview/test/fixtures/ruby_template.ruby +2 -0
- data/rails/actionview/test/fixtures/scope/test/modgreet.erb +1 -0
- data/rails/actionview/test/fixtures/shared.html.erb +1 -0
- data/rails/actionview/test/fixtures/test/_200.html.erb +1 -0
- data/rails/actionview/test/fixtures/test/_b_layout_for_partial.html.erb +1 -0
- data/rails/actionview/test/fixtures/test/_b_layout_for_partial_with_object.html.erb +1 -0
- data/rails/actionview/test/fixtures/test/_b_layout_for_partial_with_object_counter.html.erb +1 -0
- data/rails/actionview/test/fixtures/test/_changing_priority.html.erb +1 -0
- data/rails/actionview/test/fixtures/test/_changing_priority.json.erb +1 -0
- data/rails/actionview/test/fixtures/test/_content_tag_nested_in_content_tag.erb +3 -0
- data/rails/actionview/test/fixtures/test/_counter.html.erb +1 -0
- data/rails/actionview/test/fixtures/test/_customer.erb +1 -0
- data/rails/actionview/test/fixtures/test/_customer_greeting.erb +1 -0
- data/rails/actionview/test/fixtures/test/_customer_with_var.erb +1 -0
- data/rails/actionview/test/fixtures/test/_directory/_partial_with_locales.html.erb +1 -0
- data/rails/actionview/test/fixtures/test/_first_json_partial.json.erb +1 -0
- data/rails/actionview/test/fixtures/test/_from_helper.erb +1 -0
- data/rails/actionview/test/fixtures/test/_json_change_priority.json.erb +0 -0
- data/rails/actionview/test/fixtures/test/_label_with_block.erb +4 -0
- data/rails/actionview/test/fixtures/test/_layout_for_block_with_args.html.erb +3 -0
- data/rails/actionview/test/fixtures/test/_layout_for_partial.html.erb +3 -0
- data/rails/actionview/test/fixtures/test/_layout_with_partial_and_yield.html.erb +4 -0
- data/rails/actionview/test/fixtures/test/_local_inspector.html.erb +1 -0
- data/rails/actionview/test/fixtures/test/_object_inspector.erb +1 -0
- data/rails/actionview/test/fixtures/test/_one.html.erb +1 -0
- data/rails/actionview/test/fixtures/test/_partial.erb +1 -0
- data/rails/actionview/test/fixtures/test/_partial.html.erb +1 -0
- data/rails/actionview/test/fixtures/test/_partial.js.erb +1 -0
- data/rails/actionview/test/fixtures/test/_partial_for_use_in_layout.html.erb +1 -0
- data/rails/actionview/test/fixtures/test/_partial_name_local_variable.erb +1 -0
- data/rails/actionview/test/fixtures/test/_partial_only.erb +1 -0
- data/rails/actionview/test/fixtures/test/_partial_with_layout.erb +2 -0
- data/rails/actionview/test/fixtures/test/_partial_with_layout_block_content.erb +4 -0
- data/rails/actionview/test/fixtures/test/_partial_with_layout_block_partial.erb +4 -0
- data/rails/actionview/test/fixtures/test/_partial_with_only_html_version.html.erb +1 -0
- data/rails/actionview/test/fixtures/test/_partial_with_partial.erb +2 -0
- data/rails/actionview/test/fixtures/test/_raise.html.erb +1 -0
- data/rails/actionview/test/fixtures/test/_raise_indentation.html.erb +13 -0
- data/rails/actionview/test/fixtures/test/_second_json_partial.json.erb +1 -0
- data/rails/actionview/test/fixtures/test/_two.html.erb +1 -0
- data/rails/actionview/test/fixtures/test/_utf8_partial.html.erb +1 -0
- data/rails/actionview/test/fixtures/test/_utf8_partial_magic.html.erb +2 -0
- data/rails/actionview/test/fixtures/test/basic.html.erb +1 -0
- data/rails/actionview/test/fixtures/test/calling_partial_with_layout.html.erb +1 -0
- data/rails/actionview/test/fixtures/test/change_priority.html.erb +2 -0
- data/rails/actionview/test/fixtures/test/dont_pick_me +1 -0
- data/rails/actionview/test/fixtures/test/dot.directory/render_file_with_ivar.erb +1 -0
- data/rails/actionview/test/fixtures/test/greeting.xml.erb +1 -0
- data/rails/actionview/test/fixtures/test/hello/hello.erb +1 -0
- data/rails/actionview/test/fixtures/test/hello.builder +4 -0
- data/rails/actionview/test/fixtures/test/hello_world.da.html.erb +1 -0
- data/rails/actionview/test/fixtures/test/hello_world.erb +1 -0
- data/rails/actionview/test/fixtures/test/hello_world.erb~ +1 -0
- data/rails/actionview/test/fixtures/test/hello_world.html+phone.erb +1 -0
- data/rails/actionview/test/fixtures/test/hello_world.pt-BR.html.erb +1 -0
- data/rails/actionview/test/fixtures/test/hello_world.text+phone.erb +1 -0
- data/rails/actionview/test/fixtures/test/hello_world_with_partial.html.erb +2 -0
- data/rails/actionview/test/fixtures/test/html_template.html.erb +1 -0
- data/rails/actionview/test/fixtures/test/layout_render_file.erb +2 -0
- data/rails/actionview/test/fixtures/test/layout_render_object.erb +1 -0
- data/rails/actionview/test/fixtures/test/list.erb +1 -0
- data/rails/actionview/test/fixtures/test/malformed/malformed.en.html.erb~ +1 -0
- data/rails/actionview/test/fixtures/test/malformed/malformed.erb~ +1 -0
- data/rails/actionview/test/fixtures/test/malformed/malformed.html.erb~ +1 -0
- data/rails/actionview/test/fixtures/test/malformed/malformed~ +1 -0
- data/rails/actionview/test/fixtures/test/nested_layout.erb +3 -0
- data/rails/actionview/test/fixtures/test/nested_streaming.erb +3 -0
- data/rails/actionview/test/fixtures/test/nil_return.erb +1 -0
- data/rails/actionview/test/fixtures/test/one.html.erb +1 -0
- data/rails/actionview/test/fixtures/test/render_file_with_ivar.erb +1 -0
- data/rails/actionview/test/fixtures/test/render_file_with_locals.erb +1 -0
- data/rails/actionview/test/fixtures/test/render_file_with_locals_and_default.erb +1 -0
- data/rails/actionview/test/fixtures/test/render_partial_inside_directory.html.erb +1 -0
- data/rails/actionview/test/fixtures/test/render_two_partials.html.erb +2 -0
- data/rails/actionview/test/fixtures/test/streaming.erb +3 -0
- data/rails/actionview/test/fixtures/test/streaming_buster.erb +3 -0
- data/rails/actionview/test/fixtures/test/sub_template_raise.html.erb +1 -0
- data/rails/actionview/test/fixtures/test/template.erb +1 -0
- data/rails/actionview/test/fixtures/test/update_element_with_capture.erb +9 -0
- data/rails/actionview/test/fixtures/test/utf8.html.erb +4 -0
- data/rails/actionview/test/fixtures/test/utf8_magic.html.erb +5 -0
- data/rails/actionview/test/fixtures/test/utf8_magic_with_bare_partial.html.erb +5 -0
- data/rails/actionview/test/fixtures/topic.rb +3 -0
- data/rails/actionview/test/fixtures/topics/_topic.html.erb +1 -0
- data/rails/actionview/test/fixtures/topics.yml +22 -0
- data/rails/actionview/test/fixtures/translations/templates/array.erb +1 -0
- data/rails/actionview/test/fixtures/translations/templates/default.erb +1 -0
- data/rails/actionview/test/fixtures/translations/templates/found.erb +1 -0
- data/rails/actionview/test/fixtures/translations/templates/missing.erb +1 -0
- data/rails/actionview/test/fixtures/with_format.json.erb +1 -0
- data/rails/actionview/test/lib/controller/fake_models.rb +201 -0
- data/rails/actionview/test/template/active_model_helper_test.rb +99 -0
- data/rails/actionview/test/template/asset_tag_helper_test.rb +796 -0
- data/rails/actionview/test/template/atom_feed_helper_test.rb +349 -0
- data/rails/actionview/test/template/capture_helper_test.rb +219 -0
- data/rails/actionview/test/template/compiled_templates_test.rb +59 -0
- data/rails/actionview/test/template/date_helper_i18n_test.rb +148 -0
- data/rails/actionview/test/template/date_helper_test.rb +3228 -0
- data/rails/actionview/test/template/dependency_tracker_test.rb +196 -0
- data/rails/actionview/test/template/digestor_test.rb +312 -0
- data/rails/actionview/test/template/erb/form_for_test.rb +11 -0
- data/rails/actionview/test/template/erb/helper.rb +24 -0
- data/rails/actionview/test/template/erb/tag_helper_test.rb +30 -0
- data/rails/actionview/test/template/erb_util_test.rb +107 -0
- data/rails/actionview/test/template/form_collections_helper_test.rb +459 -0
- data/rails/actionview/test/template/form_helper_test.rb +3461 -0
- data/rails/actionview/test/template/form_options_helper_i18n_test.rb +27 -0
- data/rails/actionview/test/template/form_options_helper_test.rb +1358 -0
- data/rails/actionview/test/template/form_tag_helper_test.rb +656 -0
- data/rails/actionview/test/template/html_test.rb +17 -0
- data/rails/actionview/test/template/javascript_helper_test.rb +69 -0
- data/rails/actionview/test/template/log_subscriber_test.rb +91 -0
- data/rails/actionview/test/template/lookup_context_test.rb +282 -0
- data/rails/actionview/test/template/number_helper_test.rb +197 -0
- data/rails/actionview/test/template/output_safety_helper_test.rb +35 -0
- data/rails/actionview/test/template/partial_iteration_test.rb +33 -0
- data/rails/actionview/test/template/record_identifier_test.rb +49 -0
- data/rails/actionview/test/template/record_tag_helper_test.rb +117 -0
- data/rails/actionview/test/template/render_test.rb +600 -0
- data/rails/actionview/test/template/resolver_patterns_test.rb +31 -0
- data/rails/actionview/test/template/sanitize_helper_test.rb +35 -0
- data/rails/actionview/test/template/streaming_render_test.rb +108 -0
- data/rails/actionview/test/template/tag_helper_test.rb +166 -0
- data/rails/actionview/test/template/template_error_test.rb +20 -0
- data/rails/actionview/test/template/template_test.rb +200 -0
- data/rails/actionview/test/template/test_case_test.rb +378 -0
- data/rails/actionview/test/template/test_test.rb +92 -0
- data/rails/actionview/test/template/testing/fixture_resolver_test.rb +18 -0
- data/rails/actionview/test/template/testing/null_resolver_test.rb +12 -0
- data/rails/actionview/test/template/text_helper_test.rb +510 -0
- data/rails/actionview/test/template/text_test.rb +17 -0
- data/rails/actionview/test/template/translation_helper_test.rb +193 -0
- data/rails/actionview/test/template/url_helper_test.rb +798 -0
- data/rails/actionview/test/tmp/.gitkeep +0 -0
- data/rails/activejob/.gitignore +1 -0
- data/rails/activejob/CHANGELOG.md +7 -0
- data/rails/activejob/MIT-LICENSE +21 -0
- data/rails/activejob/README.md +131 -0
- data/rails/activejob/Rakefile +90 -0
- data/rails/activejob/activejob.gemspec +23 -0
- data/rails/activejob/lib/active_job/arguments.rb +144 -0
- data/rails/activejob/lib/active_job/base.rb +66 -0
- data/rails/activejob/lib/active_job/callbacks.rb +146 -0
- data/rails/activejob/lib/active_job/configured_job.rb +16 -0
- data/rails/activejob/lib/active_job/core.rb +88 -0
- data/rails/activejob/lib/active_job/enqueuing.rb +77 -0
- data/rails/activejob/lib/active_job/execution.rb +42 -0
- data/rails/activejob/lib/active_job/gem_version.rb +15 -0
- data/rails/activejob/lib/active_job/logging.rb +107 -0
- data/rails/activejob/lib/active_job/queue_adapter.rb +35 -0
- data/rails/activejob/lib/active_job/queue_adapters/backburner_adapter.rb +36 -0
- data/rails/activejob/lib/active_job/queue_adapters/delayed_job_adapter.rb +39 -0
- data/rails/activejob/lib/active_job/queue_adapters/inline_adapter.rb +23 -0
- data/rails/activejob/lib/active_job/queue_adapters/qu_adapter.rb +42 -0
- data/rails/activejob/lib/active_job/queue_adapters/que_adapter.rb +35 -0
- data/rails/activejob/lib/active_job/queue_adapters/queue_classic_adapter.rb +54 -0
- data/rails/activejob/lib/active_job/queue_adapters/resque_adapter.rb +52 -0
- data/rails/activejob/lib/active_job/queue_adapters/sidekiq_adapter.rb +45 -0
- data/rails/activejob/lib/active_job/queue_adapters/sneakers_adapter.rb +46 -0
- data/rails/activejob/lib/active_job/queue_adapters/sucker_punch_adapter.rb +40 -0
- data/rails/activejob/lib/active_job/queue_adapters/test_adapter.rb +51 -0
- data/rails/activejob/lib/active_job/queue_adapters.rb +52 -0
- data/rails/activejob/lib/active_job/queue_name.rb +51 -0
- data/rails/activejob/lib/active_job/railtie.rb +23 -0
- data/rails/activejob/lib/active_job/test_case.rb +7 -0
- data/rails/activejob/lib/active_job/test_helper.rb +230 -0
- data/rails/activejob/lib/active_job/version.rb +8 -0
- data/rails/activejob/lib/active_job.rb +37 -0
- data/rails/activejob/lib/rails/generators/job/job_generator.rb +24 -0
- data/rails/activejob/lib/rails/generators/job/templates/job.rb +9 -0
- data/rails/activejob/test/adapters/backburner.rb +3 -0
- data/rails/activejob/test/adapters/delayed_job.rb +7 -0
- data/rails/activejob/test/adapters/inline.rb +1 -0
- data/rails/activejob/test/adapters/qu.rb +3 -0
- data/rails/activejob/test/adapters/que.rb +4 -0
- data/rails/activejob/test/adapters/queue_classic.rb +2 -0
- data/rails/activejob/test/adapters/resque.rb +2 -0
- data/rails/activejob/test/adapters/sidekiq.rb +2 -0
- data/rails/activejob/test/adapters/sneakers.rb +2 -0
- data/rails/activejob/test/adapters/sucker_punch.rb +2 -0
- data/rails/activejob/test/adapters/test.rb +3 -0
- data/rails/activejob/test/cases/adapter_test.rb +7 -0
- data/rails/activejob/test/cases/argument_serialization_test.rb +105 -0
- data/rails/activejob/test/cases/callbacks_test.rb +23 -0
- data/rails/activejob/test/cases/job_serialization_test.rb +15 -0
- data/rails/activejob/test/cases/logging_test.rb +114 -0
- data/rails/activejob/test/cases/queue_naming_test.rb +102 -0
- data/rails/activejob/test/cases/queuing_test.rb +44 -0
- data/rails/activejob/test/cases/rescue_test.rb +34 -0
- data/rails/activejob/test/cases/test_case_test.rb +14 -0
- data/rails/activejob/test/cases/test_helper_test.rb +265 -0
- data/rails/activejob/test/helper.rb +30 -0
- data/rails/activejob/test/integration/queuing_test.rb +47 -0
- data/rails/activejob/test/jobs/callback_job.rb +29 -0
- data/rails/activejob/test/jobs/gid_job.rb +8 -0
- data/rails/activejob/test/jobs/hello_job.rb +7 -0
- data/rails/activejob/test/jobs/kwargs_job.rb +7 -0
- data/rails/activejob/test/jobs/logging_job.rb +10 -0
- data/rails/activejob/test/jobs/nested_job.rb +10 -0
- data/rails/activejob/test/jobs/rescue_job.rb +27 -0
- data/rails/activejob/test/models/person.rb +20 -0
- data/rails/activejob/test/support/backburner/inline.rb +8 -0
- data/rails/activejob/test/support/delayed_job/delayed/backend/test.rb +113 -0
- data/rails/activejob/test/support/delayed_job/delayed/serialization/test.rb +0 -0
- data/rails/activejob/test/support/integration/adapters/backburner.rb +38 -0
- data/rails/activejob/test/support/integration/adapters/delayed_job.rb +20 -0
- data/rails/activejob/test/support/integration/adapters/inline.rb +15 -0
- data/rails/activejob/test/support/integration/adapters/qu.rb +38 -0
- data/rails/activejob/test/support/integration/adapters/que.rb +37 -0
- data/rails/activejob/test/support/integration/adapters/queue_classic.rb +39 -0
- data/rails/activejob/test/support/integration/adapters/resque.rb +49 -0
- data/rails/activejob/test/support/integration/adapters/sidekiq.rb +57 -0
- data/rails/activejob/test/support/integration/adapters/sneakers.rb +90 -0
- data/rails/activejob/test/support/integration/adapters/sucker_punch.rb +6 -0
- data/rails/activejob/test/support/integration/dummy_app_template.rb +27 -0
- data/rails/activejob/test/support/integration/helper.rb +30 -0
- data/rails/activejob/test/support/integration/jobs_manager.rb +27 -0
- data/rails/activejob/test/support/integration/test_case_helpers.rb +48 -0
- data/rails/activejob/test/support/job_buffer.rb +19 -0
- data/rails/activejob/test/support/que/inline.rb +9 -0
- data/rails/activejob/test/support/queue_classic/inline.rb +23 -0
- data/rails/activejob/test/support/sneakers/inline.rb +12 -0
- data/rails/activemodel/CHANGELOG.md +61 -0
- data/rails/activemodel/MIT-LICENSE +21 -0
- data/rails/activemodel/README.rdoc +272 -0
- data/rails/activemodel/Rakefile +36 -0
- data/rails/activemodel/activemodel.gemspec +24 -0
- data/rails/activemodel/lib/active_model/attribute_methods.rb +478 -0
- data/rails/activemodel/lib/active_model/callbacks.rb +149 -0
- data/rails/activemodel/lib/active_model/conversion.rb +100 -0
- data/rails/activemodel/lib/active_model/dirty.rb +267 -0
- data/rails/activemodel/lib/active_model/errors.rb +475 -0
- data/rails/activemodel/lib/active_model/forbidden_attributes_protection.rb +28 -0
- data/rails/activemodel/lib/active_model/gem_version.rb +15 -0
- data/rails/activemodel/lib/active_model/lint.rb +113 -0
- data/rails/activemodel/lib/active_model/locale/en.yml +35 -0
- data/rails/activemodel/lib/active_model/model.rb +99 -0
- data/rails/activemodel/lib/active_model/naming.rb +316 -0
- data/rails/activemodel/lib/active_model/railtie.rb +12 -0
- data/rails/activemodel/lib/active_model/secure_password.rb +134 -0
- data/rails/activemodel/lib/active_model/serialization.rb +163 -0
- data/rails/activemodel/lib/active_model/serializers/json.rb +145 -0
- data/rails/activemodel/lib/active_model/serializers/xml.rb +238 -0
- data/rails/activemodel/lib/active_model/test_case.rb +4 -0
- data/rails/activemodel/lib/active_model/translation.rb +69 -0
- data/rails/activemodel/lib/active_model/validations/absence.rb +31 -0
- data/rails/activemodel/lib/active_model/validations/acceptance.rb +55 -0
- data/rails/activemodel/lib/active_model/validations/callbacks.rb +117 -0
- data/rails/activemodel/lib/active_model/validations/clusivity.rb +51 -0
- data/rails/activemodel/lib/active_model/validations/confirmation.rb +67 -0
- data/rails/activemodel/lib/active_model/validations/exclusion.rb +46 -0
- data/rails/activemodel/lib/active_model/validations/format.rb +113 -0
- data/rails/activemodel/lib/active_model/validations/inclusion.rb +46 -0
- data/rails/activemodel/lib/active_model/validations/length.rb +126 -0
- data/rails/activemodel/lib/active_model/validations/numericality.rb +159 -0
- data/rails/activemodel/lib/active_model/validations/presence.rb +39 -0
- data/rails/activemodel/lib/active_model/validations/validates.rb +173 -0
- data/rails/activemodel/lib/active_model/validations/with.rb +153 -0
- data/rails/activemodel/lib/active_model/validations.rb +401 -0
- data/rails/activemodel/lib/active_model/validator.rb +182 -0
- data/rails/activemodel/lib/active_model/version.rb +8 -0
- data/rails/activemodel/lib/active_model.rb +71 -0
- data/rails/activemodel/test/cases/attribute_methods_test.rb +281 -0
- data/rails/activemodel/test/cases/callbacks_test.rb +114 -0
- data/rails/activemodel/test/cases/conversion_test.rb +50 -0
- data/rails/activemodel/test/cases/dirty_test.rb +228 -0
- data/rails/activemodel/test/cases/errors_test.rb +326 -0
- data/rails/activemodel/test/cases/forbidden_attributes_protection_test.rb +36 -0
- data/rails/activemodel/test/cases/helper.rb +20 -0
- data/rails/activemodel/test/cases/lint_test.rb +20 -0
- data/rails/activemodel/test/cases/model_test.rb +75 -0
- data/rails/activemodel/test/cases/naming_test.rb +280 -0
- data/rails/activemodel/test/cases/railtie_test.rb +32 -0
- data/rails/activemodel/test/cases/secure_password_test.rb +218 -0
- data/rails/activemodel/test/cases/serialization_test.rb +168 -0
- data/rails/activemodel/test/cases/serializers/json_serialization_test.rb +198 -0
- data/rails/activemodel/test/cases/serializers/xml_serialization_test.rb +250 -0
- data/rails/activemodel/test/cases/translation_test.rb +108 -0
- data/rails/activemodel/test/cases/validations/absence_validation_test.rb +68 -0
- data/rails/activemodel/test/cases/validations/acceptance_validation_test.rb +68 -0
- data/rails/activemodel/test/cases/validations/callbacks_test.rb +98 -0
- data/rails/activemodel/test/cases/validations/conditional_validation_test.rb +139 -0
- data/rails/activemodel/test/cases/validations/confirmation_validation_test.rb +108 -0
- data/rails/activemodel/test/cases/validations/exclusion_validation_test.rb +92 -0
- data/rails/activemodel/test/cases/validations/format_validation_test.rb +149 -0
- data/rails/activemodel/test/cases/validations/i18n_generate_message_validation_test.rb +150 -0
- data/rails/activemodel/test/cases/validations/i18n_validation_test.rb +373 -0
- data/rails/activemodel/test/cases/validations/inclusion_validation_test.rb +147 -0
- data/rails/activemodel/test/cases/validations/length_validation_test.rb +424 -0
- data/rails/activemodel/test/cases/validations/numericality_validation_test.rb +211 -0
- data/rails/activemodel/test/cases/validations/presence_validation_test.rb +107 -0
- data/rails/activemodel/test/cases/validations/validates_test.rb +158 -0
- data/rails/activemodel/test/cases/validations/validations_context_test.rb +50 -0
- data/rails/activemodel/test/cases/validations/with_validation_test.rb +172 -0
- data/rails/activemodel/test/cases/validations_test.rb +429 -0
- data/rails/activemodel/test/config.rb +3 -0
- data/rails/activemodel/test/models/account.rb +5 -0
- data/rails/activemodel/test/models/blog_post.rb +9 -0
- data/rails/activemodel/test/models/contact.rb +41 -0
- data/rails/activemodel/test/models/custom_reader.rb +15 -0
- data/rails/activemodel/test/models/helicopter.rb +7 -0
- data/rails/activemodel/test/models/person.rb +17 -0
- data/rails/activemodel/test/models/person_with_validator.rb +24 -0
- data/rails/activemodel/test/models/project.rb +3 -0
- data/rails/activemodel/test/models/reply.rb +32 -0
- data/rails/activemodel/test/models/sheep.rb +3 -0
- data/rails/activemodel/test/models/topic.rb +40 -0
- data/rails/activemodel/test/models/track_back.rb +11 -0
- data/rails/activemodel/test/models/user.rb +10 -0
- data/rails/activemodel/test/models/visitor.rb +10 -0
- data/rails/activemodel/test/validators/email_validator.rb +6 -0
- data/rails/activemodel/test/validators/namespace/email_validator.rb +6 -0
- data/rails/activerecord/CHANGELOG.md +1568 -0
- data/rails/activerecord/MIT-LICENSE +20 -0
- data/rails/activerecord/README.rdoc +218 -0
- data/rails/activerecord/RUNNING_UNIT_TESTS.rdoc +44 -0
- data/rails/activerecord/Rakefile +168 -0
- data/rails/activerecord/activerecord.gemspec +28 -0
- data/rails/activerecord/examples/.gitignore +1 -0
- data/rails/activerecord/examples/performance.rb +184 -0
- data/rails/activerecord/examples/simple.rb +14 -0
- data/rails/activerecord/lib/active_record/aggregations.rb +266 -0
- data/rails/activerecord/lib/active_record/association_relation.rb +22 -0
- data/rails/activerecord/lib/active_record/associations/alias_tracker.rb +87 -0
- data/rails/activerecord/lib/active_record/associations/association.rb +253 -0
- data/rails/activerecord/lib/active_record/associations/association_scope.rb +194 -0
- data/rails/activerecord/lib/active_record/associations/belongs_to_association.rb +115 -0
- data/rails/activerecord/lib/active_record/associations/belongs_to_polymorphic_association.rb +40 -0
- data/rails/activerecord/lib/active_record/associations/builder/association.rb +149 -0
- data/rails/activerecord/lib/active_record/associations/builder/belongs_to.rb +116 -0
- data/rails/activerecord/lib/active_record/associations/builder/collection_association.rb +95 -0
- data/rails/activerecord/lib/active_record/associations/builder/has_and_belongs_to_many.rb +124 -0
- data/rails/activerecord/lib/active_record/associations/builder/has_many.rb +15 -0
- data/rails/activerecord/lib/active_record/associations/builder/has_one.rb +23 -0
- data/rails/activerecord/lib/active_record/associations/builder/singular_association.rb +38 -0
- data/rails/activerecord/lib/active_record/associations/collection_association.rb +639 -0
- data/rails/activerecord/lib/active_record/associations/collection_proxy.rb +1028 -0
- data/rails/activerecord/lib/active_record/associations/foreign_association.rb +11 -0
- data/rails/activerecord/lib/active_record/associations/has_many_association.rb +192 -0
- data/rails/activerecord/lib/active_record/associations/has_many_through_association.rb +238 -0
- data/rails/activerecord/lib/active_record/associations/has_one_association.rb +106 -0
- data/rails/activerecord/lib/active_record/associations/has_one_through_association.rb +36 -0
- data/rails/activerecord/lib/active_record/associations/join_dependency/join_association.rb +122 -0
- data/rails/activerecord/lib/active_record/associations/join_dependency/join_base.rb +22 -0
- data/rails/activerecord/lib/active_record/associations/join_dependency/join_part.rb +71 -0
- data/rails/activerecord/lib/active_record/associations/join_dependency.rb +282 -0
- data/rails/activerecord/lib/active_record/associations/preloader/association.rb +162 -0
- data/rails/activerecord/lib/active_record/associations/preloader/belongs_to.rb +17 -0
- data/rails/activerecord/lib/active_record/associations/preloader/collection_association.rb +24 -0
- data/rails/activerecord/lib/active_record/associations/preloader/has_many.rb +17 -0
- data/rails/activerecord/lib/active_record/associations/preloader/has_many_through.rb +19 -0
- data/rails/activerecord/lib/active_record/associations/preloader/has_one.rb +23 -0
- data/rails/activerecord/lib/active_record/associations/preloader/has_one_through.rb +9 -0
- data/rails/activerecord/lib/active_record/associations/preloader/singular_association.rb +21 -0
- data/rails/activerecord/lib/active_record/associations/preloader/through_association.rb +96 -0
- data/rails/activerecord/lib/active_record/associations/preloader.rb +203 -0
- data/rails/activerecord/lib/active_record/associations/singular_association.rb +86 -0
- data/rails/activerecord/lib/active_record/associations/through_association.rb +107 -0
- data/rails/activerecord/lib/active_record/associations.rb +1725 -0
- data/rails/activerecord/lib/active_record/attribute.rb +163 -0
- data/rails/activerecord/lib/active_record/attribute_assignment.rb +212 -0
- data/rails/activerecord/lib/active_record/attribute_decorators.rb +66 -0
- data/rails/activerecord/lib/active_record/attribute_methods/before_type_cast.rb +76 -0
- data/rails/activerecord/lib/active_record/attribute_methods/dirty.rb +185 -0
- data/rails/activerecord/lib/active_record/attribute_methods/primary_key.rb +128 -0
- data/rails/activerecord/lib/active_record/attribute_methods/query.rb +40 -0
- data/rails/activerecord/lib/active_record/attribute_methods/read.rb +103 -0
- data/rails/activerecord/lib/active_record/attribute_methods/serialization.rb +70 -0
- data/rails/activerecord/lib/active_record/attribute_methods/time_zone_conversion.rb +69 -0
- data/rails/activerecord/lib/active_record/attribute_methods/write.rb +83 -0
- data/rails/activerecord/lib/active_record/attribute_methods.rb +439 -0
- data/rails/activerecord/lib/active_record/attribute_set/builder.rb +96 -0
- data/rails/activerecord/lib/active_record/attribute_set.rb +77 -0
- data/rails/activerecord/lib/active_record/attributes.rb +146 -0
- data/rails/activerecord/lib/active_record/autosave_association.rb +454 -0
- data/rails/activerecord/lib/active_record/base.rb +317 -0
- data/rails/activerecord/lib/active_record/callbacks.rb +313 -0
- data/rails/activerecord/lib/active_record/coders/json.rb +13 -0
- data/rails/activerecord/lib/active_record/coders/yaml_column.rb +38 -0
- data/rails/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb +661 -0
- data/rails/activerecord/lib/active_record/connection_adapters/abstract/database_limits.rb +67 -0
- data/rails/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb +384 -0
- data/rails/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb +95 -0
- data/rails/activerecord/lib/active_record/connection_adapters/abstract/quoting.rb +133 -0
- data/rails/activerecord/lib/active_record/connection_adapters/abstract/savepoints.rb +21 -0
- data/rails/activerecord/lib/active_record/connection_adapters/abstract/schema_creation.rb +125 -0
- data/rails/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb +592 -0
- data/rails/activerecord/lib/active_record/connection_adapters/abstract/schema_dumper.rb +50 -0
- data/rails/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb +1023 -0
- data/rails/activerecord/lib/active_record/connection_adapters/abstract/transaction.rb +219 -0
- data/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb +494 -0
- data/rails/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb +905 -0
- data/rails/activerecord/lib/active_record/connection_adapters/column.rb +82 -0
- data/rails/activerecord/lib/active_record/connection_adapters/connection_specification.rb +275 -0
- data/rails/activerecord/lib/active_record/connection_adapters/mysql2_adapter.rb +282 -0
- data/rails/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb +491 -0
- data/rails/activerecord/lib/active_record/connection_adapters/postgresql/array_parser.rb +93 -0
- data/rails/activerecord/lib/active_record/connection_adapters/postgresql/column.rb +20 -0
- data/rails/activerecord/lib/active_record/connection_adapters/postgresql/database_statements.rb +232 -0
- data/rails/activerecord/lib/active_record/connection_adapters/postgresql/oid/array.rb +99 -0
- data/rails/activerecord/lib/active_record/connection_adapters/postgresql/oid/bit.rb +52 -0
- data/rails/activerecord/lib/active_record/connection_adapters/postgresql/oid/bit_varying.rb +13 -0
- data/rails/activerecord/lib/active_record/connection_adapters/postgresql/oid/bytea.rb +15 -0
- data/rails/activerecord/lib/active_record/connection_adapters/postgresql/oid/cidr.rb +46 -0
- data/rails/activerecord/lib/active_record/connection_adapters/postgresql/oid/date.rb +11 -0
- data/rails/activerecord/lib/active_record/connection_adapters/postgresql/oid/date_time.rb +36 -0
- data/rails/activerecord/lib/active_record/connection_adapters/postgresql/oid/decimal.rb +13 -0
- data/rails/activerecord/lib/active_record/connection_adapters/postgresql/oid/enum.rb +17 -0
- data/rails/activerecord/lib/active_record/connection_adapters/postgresql/oid/float.rb +21 -0
- data/rails/activerecord/lib/active_record/connection_adapters/postgresql/oid/hstore.rb +59 -0
- data/rails/activerecord/lib/active_record/connection_adapters/postgresql/oid/inet.rb +13 -0
- data/rails/activerecord/lib/active_record/connection_adapters/postgresql/oid/infinity.rb +13 -0
- data/rails/activerecord/lib/active_record/connection_adapters/postgresql/oid/integer.rb +11 -0
- data/rails/activerecord/lib/active_record/connection_adapters/postgresql/oid/json.rb +35 -0
- data/rails/activerecord/lib/active_record/connection_adapters/postgresql/oid/jsonb.rb +23 -0
- data/rails/activerecord/lib/active_record/connection_adapters/postgresql/oid/money.rb +43 -0
- data/rails/activerecord/lib/active_record/connection_adapters/postgresql/oid/point.rb +43 -0
- data/rails/activerecord/lib/active_record/connection_adapters/postgresql/oid/range.rb +79 -0
- data/rails/activerecord/lib/active_record/connection_adapters/postgresql/oid/specialized_string.rb +19 -0
- data/rails/activerecord/lib/active_record/connection_adapters/postgresql/oid/time.rb +11 -0
- data/rails/activerecord/lib/active_record/connection_adapters/postgresql/oid/type_map_initializer.rb +97 -0
- data/rails/activerecord/lib/active_record/connection_adapters/postgresql/oid/uuid.rb +21 -0
- data/rails/activerecord/lib/active_record/connection_adapters/postgresql/oid/vector.rb +26 -0
- data/rails/activerecord/lib/active_record/connection_adapters/postgresql/oid/xml.rb +28 -0
- data/rails/activerecord/lib/active_record/connection_adapters/postgresql/oid.rb +36 -0
- data/rails/activerecord/lib/active_record/connection_adapters/postgresql/quoting.rb +108 -0
- data/rails/activerecord/lib/active_record/connection_adapters/postgresql/referential_integrity.rb +30 -0
- data/rails/activerecord/lib/active_record/connection_adapters/postgresql/schema_definitions.rb +152 -0
- data/rails/activerecord/lib/active_record/connection_adapters/postgresql/schema_statements.rb +587 -0
- data/rails/activerecord/lib/active_record/connection_adapters/postgresql/utils.rb +77 -0
- data/rails/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb +754 -0
- data/rails/activerecord/lib/active_record/connection_adapters/schema_cache.rb +94 -0
- data/rails/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb +622 -0
- data/rails/activerecord/lib/active_record/connection_adapters/statement_pool.rb +40 -0
- data/rails/activerecord/lib/active_record/connection_handling.rb +132 -0
- data/rails/activerecord/lib/active_record/core.rb +572 -0
- data/rails/activerecord/lib/active_record/counter_cache.rb +175 -0
- data/rails/activerecord/lib/active_record/dynamic_matchers.rb +140 -0
- data/rails/activerecord/lib/active_record/enum.rb +198 -0
- data/rails/activerecord/lib/active_record/errors.rb +252 -0
- data/rails/activerecord/lib/active_record/explain.rb +38 -0
- data/rails/activerecord/lib/active_record/explain_registry.rb +30 -0
- data/rails/activerecord/lib/active_record/explain_subscriber.rb +29 -0
- data/rails/activerecord/lib/active_record/fixture_set/file.rb +56 -0
- data/rails/activerecord/lib/active_record/fixtures.rb +1007 -0
- data/rails/activerecord/lib/active_record/gem_version.rb +15 -0
- data/rails/activerecord/lib/active_record/inheritance.rb +247 -0
- data/rails/activerecord/lib/active_record/integration.rb +113 -0
- data/rails/activerecord/lib/active_record/locale/en.yml +47 -0
- data/rails/activerecord/lib/active_record/locking/optimistic.rb +206 -0
- data/rails/activerecord/lib/active_record/locking/pessimistic.rb +77 -0
- data/rails/activerecord/lib/active_record/log_subscriber.rb +75 -0
- data/rails/activerecord/lib/active_record/migration/command_recorder.rb +197 -0
- data/rails/activerecord/lib/active_record/migration/join_table.rb +15 -0
- data/rails/activerecord/lib/active_record/migration.rb +1051 -0
- data/rails/activerecord/lib/active_record/model_schema.rb +340 -0
- data/rails/activerecord/lib/active_record/nested_attributes.rb +548 -0
- data/rails/activerecord/lib/active_record/no_touching.rb +52 -0
- data/rails/activerecord/lib/active_record/null_relation.rb +81 -0
- data/rails/activerecord/lib/active_record/persistence.rb +532 -0
- data/rails/activerecord/lib/active_record/query_cache.rb +56 -0
- data/rails/activerecord/lib/active_record/querying.rb +68 -0
- data/rails/activerecord/lib/active_record/railtie.rb +162 -0
- data/rails/activerecord/lib/active_record/railties/console_sandbox.rb +5 -0
- data/rails/activerecord/lib/active_record/railties/controller_runtime.rb +50 -0
- data/rails/activerecord/lib/active_record/railties/databases.rake +391 -0
- data/rails/activerecord/lib/active_record/railties/jdbcmysql_error.rb +16 -0
- data/rails/activerecord/lib/active_record/readonly_attributes.rb +23 -0
- data/rails/activerecord/lib/active_record/reflection.rb +881 -0
- data/rails/activerecord/lib/active_record/relation/batches.rb +138 -0
- data/rails/activerecord/lib/active_record/relation/calculations.rb +403 -0
- data/rails/activerecord/lib/active_record/relation/delegation.rb +140 -0
- data/rails/activerecord/lib/active_record/relation/finder_methods.rb +528 -0
- data/rails/activerecord/lib/active_record/relation/merger.rb +170 -0
- data/rails/activerecord/lib/active_record/relation/predicate_builder/array_handler.rb +47 -0
- data/rails/activerecord/lib/active_record/relation/predicate_builder/relation_handler.rb +13 -0
- data/rails/activerecord/lib/active_record/relation/predicate_builder.rb +141 -0
- data/rails/activerecord/lib/active_record/relation/query_methods.rb +1177 -0
- data/rails/activerecord/lib/active_record/relation/spawn_methods.rb +75 -0
- data/rails/activerecord/lib/active_record/relation.rb +681 -0
- data/rails/activerecord/lib/active_record/result.rb +131 -0
- data/rails/activerecord/lib/active_record/runtime_registry.rb +22 -0
- data/rails/activerecord/lib/active_record/sanitization.rb +191 -0
- data/rails/activerecord/lib/active_record/schema.rb +64 -0
- data/rails/activerecord/lib/active_record/schema_dumper.rb +251 -0
- data/rails/activerecord/lib/active_record/schema_migration.rb +56 -0
- data/rails/activerecord/lib/active_record/scoping/default.rb +134 -0
- data/rails/activerecord/lib/active_record/scoping/named.rb +164 -0
- data/rails/activerecord/lib/active_record/scoping.rb +87 -0
- data/rails/activerecord/lib/active_record/serialization.rb +22 -0
- data/rails/activerecord/lib/active_record/serializers/xml_serializer.rb +193 -0
- data/rails/activerecord/lib/active_record/statement_cache.rb +111 -0
- data/rails/activerecord/lib/active_record/store.rb +205 -0
- data/rails/activerecord/lib/active_record/tasks/database_tasks.rb +296 -0
- data/rails/activerecord/lib/active_record/tasks/mysql_database_tasks.rb +145 -0
- data/rails/activerecord/lib/active_record/tasks/postgresql_database_tasks.rb +90 -0
- data/rails/activerecord/lib/active_record/tasks/sqlite_database_tasks.rb +55 -0
- data/rails/activerecord/lib/active_record/timestamp.rb +121 -0
- data/rails/activerecord/lib/active_record/transactions.rb +415 -0
- data/rails/activerecord/lib/active_record/translation.rb +22 -0
- data/rails/activerecord/lib/active_record/type/big_integer.rb +13 -0
- data/rails/activerecord/lib/active_record/type/binary.rb +50 -0
- data/rails/activerecord/lib/active_record/type/boolean.rb +30 -0
- data/rails/activerecord/lib/active_record/type/date.rb +46 -0
- data/rails/activerecord/lib/active_record/type/date_time.rb +54 -0
- data/rails/activerecord/lib/active_record/type/decimal.rb +48 -0
- data/rails/activerecord/lib/active_record/type/decimal_without_scale.rb +11 -0
- data/rails/activerecord/lib/active_record/type/decorator.rb +14 -0
- data/rails/activerecord/lib/active_record/type/float.rb +19 -0
- data/rails/activerecord/lib/active_record/type/hash_lookup_type_map.rb +17 -0
- data/rails/activerecord/lib/active_record/type/integer.rb +59 -0
- data/rails/activerecord/lib/active_record/type/mutable.rb +16 -0
- data/rails/activerecord/lib/active_record/type/numeric.rb +36 -0
- data/rails/activerecord/lib/active_record/type/serialized.rb +56 -0
- data/rails/activerecord/lib/active_record/type/string.rb +40 -0
- data/rails/activerecord/lib/active_record/type/text.rb +11 -0
- data/rails/activerecord/lib/active_record/type/time.rb +26 -0
- data/rails/activerecord/lib/active_record/type/time_value.rb +38 -0
- data/rails/activerecord/lib/active_record/type/type_map.rb +64 -0
- data/rails/activerecord/lib/active_record/type/unsigned_integer.rb +15 -0
- data/rails/activerecord/lib/active_record/type/value.rb +105 -0
- data/rails/activerecord/lib/active_record/type.rb +23 -0
- data/rails/activerecord/lib/active_record/validations/associated.rb +51 -0
- data/rails/activerecord/lib/active_record/validations/presence.rb +67 -0
- data/rails/activerecord/lib/active_record/validations/uniqueness.rb +229 -0
- data/rails/activerecord/lib/active_record/validations.rb +90 -0
- data/rails/activerecord/lib/active_record/version.rb +8 -0
- data/rails/activerecord/lib/active_record.rb +173 -0
- data/rails/activerecord/lib/rails/generators/active_record/migration/migration_generator.rb +70 -0
- data/rails/activerecord/lib/rails/generators/active_record/migration/templates/create_table_migration.rb +19 -0
- data/rails/activerecord/lib/rails/generators/active_record/migration/templates/migration.rb +39 -0
- data/rails/activerecord/lib/rails/generators/active_record/migration.rb +18 -0
- data/rails/activerecord/lib/rails/generators/active_record/model/model_generator.rb +52 -0
- data/rails/activerecord/lib/rails/generators/active_record/model/templates/model.rb +10 -0
- data/rails/activerecord/lib/rails/generators/active_record/model/templates/module.rb +7 -0
- data/rails/activerecord/lib/rails/generators/active_record.rb +17 -0
- data/rails/activerecord/test/.gitignore +1 -0
- data/rails/activerecord/test/active_record/connection_adapters/fake_adapter.rb +46 -0
- data/rails/activerecord/test/assets/example.log +1 -0
- data/rails/activerecord/test/assets/flowers.jpg +0 -0
- data/rails/activerecord/test/assets/test.txt +1 -0
- data/rails/activerecord/test/cases/adapter_test.rb +261 -0
- data/rails/activerecord/test/cases/adapters/mysql/active_schema_test.rb +155 -0
- data/rails/activerecord/test/cases/adapters/mysql/case_sensitivity_test.rb +55 -0
- data/rails/activerecord/test/cases/adapters/mysql/connection_test.rb +184 -0
- data/rails/activerecord/test/cases/adapters/mysql/consistency_test.rb +49 -0
- data/rails/activerecord/test/cases/adapters/mysql/datetime_test.rb +87 -0
- data/rails/activerecord/test/cases/adapters/mysql/enum_test.rb +10 -0
- data/rails/activerecord/test/cases/adapters/mysql/mysql_adapter_test.rb +153 -0
- data/rails/activerecord/test/cases/adapters/mysql/quoting_test.rb +25 -0
- data/rails/activerecord/test/cases/adapters/mysql/reserved_word_test.rb +153 -0
- data/rails/activerecord/test/cases/adapters/mysql/schema_test.rb +100 -0
- data/rails/activerecord/test/cases/adapters/mysql/sp_test.rb +15 -0
- data/rails/activerecord/test/cases/adapters/mysql/sql_types_test.rb +14 -0
- data/rails/activerecord/test/cases/adapters/mysql/statement_pool_test.rb +23 -0
- data/rails/activerecord/test/cases/adapters/mysql/unsigned_type_test.rb +30 -0
- data/rails/activerecord/test/cases/adapters/mysql2/active_schema_test.rb +155 -0
- data/rails/activerecord/test/cases/adapters/mysql2/bind_parameter_test.rb +50 -0
- data/rails/activerecord/test/cases/adapters/mysql2/boolean_test.rb +92 -0
- data/rails/activerecord/test/cases/adapters/mysql2/case_sensitivity_test.rb +55 -0
- data/rails/activerecord/test/cases/adapters/mysql2/connection_test.rb +134 -0
- data/rails/activerecord/test/cases/adapters/mysql2/datetime_test.rb +87 -0
- data/rails/activerecord/test/cases/adapters/mysql2/enum_test.rb +10 -0
- data/rails/activerecord/test/cases/adapters/mysql2/explain_test.rb +27 -0
- data/rails/activerecord/test/cases/adapters/mysql2/reserved_word_test.rb +152 -0
- data/rails/activerecord/test/cases/adapters/mysql2/schema_migrations_test.rb +47 -0
- data/rails/activerecord/test/cases/adapters/mysql2/schema_test.rb +81 -0
- data/rails/activerecord/test/cases/adapters/mysql2/sql_types_test.rb +14 -0
- data/rails/activerecord/test/cases/adapters/mysql2/unsigned_type_test.rb +30 -0
- data/rails/activerecord/test/cases/adapters/postgresql/active_schema_test.rb +58 -0
- data/rails/activerecord/test/cases/adapters/postgresql/array_test.rb +295 -0
- data/rails/activerecord/test/cases/adapters/postgresql/bit_string_test.rb +78 -0
- data/rails/activerecord/test/cases/adapters/postgresql/bytea_test.rb +125 -0
- data/rails/activerecord/test/cases/adapters/postgresql/change_schema_test.rb +31 -0
- data/rails/activerecord/test/cases/adapters/postgresql/citext_test.rb +71 -0
- data/rails/activerecord/test/cases/adapters/postgresql/composite_test.rb +131 -0
- data/rails/activerecord/test/cases/adapters/postgresql/connection_test.rb +215 -0
- data/rails/activerecord/test/cases/adapters/postgresql/datatype_test.rb +126 -0
- data/rails/activerecord/test/cases/adapters/postgresql/domain_test.rb +47 -0
- data/rails/activerecord/test/cases/adapters/postgresql/enum_test.rb +83 -0
- data/rails/activerecord/test/cases/adapters/postgresql/explain_test.rb +26 -0
- data/rails/activerecord/test/cases/adapters/postgresql/extension_migration_test.rb +63 -0
- data/rails/activerecord/test/cases/adapters/postgresql/full_text_test.rb +26 -0
- data/rails/activerecord/test/cases/adapters/postgresql/geometric_test.rb +72 -0
- data/rails/activerecord/test/cases/adapters/postgresql/hstore_test.rb +345 -0
- data/rails/activerecord/test/cases/adapters/postgresql/infinity_test.rb +60 -0
- data/rails/activerecord/test/cases/adapters/postgresql/integer_test.rb +25 -0
- data/rails/activerecord/test/cases/adapters/postgresql/json_test.rb +206 -0
- data/rails/activerecord/test/cases/adapters/postgresql/ltree_test.rb +46 -0
- data/rails/activerecord/test/cases/adapters/postgresql/money_test.rb +96 -0
- data/rails/activerecord/test/cases/adapters/postgresql/network_test.rb +71 -0
- data/rails/activerecord/test/cases/adapters/postgresql/postgresql_adapter_test.rb +462 -0
- data/rails/activerecord/test/cases/adapters/postgresql/quoting_test.rb +74 -0
- data/rails/activerecord/test/cases/adapters/postgresql/range_test.rb +323 -0
- data/rails/activerecord/test/cases/adapters/postgresql/rename_table_test.rb +34 -0
- data/rails/activerecord/test/cases/adapters/postgresql/schema_authorization_test.rb +114 -0
- data/rails/activerecord/test/cases/adapters/postgresql/schema_test.rb +462 -0
- data/rails/activerecord/test/cases/adapters/postgresql/statement_pool_test.rb +41 -0
- data/rails/activerecord/test/cases/adapters/postgresql/timestamp_test.rb +170 -0
- data/rails/activerecord/test/cases/adapters/postgresql/type_lookup_test.rb +33 -0
- data/rails/activerecord/test/cases/adapters/postgresql/utils_test.rb +61 -0
- data/rails/activerecord/test/cases/adapters/postgresql/uuid_test.rb +315 -0
- data/rails/activerecord/test/cases/adapters/postgresql/view_test.rb +63 -0
- data/rails/activerecord/test/cases/adapters/postgresql/xml_test.rb +48 -0
- data/rails/activerecord/test/cases/adapters/sqlite3/copy_table_test.rb +98 -0
- data/rails/activerecord/test/cases/adapters/sqlite3/explain_test.rb +27 -0
- data/rails/activerecord/test/cases/adapters/sqlite3/quoting_test.rb +116 -0
- data/rails/activerecord/test/cases/adapters/sqlite3/sqlite3_adapter_test.rb +461 -0
- data/rails/activerecord/test/cases/adapters/sqlite3/sqlite3_create_folder_test.rb +21 -0
- data/rails/activerecord/test/cases/adapters/sqlite3/statement_pool_test.rb +25 -0
- data/rails/activerecord/test/cases/aggregations_test.rb +158 -0
- data/rails/activerecord/test/cases/ar_schema_test.rb +161 -0
- data/rails/activerecord/test/cases/associations/association_scope_test.rb +21 -0
- data/rails/activerecord/test/cases/associations/belongs_to_associations_test.rb +978 -0
- data/rails/activerecord/test/cases/associations/callbacks_test.rb +190 -0
- data/rails/activerecord/test/cases/associations/cascaded_eager_loading_test.rb +188 -0
- data/rails/activerecord/test/cases/associations/deprecated_counter_cache_on_has_many_through_test.rb +26 -0
- data/rails/activerecord/test/cases/associations/eager_load_includes_full_sti_class_test.rb +36 -0
- data/rails/activerecord/test/cases/associations/eager_load_nested_include_test.rb +128 -0
- data/rails/activerecord/test/cases/associations/eager_singularization_test.rb +148 -0
- data/rails/activerecord/test/cases/associations/eager_test.rb +1366 -0
- data/rails/activerecord/test/cases/associations/extension_test.rb +82 -0
- data/rails/activerecord/test/cases/associations/has_and_belongs_to_many_associations_test.rb +905 -0
- data/rails/activerecord/test/cases/associations/has_many_associations_test.rb +2099 -0
- data/rails/activerecord/test/cases/associations/has_many_through_associations_test.rb +1163 -0
- data/rails/activerecord/test/cases/associations/has_one_associations_test.rb +610 -0
- data/rails/activerecord/test/cases/associations/has_one_through_associations_test.rb +346 -0
- data/rails/activerecord/test/cases/associations/inner_join_association_test.rb +139 -0
- data/rails/activerecord/test/cases/associations/inverse_associations_test.rb +693 -0
- data/rails/activerecord/test/cases/associations/join_model_test.rb +751 -0
- data/rails/activerecord/test/cases/associations/nested_through_associations_test.rb +579 -0
- data/rails/activerecord/test/cases/associations/required_test.rb +82 -0
- data/rails/activerecord/test/cases/associations_test.rb +380 -0
- data/rails/activerecord/test/cases/attribute_decorators_test.rb +125 -0
- data/rails/activerecord/test/cases/attribute_methods/read_test.rb +60 -0
- data/rails/activerecord/test/cases/attribute_methods_test.rb +941 -0
- data/rails/activerecord/test/cases/attribute_set_test.rb +200 -0
- data/rails/activerecord/test/cases/attribute_test.rb +180 -0
- data/rails/activerecord/test/cases/attributes_test.rb +115 -0
- data/rails/activerecord/test/cases/autosave_association_test.rb +1588 -0
- data/rails/activerecord/test/cases/base_test.rb +1627 -0
- data/rails/activerecord/test/cases/batches_test.rb +212 -0
- data/rails/activerecord/test/cases/binary_test.rb +49 -0
- data/rails/activerecord/test/cases/bind_parameter_test.rb +100 -0
- data/rails/activerecord/test/cases/calculations_test.rb +634 -0
- data/rails/activerecord/test/cases/callbacks_test.rb +539 -0
- data/rails/activerecord/test/cases/clone_test.rb +40 -0
- data/rails/activerecord/test/cases/coders/yaml_column_test.rb +63 -0
- data/rails/activerecord/test/cases/column_alias_test.rb +17 -0
- data/rails/activerecord/test/cases/column_definition_test.rb +123 -0
- data/rails/activerecord/test/cases/connection_adapters/adapter_leasing_test.rb +54 -0
- data/rails/activerecord/test/cases/connection_adapters/connection_handler_test.rb +53 -0
- data/rails/activerecord/test/cases/connection_adapters/connection_specification_test.rb +12 -0
- data/rails/activerecord/test/cases/connection_adapters/merge_and_resolve_default_url_config_test.rb +293 -0
- data/rails/activerecord/test/cases/connection_adapters/mysql_type_lookup_test.rb +65 -0
- data/rails/activerecord/test/cases/connection_adapters/quoting_test.rb +13 -0
- data/rails/activerecord/test/cases/connection_adapters/schema_cache_test.rb +56 -0
- data/rails/activerecord/test/cases/connection_adapters/type_lookup_test.rb +106 -0
- data/rails/activerecord/test/cases/connection_management_test.rb +122 -0
- data/rails/activerecord/test/cases/connection_pool_test.rb +346 -0
- data/rails/activerecord/test/cases/connection_specification/resolver_test.rb +116 -0
- data/rails/activerecord/test/cases/core_test.rb +112 -0
- data/rails/activerecord/test/cases/counter_cache_test.rb +201 -0
- data/rails/activerecord/test/cases/custom_locking_test.rb +17 -0
- data/rails/activerecord/test/cases/database_statements_test.rb +19 -0
- data/rails/activerecord/test/cases/date_time_test.rb +61 -0
- data/rails/activerecord/test/cases/defaults_test.rb +223 -0
- data/rails/activerecord/test/cases/dirty_test.rb +759 -0
- data/rails/activerecord/test/cases/disconnected_test.rb +28 -0
- data/rails/activerecord/test/cases/dup_test.rb +157 -0
- data/rails/activerecord/test/cases/enum_test.rb +290 -0
- data/rails/activerecord/test/cases/explain_subscriber_test.rb +59 -0
- data/rails/activerecord/test/cases/explain_test.rb +76 -0
- data/rails/activerecord/test/cases/finder_respond_to_test.rb +60 -0
- data/rails/activerecord/test/cases/finder_test.rb +1163 -0
- data/rails/activerecord/test/cases/fixture_set/file_test.rb +138 -0
- data/rails/activerecord/test/cases/fixtures_test.rb +869 -0
- data/rails/activerecord/test/cases/forbidden_attributes_protection_test.rb +99 -0
- data/rails/activerecord/test/cases/habtm_destroy_order_test.rb +61 -0
- data/rails/activerecord/test/cases/helper.rb +210 -0
- data/rails/activerecord/test/cases/hot_compatibility_test.rb +54 -0
- data/rails/activerecord/test/cases/i18n_test.rb +45 -0
- data/rails/activerecord/test/cases/inheritance_test.rb +369 -0
- data/rails/activerecord/test/cases/integration_test.rb +139 -0
- data/rails/activerecord/test/cases/invalid_connection_test.rb +22 -0
- data/rails/activerecord/test/cases/invalid_date_test.rb +32 -0
- data/rails/activerecord/test/cases/invertible_migration_test.rb +295 -0
- data/rails/activerecord/test/cases/json_serialization_test.rb +300 -0
- data/rails/activerecord/test/cases/locking_test.rb +477 -0
- data/rails/activerecord/test/cases/log_subscriber_test.rb +136 -0
- data/rails/activerecord/test/cases/migration/change_schema_test.rb +450 -0
- data/rails/activerecord/test/cases/migration/change_table_test.rb +224 -0
- data/rails/activerecord/test/cases/migration/column_attributes_test.rb +185 -0
- data/rails/activerecord/test/cases/migration/column_positioning_test.rb +56 -0
- data/rails/activerecord/test/cases/migration/columns_test.rb +299 -0
- data/rails/activerecord/test/cases/migration/command_recorder_test.rb +305 -0
- data/rails/activerecord/test/cases/migration/create_join_table_test.rb +148 -0
- data/rails/activerecord/test/cases/migration/foreign_key_test.rb +250 -0
- data/rails/activerecord/test/cases/migration/helper.rb +39 -0
- data/rails/activerecord/test/cases/migration/index_test.rb +208 -0
- data/rails/activerecord/test/cases/migration/logger_test.rb +36 -0
- data/rails/activerecord/test/cases/migration/pending_migrations_test.rb +53 -0
- data/rails/activerecord/test/cases/migration/references_foreign_key_test.rb +111 -0
- data/rails/activerecord/test/cases/migration/references_index_test.rb +101 -0
- data/rails/activerecord/test/cases/migration/references_statements_test.rb +116 -0
- data/rails/activerecord/test/cases/migration/rename_table_test.rb +93 -0
- data/rails/activerecord/test/cases/migration/table_and_index_test.rb +24 -0
- data/rails/activerecord/test/cases/migration_test.rb +939 -0
- data/rails/activerecord/test/cases/migrator_test.rb +388 -0
- data/rails/activerecord/test/cases/mixin_test.rb +70 -0
- data/rails/activerecord/test/cases/modules_test.rb +173 -0
- data/rails/activerecord/test/cases/multiparameter_attributes_test.rb +350 -0
- data/rails/activerecord/test/cases/multiple_db_test.rb +115 -0
- data/rails/activerecord/test/cases/nested_attributes_test.rb +1057 -0
- data/rails/activerecord/test/cases/nested_attributes_with_callbacks_test.rb +144 -0
- data/rails/activerecord/test/cases/persistence_test.rb +881 -0
- data/rails/activerecord/test/cases/pooled_connections_test.rb +81 -0
- data/rails/activerecord/test/cases/primary_keys_test.rb +236 -0
- data/rails/activerecord/test/cases/query_cache_test.rb +322 -0
- data/rails/activerecord/test/cases/quoting_test.rb +156 -0
- data/rails/activerecord/test/cases/readonly_test.rb +118 -0
- data/rails/activerecord/test/cases/reaper_test.rb +85 -0
- data/rails/activerecord/test/cases/reflection_test.rb +454 -0
- data/rails/activerecord/test/cases/relation/delegation_test.rb +68 -0
- data/rails/activerecord/test/cases/relation/merging_test.rb +161 -0
- data/rails/activerecord/test/cases/relation/mutation_test.rb +165 -0
- data/rails/activerecord/test/cases/relation/predicate_builder_test.rb +14 -0
- data/rails/activerecord/test/cases/relation/where_chain_test.rb +181 -0
- data/rails/activerecord/test/cases/relation/where_test.rb +278 -0
- data/rails/activerecord/test/cases/relation_test.rb +267 -0
- data/rails/activerecord/test/cases/relations_test.rb +1756 -0
- data/rails/activerecord/test/cases/reload_models_test.rb +22 -0
- data/rails/activerecord/test/cases/result_test.rb +80 -0
- data/rails/activerecord/test/cases/sanitize_test.rb +83 -0
- data/rails/activerecord/test/cases/schema_dumper_test.rb +445 -0
- data/rails/activerecord/test/cases/scoping/default_scoping_test.rb +436 -0
- data/rails/activerecord/test/cases/scoping/named_scoping_test.rb +524 -0
- data/rails/activerecord/test/cases/scoping/relation_scoping_test.rb +357 -0
- data/rails/activerecord/test/cases/serialization_test.rb +104 -0
- data/rails/activerecord/test/cases/serialized_attribute_test.rb +267 -0
- data/rails/activerecord/test/cases/statement_cache_test.rb +98 -0
- data/rails/activerecord/test/cases/store_test.rb +194 -0
- data/rails/activerecord/test/cases/tasks/database_tasks_test.rb +380 -0
- data/rails/activerecord/test/cases/tasks/mysql_rake_test.rb +311 -0
- data/rails/activerecord/test/cases/tasks/postgresql_rake_test.rb +245 -0
- data/rails/activerecord/test/cases/tasks/sqlite_rake_test.rb +193 -0
- data/rails/activerecord/test/cases/test_case.rb +123 -0
- data/rails/activerecord/test/cases/timestamp_test.rb +446 -0
- data/rails/activerecord/test/cases/transaction_callbacks_test.rb +444 -0
- data/rails/activerecord/test/cases/transaction_isolation_test.rb +106 -0
- data/rails/activerecord/test/cases/transactions_test.rb +792 -0
- data/rails/activerecord/test/cases/type/decimal_test.rb +51 -0
- data/rails/activerecord/test/cases/type/integer_test.rb +121 -0
- data/rails/activerecord/test/cases/type/string_test.rb +36 -0
- data/rails/activerecord/test/cases/type/type_map_test.rb +177 -0
- data/rails/activerecord/test/cases/type/unsigned_integer_test.rb +18 -0
- data/rails/activerecord/test/cases/types_test.rb +141 -0
- data/rails/activerecord/test/cases/unconnected_test.rb +33 -0
- data/rails/activerecord/test/cases/validations/association_validation_test.rb +86 -0
- data/rails/activerecord/test/cases/validations/i18n_generate_message_validation_test.rb +84 -0
- data/rails/activerecord/test/cases/validations/i18n_validation_test.rb +90 -0
- data/rails/activerecord/test/cases/validations/length_validation_test.rb +47 -0
- data/rails/activerecord/test/cases/validations/presence_validation_test.rb +68 -0
- data/rails/activerecord/test/cases/validations/uniqueness_validation_test.rb +406 -0
- data/rails/activerecord/test/cases/validations_repair_helper.rb +23 -0
- data/rails/activerecord/test/cases/validations_test.rb +165 -0
- data/rails/activerecord/test/cases/view_test.rb +113 -0
- data/rails/activerecord/test/cases/xml_serialization_test.rb +447 -0
- data/rails/activerecord/test/cases/yaml_serialization_test.rb +86 -0
- data/rails/activerecord/test/config.example.yml +106 -0
- data/rails/activerecord/test/config.rb +5 -0
- data/rails/activerecord/test/fixtures/.gitignore +1 -0
- data/rails/activerecord/test/fixtures/accounts.yml +29 -0
- data/rails/activerecord/test/fixtures/admin/accounts.yml +2 -0
- data/rails/activerecord/test/fixtures/admin/randomly_named_a9.yml +7 -0
- data/rails/activerecord/test/fixtures/admin/randomly_named_b0.yml +7 -0
- data/rails/activerecord/test/fixtures/admin/users.yml +10 -0
- data/rails/activerecord/test/fixtures/all/developers.yml +0 -0
- data/rails/activerecord/test/fixtures/all/people.yml +0 -0
- data/rails/activerecord/test/fixtures/all/tasks.yml +0 -0
- data/rails/activerecord/test/fixtures/author_addresses.yml +5 -0
- data/rails/activerecord/test/fixtures/author_favorites.yml +4 -0
- data/rails/activerecord/test/fixtures/authors.yml +15 -0
- data/rails/activerecord/test/fixtures/binaries.yml +133 -0
- data/rails/activerecord/test/fixtures/books.yml +11 -0
- data/rails/activerecord/test/fixtures/bulbs.yml +5 -0
- data/rails/activerecord/test/fixtures/cars.yml +9 -0
- data/rails/activerecord/test/fixtures/categories/special_categories.yml +9 -0
- data/rails/activerecord/test/fixtures/categories/subsubdir/arbitrary_filename.yml +4 -0
- data/rails/activerecord/test/fixtures/categories.yml +19 -0
- data/rails/activerecord/test/fixtures/categories_ordered.yml +7 -0
- data/rails/activerecord/test/fixtures/categories_posts.yml +31 -0
- data/rails/activerecord/test/fixtures/categorizations.yml +23 -0
- data/rails/activerecord/test/fixtures/clubs.yml +8 -0
- data/rails/activerecord/test/fixtures/collections.yml +3 -0
- data/rails/activerecord/test/fixtures/colleges.yml +3 -0
- data/rails/activerecord/test/fixtures/comments.yml +65 -0
- data/rails/activerecord/test/fixtures/companies.yml +67 -0
- data/rails/activerecord/test/fixtures/computers.yml +10 -0
- data/rails/activerecord/test/fixtures/courses.yml +8 -0
- data/rails/activerecord/test/fixtures/customers.yml +26 -0
- data/rails/activerecord/test/fixtures/dashboards.yml +6 -0
- data/rails/activerecord/test/fixtures/developers.yml +22 -0
- data/rails/activerecord/test/fixtures/developers_projects.yml +17 -0
- data/rails/activerecord/test/fixtures/dog_lovers.yml +7 -0
- data/rails/activerecord/test/fixtures/dogs.yml +4 -0
- data/rails/activerecord/test/fixtures/edges.yml +5 -0
- data/rails/activerecord/test/fixtures/entrants.yml +14 -0
- data/rails/activerecord/test/fixtures/essays.yml +6 -0
- data/rails/activerecord/test/fixtures/faces.yml +11 -0
- data/rails/activerecord/test/fixtures/fk_test_has_fk.yml +3 -0
- data/rails/activerecord/test/fixtures/fk_test_has_pk.yml +2 -0
- data/rails/activerecord/test/fixtures/friendships.yml +4 -0
- data/rails/activerecord/test/fixtures/funny_jokes.yml +10 -0
- data/rails/activerecord/test/fixtures/interests.yml +33 -0
- data/rails/activerecord/test/fixtures/items.yml +3 -0
- data/rails/activerecord/test/fixtures/jobs.yml +7 -0
- data/rails/activerecord/test/fixtures/legacy_things.yml +3 -0
- data/rails/activerecord/test/fixtures/mateys.yml +4 -0
- data/rails/activerecord/test/fixtures/member_details.yml +8 -0
- data/rails/activerecord/test/fixtures/member_types.yml +6 -0
- data/rails/activerecord/test/fixtures/members.yml +11 -0
- data/rails/activerecord/test/fixtures/memberships.yml +34 -0
- data/rails/activerecord/test/fixtures/men.yml +5 -0
- data/rails/activerecord/test/fixtures/minimalistics.yml +2 -0
- data/rails/activerecord/test/fixtures/minivans.yml +5 -0
- data/rails/activerecord/test/fixtures/mixed_case_monkeys.yml +6 -0
- data/rails/activerecord/test/fixtures/mixins.yml +29 -0
- data/rails/activerecord/test/fixtures/movies.yml +7 -0
- data/rails/activerecord/test/fixtures/naked/csv/accounts.csv +1 -0
- data/rails/activerecord/test/fixtures/naked/yml/accounts.yml +1 -0
- data/rails/activerecord/test/fixtures/naked/yml/companies.yml +1 -0
- data/rails/activerecord/test/fixtures/naked/yml/courses.yml +1 -0
- data/rails/activerecord/test/fixtures/organizations.yml +5 -0
- data/rails/activerecord/test/fixtures/other_topics.yml +42 -0
- data/rails/activerecord/test/fixtures/owners.yml +9 -0
- data/rails/activerecord/test/fixtures/parrots.yml +27 -0
- data/rails/activerecord/test/fixtures/parrots_pirates.yml +7 -0
- data/rails/activerecord/test/fixtures/people.yml +24 -0
- data/rails/activerecord/test/fixtures/peoples_treasures.yml +3 -0
- data/rails/activerecord/test/fixtures/pets.yml +19 -0
- data/rails/activerecord/test/fixtures/pirates.yml +12 -0
- data/rails/activerecord/test/fixtures/posts.yml +80 -0
- data/rails/activerecord/test/fixtures/price_estimates.yml +7 -0
- data/rails/activerecord/test/fixtures/products.yml +4 -0
- data/rails/activerecord/test/fixtures/projects.yml +7 -0
- data/rails/activerecord/test/fixtures/randomly_named_a9.yml +7 -0
- data/rails/activerecord/test/fixtures/ratings.yml +14 -0
- data/rails/activerecord/test/fixtures/readers.yml +11 -0
- data/rails/activerecord/test/fixtures/references.yml +17 -0
- data/rails/activerecord/test/fixtures/reserved_words/distinct.yml +5 -0
- data/rails/activerecord/test/fixtures/reserved_words/distinct_select.yml +11 -0
- data/rails/activerecord/test/fixtures/reserved_words/group.yml +14 -0
- data/rails/activerecord/test/fixtures/reserved_words/select.yml +8 -0
- data/rails/activerecord/test/fixtures/reserved_words/values.yml +7 -0
- data/rails/activerecord/test/fixtures/ships.yml +6 -0
- data/rails/activerecord/test/fixtures/speedometers.yml +8 -0
- data/rails/activerecord/test/fixtures/sponsors.yml +12 -0
- data/rails/activerecord/test/fixtures/string_key_objects.yml +7 -0
- data/rails/activerecord/test/fixtures/subscribers.yml +11 -0
- data/rails/activerecord/test/fixtures/subscriptions.yml +12 -0
- data/rails/activerecord/test/fixtures/taggings.yml +78 -0
- data/rails/activerecord/test/fixtures/tags.yml +11 -0
- data/rails/activerecord/test/fixtures/tasks.yml +7 -0
- data/rails/activerecord/test/fixtures/teapots.yml +3 -0
- data/rails/activerecord/test/fixtures/to_be_linked/accounts.yml +2 -0
- data/rails/activerecord/test/fixtures/to_be_linked/users.yml +10 -0
- data/rails/activerecord/test/fixtures/topics.yml +49 -0
- data/rails/activerecord/test/fixtures/toys.yml +14 -0
- data/rails/activerecord/test/fixtures/traffic_lights.yml +10 -0
- data/rails/activerecord/test/fixtures/treasures.yml +10 -0
- data/rails/activerecord/test/fixtures/uuid_children.yml +3 -0
- data/rails/activerecord/test/fixtures/uuid_parents.yml +2 -0
- data/rails/activerecord/test/fixtures/variants.yml +4 -0
- data/rails/activerecord/test/fixtures/vegetables.yml +20 -0
- data/rails/activerecord/test/fixtures/vertices.yml +4 -0
- data/rails/activerecord/test/fixtures/warehouse-things.yml +3 -0
- data/rails/activerecord/test/fixtures/zines.yml +5 -0
- data/rails/activerecord/test/migrations/10_urban/9_add_expressions.rb +11 -0
- data/rails/activerecord/test/migrations/decimal/1_give_me_big_numbers.rb +15 -0
- data/rails/activerecord/test/migrations/empty/.gitkeep +0 -0
- data/rails/activerecord/test/migrations/magic/1_currencies_have_symbols.rb +12 -0
- data/rails/activerecord/test/migrations/missing/1000_people_have_middle_names.rb +9 -0
- data/rails/activerecord/test/migrations/missing/1_people_have_last_names.rb +9 -0
- data/rails/activerecord/test/migrations/missing/3_we_need_reminders.rb +12 -0
- data/rails/activerecord/test/migrations/missing/4_innocent_jointable.rb +12 -0
- data/rails/activerecord/test/migrations/rename/1_we_need_things.rb +11 -0
- data/rails/activerecord/test/migrations/rename/2_rename_things.rb +9 -0
- data/rails/activerecord/test/migrations/to_copy/1_people_have_hobbies.rb +9 -0
- data/rails/activerecord/test/migrations/to_copy/2_people_have_descriptions.rb +9 -0
- data/rails/activerecord/test/migrations/to_copy2/1_create_articles.rb +7 -0
- data/rails/activerecord/test/migrations/to_copy2/2_create_comments.rb +7 -0
- data/rails/activerecord/test/migrations/to_copy_with_name_collision/1_people_have_hobbies.rb +9 -0
- data/rails/activerecord/test/migrations/to_copy_with_timestamps/20090101010101_people_have_hobbies.rb +9 -0
- data/rails/activerecord/test/migrations/to_copy_with_timestamps/20090101010202_people_have_descriptions.rb +9 -0
- data/rails/activerecord/test/migrations/to_copy_with_timestamps2/20090101010101_create_articles.rb +7 -0
- data/rails/activerecord/test/migrations/to_copy_with_timestamps2/20090101010202_create_comments.rb +7 -0
- data/rails/activerecord/test/migrations/valid/1_valid_people_have_last_names.rb +9 -0
- data/rails/activerecord/test/migrations/valid/2_we_need_reminders.rb +12 -0
- data/rails/activerecord/test/migrations/valid/3_innocent_jointable.rb +12 -0
- data/rails/activerecord/test/migrations/valid_with_subdirectories/1_valid_people_have_last_names.rb +9 -0
- data/rails/activerecord/test/migrations/valid_with_subdirectories/sub/2_we_need_reminders.rb +12 -0
- data/rails/activerecord/test/migrations/valid_with_subdirectories/sub1/3_innocent_jointable.rb +12 -0
- data/rails/activerecord/test/migrations/valid_with_timestamps/20100101010101_valid_with_timestamps_people_have_last_names.rb +9 -0
- data/rails/activerecord/test/migrations/valid_with_timestamps/20100201010101_valid_with_timestamps_we_need_reminders.rb +12 -0
- data/rails/activerecord/test/migrations/valid_with_timestamps/20100301010101_valid_with_timestamps_innocent_jointable.rb +12 -0
- data/rails/activerecord/test/migrations/version_check/20131219224947_migration_version_check.rb +8 -0
- data/rails/activerecord/test/models/admin/account.rb +3 -0
- data/rails/activerecord/test/models/admin/randomly_named_c1.rb +3 -0
- data/rails/activerecord/test/models/admin/user.rb +40 -0
- data/rails/activerecord/test/models/admin.rb +5 -0
- data/rails/activerecord/test/models/aircraft.rb +4 -0
- data/rails/activerecord/test/models/arunit2_model.rb +3 -0
- data/rails/activerecord/test/models/author.rb +212 -0
- data/rails/activerecord/test/models/auto_id.rb +4 -0
- data/rails/activerecord/test/models/autoloadable/extra_firm.rb +2 -0
- data/rails/activerecord/test/models/binary.rb +2 -0
- data/rails/activerecord/test/models/bird.rb +12 -0
- data/rails/activerecord/test/models/book.rb +18 -0
- data/rails/activerecord/test/models/boolean.rb +2 -0
- data/rails/activerecord/test/models/bulb.rb +51 -0
- data/rails/activerecord/test/models/cake_designer.rb +3 -0
- data/rails/activerecord/test/models/car.rb +26 -0
- data/rails/activerecord/test/models/categorization.rb +19 -0
- data/rails/activerecord/test/models/category.rb +35 -0
- data/rails/activerecord/test/models/chef.rb +3 -0
- data/rails/activerecord/test/models/citation.rb +3 -0
- data/rails/activerecord/test/models/club.rb +23 -0
- data/rails/activerecord/test/models/college.rb +10 -0
- data/rails/activerecord/test/models/column.rb +3 -0
- data/rails/activerecord/test/models/column_name.rb +3 -0
- data/rails/activerecord/test/models/comment.rb +59 -0
- data/rails/activerecord/test/models/company.rb +225 -0
- data/rails/activerecord/test/models/company_in_module.rb +98 -0
- data/rails/activerecord/test/models/computer.rb +3 -0
- data/rails/activerecord/test/models/contact.rb +41 -0
- data/rails/activerecord/test/models/contract.rb +20 -0
- data/rails/activerecord/test/models/country.rb +7 -0
- data/rails/activerecord/test/models/course.rb +6 -0
- data/rails/activerecord/test/models/customer.rb +77 -0
- data/rails/activerecord/test/models/dashboard.rb +3 -0
- data/rails/activerecord/test/models/default.rb +2 -0
- data/rails/activerecord/test/models/department.rb +4 -0
- data/rails/activerecord/test/models/developer.rb +252 -0
- data/rails/activerecord/test/models/dog.rb +5 -0
- data/rails/activerecord/test/models/dog_lover.rb +5 -0
- data/rails/activerecord/test/models/drink_designer.rb +3 -0
- data/rails/activerecord/test/models/edge.rb +5 -0
- data/rails/activerecord/test/models/electron.rb +5 -0
- data/rails/activerecord/test/models/engine.rb +4 -0
- data/rails/activerecord/test/models/entrant.rb +3 -0
- data/rails/activerecord/test/models/essay.rb +5 -0
- data/rails/activerecord/test/models/event.rb +3 -0
- data/rails/activerecord/test/models/eye.rb +37 -0
- data/rails/activerecord/test/models/face.rb +9 -0
- data/rails/activerecord/test/models/friendship.rb +6 -0
- data/rails/activerecord/test/models/guid.rb +2 -0
- data/rails/activerecord/test/models/hotel.rb +6 -0
- data/rails/activerecord/test/models/image.rb +3 -0
- data/rails/activerecord/test/models/interest.rb +5 -0
- data/rails/activerecord/test/models/invoice.rb +4 -0
- data/rails/activerecord/test/models/item.rb +7 -0
- data/rails/activerecord/test/models/job.rb +7 -0
- data/rails/activerecord/test/models/joke.rb +7 -0
- data/rails/activerecord/test/models/keyboard.rb +3 -0
- data/rails/activerecord/test/models/legacy_thing.rb +3 -0
- data/rails/activerecord/test/models/lesson.rb +11 -0
- data/rails/activerecord/test/models/line_item.rb +3 -0
- data/rails/activerecord/test/models/liquid.rb +4 -0
- data/rails/activerecord/test/models/man.rb +11 -0
- data/rails/activerecord/test/models/matey.rb +4 -0
- data/rails/activerecord/test/models/member.rb +38 -0
- data/rails/activerecord/test/models/member_detail.rb +7 -0
- data/rails/activerecord/test/models/member_type.rb +3 -0
- data/rails/activerecord/test/models/membership.rb +20 -0
- data/rails/activerecord/test/models/minimalistic.rb +2 -0
- data/rails/activerecord/test/models/minivan.rb +9 -0
- data/rails/activerecord/test/models/mixed_case_monkey.rb +3 -0
- data/rails/activerecord/test/models/molecule.rb +6 -0
- data/rails/activerecord/test/models/movie.rb +5 -0
- data/rails/activerecord/test/models/order.rb +4 -0
- data/rails/activerecord/test/models/organization.rb +14 -0
- data/rails/activerecord/test/models/owner.rb +34 -0
- data/rails/activerecord/test/models/parrot.rb +29 -0
- data/rails/activerecord/test/models/person.rb +143 -0
- data/rails/activerecord/test/models/personal_legacy_thing.rb +4 -0
- data/rails/activerecord/test/models/pet.rb +15 -0
- data/rails/activerecord/test/models/pirate.rb +92 -0
- data/rails/activerecord/test/models/possession.rb +3 -0
- data/rails/activerecord/test/models/post.rb +243 -0
- data/rails/activerecord/test/models/price_estimate.rb +4 -0
- data/rails/activerecord/test/models/project.rb +29 -0
- data/rails/activerecord/test/models/publisher/article.rb +4 -0
- data/rails/activerecord/test/models/publisher/magazine.rb +3 -0
- data/rails/activerecord/test/models/publisher.rb +2 -0
- data/rails/activerecord/test/models/randomly_named_c1.rb +3 -0
- data/rails/activerecord/test/models/rating.rb +4 -0
- data/rails/activerecord/test/models/reader.rb +23 -0
- data/rails/activerecord/test/models/record.rb +2 -0
- data/rails/activerecord/test/models/reference.rb +22 -0
- data/rails/activerecord/test/models/reply.rb +61 -0
- data/rails/activerecord/test/models/ship.rb +26 -0
- data/rails/activerecord/test/models/ship_part.rb +8 -0
- data/rails/activerecord/test/models/shop.rb +17 -0
- data/rails/activerecord/test/models/speedometer.rb +6 -0
- data/rails/activerecord/test/models/sponsor.rb +7 -0
- data/rails/activerecord/test/models/string_key_object.rb +3 -0
- data/rails/activerecord/test/models/student.rb +4 -0
- data/rails/activerecord/test/models/subject.rb +16 -0
- data/rails/activerecord/test/models/subscriber.rb +8 -0
- data/rails/activerecord/test/models/subscription.rb +4 -0
- data/rails/activerecord/test/models/tag.rb +7 -0
- data/rails/activerecord/test/models/tagging.rb +13 -0
- data/rails/activerecord/test/models/task.rb +5 -0
- data/rails/activerecord/test/models/topic.rb +124 -0
- data/rails/activerecord/test/models/toy.rb +6 -0
- data/rails/activerecord/test/models/traffic_light.rb +4 -0
- data/rails/activerecord/test/models/treasure.rb +13 -0
- data/rails/activerecord/test/models/treaty.rb +7 -0
- data/rails/activerecord/test/models/tyre.rb +11 -0
- data/rails/activerecord/test/models/uuid_child.rb +3 -0
- data/rails/activerecord/test/models/uuid_parent.rb +3 -0
- data/rails/activerecord/test/models/vegetables.rb +24 -0
- data/rails/activerecord/test/models/vertex.rb +9 -0
- data/rails/activerecord/test/models/warehouse_thing.rb +5 -0
- data/rails/activerecord/test/models/wheel.rb +3 -0
- data/rails/activerecord/test/models/without_table.rb +3 -0
- data/rails/activerecord/test/models/zine.rb +3 -0
- data/rails/activerecord/test/schema/mysql2_specific_schema.rb +58 -0
- data/rails/activerecord/test/schema/mysql_specific_schema.rb +70 -0
- data/rails/activerecord/test/schema/oracle_specific_schema.rb +43 -0
- data/rails/activerecord/test/schema/postgresql_specific_schema.rb +198 -0
- data/rails/activerecord/test/schema/schema.rb +905 -0
- data/rails/activerecord/test/schema/sqlite_specific_schema.rb +22 -0
- data/rails/activerecord/test/support/config.rb +43 -0
- data/rails/activerecord/test/support/connection.rb +21 -0
- data/rails/activerecord/test/support/connection_helper.rb +14 -0
- data/rails/activerecord/test/support/ddl_helper.rb +8 -0
- data/rails/activerecord/test/support/schema_dumping_helper.rb +20 -0
- data/rails/activesupport/CHANGELOG.md +418 -0
- data/rails/activesupport/MIT-LICENSE +20 -0
- data/rails/activesupport/README.rdoc +40 -0
- data/rails/activesupport/Rakefile +32 -0
- data/rails/activesupport/activesupport.gemspec +28 -0
- data/rails/activesupport/bin/generate_tables +144 -0
- data/rails/activesupport/lib/active_support/all.rb +3 -0
- data/rails/activesupport/lib/active_support/backtrace_cleaner.rb +103 -0
- data/rails/activesupport/lib/active_support/benchmarkable.rb +49 -0
- data/rails/activesupport/lib/active_support/builder.rb +6 -0
- data/rails/activesupport/lib/active_support/cache/file_store.rb +190 -0
- data/rails/activesupport/lib/active_support/cache/mem_cache_store.rb +198 -0
- data/rails/activesupport/lib/active_support/cache/memory_store.rb +172 -0
- data/rails/activesupport/lib/active_support/cache/null_store.rb +44 -0
- data/rails/activesupport/lib/active_support/cache/strategy/local_cache.rb +161 -0
- data/rails/activesupport/lib/active_support/cache/strategy/local_cache_middleware.rb +44 -0
- data/rails/activesupport/lib/active_support/cache.rb +717 -0
- data/rails/activesupport/lib/active_support/callbacks.rb +793 -0
- data/rails/activesupport/lib/active_support/concern.rb +142 -0
- data/rails/activesupport/lib/active_support/concurrency/latch.rb +27 -0
- data/rails/activesupport/lib/active_support/configurable.rb +147 -0
- data/rails/activesupport/lib/active_support/core_ext/array/access.rb +64 -0
- data/rails/activesupport/lib/active_support/core_ext/array/conversions.rb +209 -0
- data/rails/activesupport/lib/active_support/core_ext/array/extract_options.rb +29 -0
- data/rails/activesupport/lib/active_support/core_ext/array/grouping.rb +116 -0
- data/rails/activesupport/lib/active_support/core_ext/array/prepend_and_append.rb +7 -0
- data/rails/activesupport/lib/active_support/core_ext/array/wrap.rb +45 -0
- data/rails/activesupport/lib/active_support/core_ext/array.rb +6 -0
- data/rails/activesupport/lib/active_support/core_ext/benchmark.rb +14 -0
- data/rails/activesupport/lib/active_support/core_ext/big_decimal/conversions.rb +16 -0
- data/rails/activesupport/lib/active_support/core_ext/big_decimal/yaml_conversions.rb +14 -0
- data/rails/activesupport/lib/active_support/core_ext/big_decimal.rb +1 -0
- data/rails/activesupport/lib/active_support/core_ext/class/attribute.rb +127 -0
- data/rails/activesupport/lib/active_support/core_ext/class/attribute_accessors.rb +4 -0
- data/rails/activesupport/lib/active_support/core_ext/class/delegating_attributes.rb +45 -0
- data/rails/activesupport/lib/active_support/core_ext/class/subclasses.rb +42 -0
- data/rails/activesupport/lib/active_support/core_ext/class.rb +3 -0
- data/rails/activesupport/lib/active_support/core_ext/date/acts_like.rb +8 -0
- data/rails/activesupport/lib/active_support/core_ext/date/calculations.rb +143 -0
- data/rails/activesupport/lib/active_support/core_ext/date/conversions.rb +88 -0
- data/rails/activesupport/lib/active_support/core_ext/date/zones.rb +6 -0
- data/rails/activesupport/lib/active_support/core_ext/date.rb +5 -0
- data/rails/activesupport/lib/active_support/core_ext/date_and_time/calculations.rb +251 -0
- data/rails/activesupport/lib/active_support/core_ext/date_and_time/zones.rb +41 -0
- data/rails/activesupport/lib/active_support/core_ext/date_time/acts_like.rb +14 -0
- data/rails/activesupport/lib/active_support/core_ext/date_time/calculations.rb +173 -0
- data/rails/activesupport/lib/active_support/core_ext/date_time/conversions.rb +103 -0
- data/rails/activesupport/lib/active_support/core_ext/date_time/zones.rb +6 -0
- data/rails/activesupport/lib/active_support/core_ext/date_time.rb +4 -0
- data/rails/activesupport/lib/active_support/core_ext/digest/uuid.rb +51 -0
- data/rails/activesupport/lib/active_support/core_ext/enumerable.rb +80 -0
- data/rails/activesupport/lib/active_support/core_ext/file/atomic.rb +63 -0
- data/rails/activesupport/lib/active_support/core_ext/file.rb +1 -0
- data/rails/activesupport/lib/active_support/core_ext/hash/compact.rb +20 -0
- data/rails/activesupport/lib/active_support/core_ext/hash/conversions.rb +243 -0
- data/rails/activesupport/lib/active_support/core_ext/hash/deep_merge.rb +38 -0
- data/rails/activesupport/lib/active_support/core_ext/hash/except.rb +21 -0
- data/rails/activesupport/lib/active_support/core_ext/hash/indifferent_access.rb +23 -0
- data/rails/activesupport/lib/active_support/core_ext/hash/keys.rb +166 -0
- data/rails/activesupport/lib/active_support/core_ext/hash/reverse_merge.rb +22 -0
- data/rails/activesupport/lib/active_support/core_ext/hash/slice.rb +48 -0
- data/rails/activesupport/lib/active_support/core_ext/hash/transform_values.rb +23 -0
- data/rails/activesupport/lib/active_support/core_ext/hash.rb +9 -0
- data/rails/activesupport/lib/active_support/core_ext/integer/inflections.rb +29 -0
- data/rails/activesupport/lib/active_support/core_ext/integer/multiple.rb +10 -0
- data/rails/activesupport/lib/active_support/core_ext/integer/time.rb +44 -0
- data/rails/activesupport/lib/active_support/core_ext/integer.rb +3 -0
- data/rails/activesupport/lib/active_support/core_ext/kernel/agnostics.rb +11 -0
- data/rails/activesupport/lib/active_support/core_ext/kernel/concern.rb +10 -0
- data/rails/activesupport/lib/active_support/core_ext/kernel/debugger.rb +10 -0
- data/rails/activesupport/lib/active_support/core_ext/kernel/reporting.rb +124 -0
- data/rails/activesupport/lib/active_support/core_ext/kernel/singleton_class.rb +6 -0
- data/rails/activesupport/lib/active_support/core_ext/kernel.rb +5 -0
- data/rails/activesupport/lib/active_support/core_ext/load_error.rb +28 -0
- data/rails/activesupport/lib/active_support/core_ext/marshal.rb +21 -0
- data/rails/activesupport/lib/active_support/core_ext/module/aliasing.rb +69 -0
- data/rails/activesupport/lib/active_support/core_ext/module/anonymous.rb +19 -0
- data/rails/activesupport/lib/active_support/core_ext/module/attr_internal.rb +39 -0
- data/rails/activesupport/lib/active_support/core_ext/module/attribute_accessors.rb +212 -0
- data/rails/activesupport/lib/active_support/core_ext/module/concerning.rb +135 -0
- data/rails/activesupport/lib/active_support/core_ext/module/delegation.rb +217 -0
- data/rails/activesupport/lib/active_support/core_ext/module/deprecation.rb +23 -0
- data/rails/activesupport/lib/active_support/core_ext/module/introspection.rb +62 -0
- data/rails/activesupport/lib/active_support/core_ext/module/method_transplanting.rb +11 -0
- data/rails/activesupport/lib/active_support/core_ext/module/qualified_const.rb +52 -0
- data/rails/activesupport/lib/active_support/core_ext/module/reachable.rb +8 -0
- data/rails/activesupport/lib/active_support/core_ext/module/remove_method.rb +12 -0
- data/rails/activesupport/lib/active_support/core_ext/module.rb +11 -0
- data/rails/activesupport/lib/active_support/core_ext/name_error.rb +18 -0
- data/rails/activesupport/lib/active_support/core_ext/numeric/bytes.rb +44 -0
- data/rails/activesupport/lib/active_support/core_ext/numeric/conversions.rb +135 -0
- data/rails/activesupport/lib/active_support/core_ext/numeric/time.rb +69 -0
- data/rails/activesupport/lib/active_support/core_ext/numeric.rb +3 -0
- data/rails/activesupport/lib/active_support/core_ext/object/acts_like.rb +10 -0
- data/rails/activesupport/lib/active_support/core_ext/object/blank.rb +131 -0
- data/rails/activesupport/lib/active_support/core_ext/object/conversions.rb +4 -0
- data/rails/activesupport/lib/active_support/core_ext/object/deep_dup.rb +46 -0
- data/rails/activesupport/lib/active_support/core_ext/object/duplicable.rb +103 -0
- data/rails/activesupport/lib/active_support/core_ext/object/inclusion.rb +27 -0
- data/rails/activesupport/lib/active_support/core_ext/object/instance_variables.rb +28 -0
- data/rails/activesupport/lib/active_support/core_ext/object/itself.rb +15 -0
- data/rails/activesupport/lib/active_support/core_ext/object/json.rb +197 -0
- data/rails/activesupport/lib/active_support/core_ext/object/to_param.rb +1 -0
- data/rails/activesupport/lib/active_support/core_ext/object/to_query.rb +84 -0
- data/rails/activesupport/lib/active_support/core_ext/object/try.rb +100 -0
- data/rails/activesupport/lib/active_support/core_ext/object/with_options.rb +69 -0
- data/rails/activesupport/lib/active_support/core_ext/object.rb +15 -0
- data/rails/activesupport/lib/active_support/core_ext/range/conversions.rb +19 -0
- data/rails/activesupport/lib/active_support/core_ext/range/each.rb +23 -0
- data/rails/activesupport/lib/active_support/core_ext/range/include_range.rb +23 -0
- data/rails/activesupport/lib/active_support/core_ext/range/overlaps.rb +8 -0
- data/rails/activesupport/lib/active_support/core_ext/range.rb +4 -0
- data/rails/activesupport/lib/active_support/core_ext/regexp.rb +5 -0
- data/rails/activesupport/lib/active_support/core_ext/string/access.rb +104 -0
- data/rails/activesupport/lib/active_support/core_ext/string/behavior.rb +6 -0
- data/rails/activesupport/lib/active_support/core_ext/string/conversions.rb +56 -0
- data/rails/activesupport/lib/active_support/core_ext/string/exclude.rb +11 -0
- data/rails/activesupport/lib/active_support/core_ext/string/filters.rb +102 -0
- data/rails/activesupport/lib/active_support/core_ext/string/indent.rb +43 -0
- data/rails/activesupport/lib/active_support/core_ext/string/inflections.rb +217 -0
- data/rails/activesupport/lib/active_support/core_ext/string/inquiry.rb +13 -0
- data/rails/activesupport/lib/active_support/core_ext/string/multibyte.rb +49 -0
- data/rails/activesupport/lib/active_support/core_ext/string/output_safety.rb +262 -0
- data/rails/activesupport/lib/active_support/core_ext/string/starts_ends_with.rb +4 -0
- data/rails/activesupport/lib/active_support/core_ext/string/strip.rb +26 -0
- data/rails/activesupport/lib/active_support/core_ext/string/zones.rb +14 -0
- data/rails/activesupport/lib/active_support/core_ext/string.rb +13 -0
- data/rails/activesupport/lib/active_support/core_ext/struct.rb +6 -0
- data/rails/activesupport/lib/active_support/core_ext/thread.rb +86 -0
- data/rails/activesupport/lib/active_support/core_ext/time/acts_like.rb +8 -0
- data/rails/activesupport/lib/active_support/core_ext/time/calculations.rb +265 -0
- data/rails/activesupport/lib/active_support/core_ext/time/conversions.rb +65 -0
- data/rails/activesupport/lib/active_support/core_ext/time/marshal.rb +30 -0
- data/rails/activesupport/lib/active_support/core_ext/time/zones.rb +79 -0
- data/rails/activesupport/lib/active_support/core_ext/time.rb +5 -0
- data/rails/activesupport/lib/active_support/core_ext/uri.rb +26 -0
- data/rails/activesupport/lib/active_support/core_ext.rb +3 -0
- data/rails/activesupport/lib/active_support/dependencies/autoload.rb +77 -0
- data/rails/activesupport/lib/active_support/dependencies.rb +762 -0
- data/rails/activesupport/lib/active_support/deprecation/behaviors.rb +76 -0
- data/rails/activesupport/lib/active_support/deprecation/instance_delegator.rb +24 -0
- data/rails/activesupport/lib/active_support/deprecation/method_wrappers.rb +44 -0
- data/rails/activesupport/lib/active_support/deprecation/proxy_wrappers.rb +126 -0
- data/rails/activesupport/lib/active_support/deprecation/reporting.rb +94 -0
- data/rails/activesupport/lib/active_support/deprecation.rb +43 -0
- data/rails/activesupport/lib/active_support/descendants_tracker.rb +60 -0
- data/rails/activesupport/lib/active_support/duration.rb +136 -0
- data/rails/activesupport/lib/active_support/file_update_checker.rb +137 -0
- data/rails/activesupport/lib/active_support/gem_version.rb +15 -0
- data/rails/activesupport/lib/active_support/gzip.rb +36 -0
- data/rails/activesupport/lib/active_support/hash_with_indifferent_access.rb +281 -0
- data/rails/activesupport/lib/active_support/i18n.rb +13 -0
- data/rails/activesupport/lib/active_support/i18n_railtie.rb +94 -0
- data/rails/activesupport/lib/active_support/inflections.rb +70 -0
- data/rails/activesupport/lib/active_support/inflector/inflections.rb +211 -0
- data/rails/activesupport/lib/active_support/inflector/methods.rb +383 -0
- data/rails/activesupport/lib/active_support/inflector/transliterate.rb +97 -0
- data/rails/activesupport/lib/active_support/inflector.rb +7 -0
- data/rails/activesupport/lib/active_support/json/decoding.rb +73 -0
- data/rails/activesupport/lib/active_support/json/encoding.rb +172 -0
- data/rails/activesupport/lib/active_support/json.rb +2 -0
- data/rails/activesupport/lib/active_support/key_generator.rb +73 -0
- data/rails/activesupport/lib/active_support/lazy_load_hooks.rb +48 -0
- data/rails/activesupport/lib/active_support/locale/en.yml +133 -0
- data/rails/activesupport/lib/active_support/log_subscriber/test_helper.rb +104 -0
- data/rails/activesupport/lib/active_support/log_subscriber.rb +109 -0
- data/rails/activesupport/lib/active_support/logger.rb +57 -0
- data/rails/activesupport/lib/active_support/logger_silence.rb +24 -0
- data/rails/activesupport/lib/active_support/message_encryptor.rb +107 -0
- data/rails/activesupport/lib/active_support/message_verifier.rb +72 -0
- data/rails/activesupport/lib/active_support/multibyte/chars.rb +222 -0
- data/rails/activesupport/lib/active_support/multibyte/unicode.rb +390 -0
- data/rails/activesupport/lib/active_support/multibyte.rb +21 -0
- data/rails/activesupport/lib/active_support/notifications/fanout.rb +157 -0
- data/rails/activesupport/lib/active_support/notifications/instrumenter.rb +73 -0
- data/rails/activesupport/lib/active_support/notifications.rb +212 -0
- data/rails/activesupport/lib/active_support/number_helper/number_converter.rb +182 -0
- data/rails/activesupport/lib/active_support/number_helper/number_to_currency_converter.rb +46 -0
- data/rails/activesupport/lib/active_support/number_helper/number_to_delimited_converter.rb +23 -0
- data/rails/activesupport/lib/active_support/number_helper/number_to_human_converter.rb +66 -0
- data/rails/activesupport/lib/active_support/number_helper/number_to_human_size_converter.rb +58 -0
- data/rails/activesupport/lib/active_support/number_helper/number_to_percentage_converter.rb +12 -0
- data/rails/activesupport/lib/active_support/number_helper/number_to_phone_converter.rb +49 -0
- data/rails/activesupport/lib/active_support/number_helper/number_to_rounded_converter.rb +87 -0
- data/rails/activesupport/lib/active_support/number_helper.rb +345 -0
- data/rails/activesupport/lib/active_support/option_merger.rb +25 -0
- data/rails/activesupport/lib/active_support/ordered_hash.rb +48 -0
- data/rails/activesupport/lib/active_support/ordered_options.rb +67 -0
- data/rails/activesupport/lib/active_support/per_thread_registry.rb +53 -0
- data/rails/activesupport/lib/active_support/proxy_object.rb +13 -0
- data/rails/activesupport/lib/active_support/rails.rb +27 -0
- data/rails/activesupport/lib/active_support/railtie.rb +46 -0
- data/rails/activesupport/lib/active_support/rescuable.rb +119 -0
- data/rails/activesupport/lib/active_support/security_utils.rb +20 -0
- data/rails/activesupport/lib/active_support/string_inquirer.rb +26 -0
- data/rails/activesupport/lib/active_support/subscriber.rb +125 -0
- data/rails/activesupport/lib/active_support/tagged_logging.rb +76 -0
- data/rails/activesupport/lib/active_support/test_case.rb +100 -0
- data/rails/activesupport/lib/active_support/testing/assertions.rb +97 -0
- data/rails/activesupport/lib/active_support/testing/autorun.rb +5 -0
- data/rails/activesupport/lib/active_support/testing/constant_lookup.rb +50 -0
- data/rails/activesupport/lib/active_support/testing/declarative.rb +26 -0
- data/rails/activesupport/lib/active_support/testing/deprecation.rb +35 -0
- data/rails/activesupport/lib/active_support/testing/isolation.rb +101 -0
- data/rails/activesupport/lib/active_support/testing/setup_and_teardown.rb +50 -0
- data/rails/activesupport/lib/active_support/testing/tagged_logging.rb +25 -0
- data/rails/activesupport/lib/active_support/testing/time_helpers.rb +131 -0
- data/rails/activesupport/lib/active_support/time.rb +18 -0
- data/rails/activesupport/lib/active_support/time_with_zone.rb +409 -0
- data/rails/activesupport/lib/active_support/values/time_zone.rb +428 -0
- data/rails/activesupport/lib/active_support/values/unicode_tables.dat +0 -0
- data/rails/activesupport/lib/active_support/version.rb +8 -0
- data/rails/activesupport/lib/active_support/xml_mini/jdom.rb +180 -0
- data/rails/activesupport/lib/active_support/xml_mini/libxml.rb +79 -0
- data/rails/activesupport/lib/active_support/xml_mini/libxmlsax.rb +85 -0
- data/rails/activesupport/lib/active_support/xml_mini/nokogiri.rb +83 -0
- data/rails/activesupport/lib/active_support/xml_mini/nokogirisax.rb +87 -0
- data/rails/activesupport/lib/active_support/xml_mini/rexml.rb +129 -0
- data/rails/activesupport/lib/active_support/xml_mini.rb +191 -0
- data/rails/activesupport/lib/active_support.rb +85 -0
- data/rails/activesupport/test/abstract_unit.rb +45 -0
- data/rails/activesupport/test/autoload_test.rb +81 -0
- data/rails/activesupport/test/autoloading_fixtures/a/b.rb +2 -0
- data/rails/activesupport/test/autoloading_fixtures/a/c/d.rb +2 -0
- data/rails/activesupport/test/autoloading_fixtures/a/c/e/f.rb +2 -0
- data/rails/activesupport/test/autoloading_fixtures/application.rb +1 -0
- data/rails/activesupport/test/autoloading_fixtures/circular1.rb +6 -0
- data/rails/activesupport/test/autoloading_fixtures/circular2.rb +4 -0
- data/rails/activesupport/test/autoloading_fixtures/class_folder/class_folder_subclass.rb +3 -0
- data/rails/activesupport/test/autoloading_fixtures/class_folder/inline_class.rb +2 -0
- data/rails/activesupport/test/autoloading_fixtures/class_folder/nested_class.rb +7 -0
- data/rails/activesupport/test/autoloading_fixtures/class_folder.rb +3 -0
- data/rails/activesupport/test/autoloading_fixtures/conflict.rb +1 -0
- data/rails/activesupport/test/autoloading_fixtures/counting_loader.rb +5 -0
- data/rails/activesupport/test/autoloading_fixtures/cross_site_dependency.rb +2 -0
- data/rails/activesupport/test/autoloading_fixtures/e.rb +2 -0
- data/rails/activesupport/test/autoloading_fixtures/html/some_class.rb +4 -0
- data/rails/activesupport/test/autoloading_fixtures/load_path/loaded_constant.rb +3 -0
- data/rails/activesupport/test/autoloading_fixtures/loads_constant.rb +5 -0
- data/rails/activesupport/test/autoloading_fixtures/module_folder/inline_class.rb +2 -0
- data/rails/activesupport/test/autoloading_fixtures/module_folder/nested_class.rb +4 -0
- data/rails/activesupport/test/autoloading_fixtures/module_folder/nested_sibling.rb +2 -0
- data/rails/activesupport/test/autoloading_fixtures/module_with_custom_const_missing/a/b.rb +1 -0
- data/rails/activesupport/test/autoloading_fixtures/multiple_constant_file.rb +2 -0
- data/rails/activesupport/test/autoloading_fixtures/raises_name_error.rb +3 -0
- data/rails/activesupport/test/autoloading_fixtures/raises_no_method_error.rb +3 -0
- data/rails/activesupport/test/autoloading_fixtures/requires_constant.rb +5 -0
- data/rails/activesupport/test/autoloading_fixtures/should_not_be_required.rb +1 -0
- data/rails/activesupport/test/autoloading_fixtures/typo.rb +2 -0
- data/rails/activesupport/test/benchmarkable_test.rb +62 -0
- data/rails/activesupport/test/broadcast_logger_test.rb +82 -0
- data/rails/activesupport/test/caching_test.rb +1076 -0
- data/rails/activesupport/test/callback_inheritance_test.rb +176 -0
- data/rails/activesupport/test/callbacks_test.rb +1003 -0
- data/rails/activesupport/test/class_cache_test.rb +78 -0
- data/rails/activesupport/test/clean_backtrace_test.rb +75 -0
- data/rails/activesupport/test/clean_logger_test.rb +29 -0
- data/rails/activesupport/test/concern_test.rb +104 -0
- data/rails/activesupport/test/configurable_test.rb +123 -0
- data/rails/activesupport/test/constantize_test_cases.rb +116 -0
- data/rails/activesupport/test/core_ext/array/access_test.rb +30 -0
- data/rails/activesupport/test/core_ext/array/conversions_test.rb +197 -0
- data/rails/activesupport/test/core_ext/array/extract_options_test.rb +45 -0
- data/rails/activesupport/test/core_ext/array/grouping_test.rb +126 -0
- data/rails/activesupport/test/core_ext/array/prepend_append_test.rb +12 -0
- data/rails/activesupport/test/core_ext/array/wrap_test.rb +77 -0
- data/rails/activesupport/test/core_ext/big_decimal/yaml_conversions_test.rb +11 -0
- data/rails/activesupport/test/core_ext/bigdecimal_test.rb +9 -0
- data/rails/activesupport/test/core_ext/class/attribute_test.rb +91 -0
- data/rails/activesupport/test/core_ext/class/delegating_attributes_test.rb +122 -0
- data/rails/activesupport/test/core_ext/class_test.rb +28 -0
- data/rails/activesupport/test/core_ext/date_and_time_behavior.rb +241 -0
- data/rails/activesupport/test/core_ext/date_ext_test.rb +373 -0
- data/rails/activesupport/test/core_ext/date_time_ext_test.rb +358 -0
- data/rails/activesupport/test/core_ext/digest/uuid_test.rb +24 -0
- data/rails/activesupport/test/core_ext/duration_test.rb +223 -0
- data/rails/activesupport/test/core_ext/enumerable_test.rb +106 -0
- data/rails/activesupport/test/core_ext/file_test.rb +68 -0
- data/rails/activesupport/test/core_ext/hash/transform_keys_test.rb +32 -0
- data/rails/activesupport/test/core_ext/hash/transform_values_test.rb +61 -0
- data/rails/activesupport/test/core_ext/hash_ext_test.rb +1688 -0
- data/rails/activesupport/test/core_ext/integer_ext_test.rb +30 -0
- data/rails/activesupport/test/core_ext/kernel/concern_test.rb +13 -0
- data/rails/activesupport/test/core_ext/kernel_test.rb +138 -0
- data/rails/activesupport/test/core_ext/load_error_test.rb +41 -0
- data/rails/activesupport/test/core_ext/marshal_test.rb +124 -0
- data/rails/activesupport/test/core_ext/module/anonymous_test.rb +14 -0
- data/rails/activesupport/test/core_ext/module/attr_internal_test.rb +53 -0
- data/rails/activesupport/test/core_ext/module/attribute_accessor_test.rb +79 -0
- data/rails/activesupport/test/core_ext/module/attribute_aliasing_test.rb +59 -0
- data/rails/activesupport/test/core_ext/module/concerning_test.rb +65 -0
- data/rails/activesupport/test/core_ext/module/qualified_const_test.rb +108 -0
- data/rails/activesupport/test/core_ext/module/reachable_test.rb +41 -0
- data/rails/activesupport/test/core_ext/module/remove_method_test.rb +29 -0
- data/rails/activesupport/test/core_ext/module_test.rb +509 -0
- data/rails/activesupport/test/core_ext/name_error_test.rb +21 -0
- data/rails/activesupport/test/core_ext/numeric_ext_test.rb +392 -0
- data/rails/activesupport/test/core_ext/object/acts_like_test.rb +33 -0
- data/rails/activesupport/test/core_ext/object/blank_test.rb +36 -0
- data/rails/activesupport/test/core_ext/object/deep_dup_test.rb +53 -0
- data/rails/activesupport/test/core_ext/object/duplicable_test.rb +31 -0
- data/rails/activesupport/test/core_ext/object/inclusion_test.rb +59 -0
- data/rails/activesupport/test/core_ext/object/instance_variables_test.rb +31 -0
- data/rails/activesupport/test/core_ext/object/itself_test.rb +9 -0
- data/rails/activesupport/test/core_ext/object/json_cherry_pick_test.rb +42 -0
- data/rails/activesupport/test/core_ext/object/to_param_test.rb +37 -0
- data/rails/activesupport/test/core_ext/object/to_query_test.rb +82 -0
- data/rails/activesupport/test/core_ext/object/try_test.rb +99 -0
- data/rails/activesupport/test/core_ext/range_ext_test.rb +125 -0
- data/rails/activesupport/test/core_ext/regexp_ext_test.rb +10 -0
- data/rails/activesupport/test/core_ext/string_ext_test.rb +864 -0
- data/rails/activesupport/test/core_ext/struct_test.rb +10 -0
- data/rails/activesupport/test/core_ext/thread_test.rb +75 -0
- data/rails/activesupport/test/core_ext/time_ext_test.rb +901 -0
- data/rails/activesupport/test/core_ext/time_with_zone_test.rb +1121 -0
- data/rails/activesupport/test/core_ext/uri_ext_test.rb +13 -0
- data/rails/activesupport/test/dependencies/check_warnings.rb +2 -0
- data/rails/activesupport/test/dependencies/conflict.rb +1 -0
- data/rails/activesupport/test/dependencies/cross_site_depender.rb +3 -0
- data/rails/activesupport/test/dependencies/mutual_one.rb +4 -0
- data/rails/activesupport/test/dependencies/mutual_two.rb +4 -0
- data/rails/activesupport/test/dependencies/raises_exception.rb +3 -0
- data/rails/activesupport/test/dependencies/raises_exception_without_blame_file.rb +5 -0
- data/rails/activesupport/test/dependencies/requires_nonexistent0.rb +1 -0
- data/rails/activesupport/test/dependencies/requires_nonexistent1.rb +1 -0
- data/rails/activesupport/test/dependencies/service_one.rb +5 -0
- data/rails/activesupport/test/dependencies/service_two.rb +2 -0
- data/rails/activesupport/test/dependencies_test.rb +1059 -0
- data/rails/activesupport/test/dependencies_test_helpers.rb +28 -0
- data/rails/activesupport/test/deprecation/proxy_wrappers_test.rb +22 -0
- data/rails/activesupport/test/deprecation_test.rb +375 -0
- data/rails/activesupport/test/descendants_tracker_test_cases.rb +65 -0
- data/rails/activesupport/test/descendants_tracker_with_autoloading_test.rb +34 -0
- data/rails/activesupport/test/descendants_tracker_without_autoloading_test.rb +17 -0
- data/rails/activesupport/test/file_update_checker_test.rb +112 -0
- data/rails/activesupport/test/fixtures/autoload/another_class.rb +2 -0
- data/rails/activesupport/test/fixtures/autoload/some_class.rb +2 -0
- data/rails/activesupport/test/fixtures/xml/jdom_doctype.dtd +1 -0
- data/rails/activesupport/test/fixtures/xml/jdom_entities.txt +1 -0
- data/rails/activesupport/test/fixtures/xml/jdom_include.txt +1 -0
- data/rails/activesupport/test/gzip_test.rb +33 -0
- data/rails/activesupport/test/hash_with_indifferent_access_test.rb +10 -0
- data/rails/activesupport/test/i18n_test.rb +104 -0
- data/rails/activesupport/test/inflector_test.rb +537 -0
- data/rails/activesupport/test/inflector_test_cases.rb +324 -0
- data/rails/activesupport/test/json/decoding_test.rb +113 -0
- data/rails/activesupport/test/json/encoding_test.rb +547 -0
- data/rails/activesupport/test/key_generator_test.rb +62 -0
- data/rails/activesupport/test/lazy_load_hooks_test.rb +96 -0
- data/rails/activesupport/test/load_paths_test.rb +16 -0
- data/rails/activesupport/test/log_subscriber_test.rb +123 -0
- data/rails/activesupport/test/logger_test.rb +133 -0
- data/rails/activesupport/test/message_encryptor_test.rb +101 -0
- data/rails/activesupport/test/message_verifier_test.rb +86 -0
- data/rails/activesupport/test/multibyte_chars_test.rb +714 -0
- data/rails/activesupport/test/multibyte_conformance_test.rb +133 -0
- data/rails/activesupport/test/multibyte_proxy_test.rb +34 -0
- data/rails/activesupport/test/multibyte_test_helpers.rb +19 -0
- data/rails/activesupport/test/multibyte_unicode_database_test.rb +26 -0
- data/rails/activesupport/test/notifications/evented_notification_test.rb +87 -0
- data/rails/activesupport/test/notifications/instrumenter_test.rb +58 -0
- data/rails/activesupport/test/notifications_test.rb +266 -0
- data/rails/activesupport/test/number_helper_i18n_test.rb +148 -0
- data/rails/activesupport/test/number_helper_test.rb +396 -0
- data/rails/activesupport/test/option_merger_test.rb +95 -0
- data/rails/activesupport/test/ordered_hash_test.rb +322 -0
- data/rails/activesupport/test/ordered_options_test.rb +88 -0
- data/rails/activesupport/test/rescuable_test.rb +105 -0
- data/rails/activesupport/test/safe_buffer_test.rb +180 -0
- data/rails/activesupport/test/security_utils_test.rb +9 -0
- data/rails/activesupport/test/string_inquirer_test.rb +23 -0
- data/rails/activesupport/test/subscriber_test.rb +54 -0
- data/rails/activesupport/test/tagged_logging_test.rb +102 -0
- data/rails/activesupport/test/test_case_test.rb +221 -0
- data/rails/activesupport/test/testing/constant_lookup_test.rb +76 -0
- data/rails/activesupport/test/time_travel_test.rb +72 -0
- data/rails/activesupport/test/time_zone_test.rb +422 -0
- data/rails/activesupport/test/time_zone_test_helpers.rb +16 -0
- data/rails/activesupport/test/transliterate_test.rb +35 -0
- data/rails/activesupport/test/xml_mini/jdom_engine_test.rb +188 -0
- data/rails/activesupport/test/xml_mini/libxml_engine_test.rb +204 -0
- data/rails/activesupport/test/xml_mini/libxmlsax_engine_test.rb +195 -0
- data/rails/activesupport/test/xml_mini/nokogiri_engine_test.rb +217 -0
- data/rails/activesupport/test/xml_mini/nokogirisax_engine_test.rb +218 -0
- data/rails/activesupport/test/xml_mini/rexml_engine_test.rb +37 -0
- data/rails/activesupport/test/xml_mini_test.rb +353 -0
- data/rails/ci/travis.rb +145 -0
- data/rails/guides/.document +0 -0
- data/rails/guides/CHANGELOG.md +31 -0
- data/rails/guides/Rakefile +79 -0
- data/rails/guides/assets/images/akshaysurve.jpg +0 -0
- data/rails/guides/assets/images/belongs_to.png +0 -0
- data/rails/guides/assets/images/book_icon.gif +0 -0
- data/rails/guides/assets/images/bullet.gif +0 -0
- data/rails/guides/assets/images/chapters_icon.gif +0 -0
- data/rails/guides/assets/images/check_bullet.gif +0 -0
- data/rails/guides/assets/images/credits_pic_blank.gif +0 -0
- data/rails/guides/assets/images/csrf.png +0 -0
- data/rails/guides/assets/images/edge_badge.png +0 -0
- data/rails/guides/assets/images/favicon.ico +0 -0
- data/rails/guides/assets/images/feature_tile.gif +0 -0
- data/rails/guides/assets/images/footer_tile.gif +0 -0
- data/rails/guides/assets/images/fxn.png +0 -0
- data/rails/guides/assets/images/getting_started/article_with_comments.png +0 -0
- data/rails/guides/assets/images/getting_started/challenge.png +0 -0
- data/rails/guides/assets/images/getting_started/confirm_dialog.png +0 -0
- data/rails/guides/assets/images/getting_started/forbidden_attributes_for_new_article.png +0 -0
- data/rails/guides/assets/images/getting_started/form_with_errors.png +0 -0
- data/rails/guides/assets/images/getting_started/index_action_with_edit_link.png +0 -0
- data/rails/guides/assets/images/getting_started/new_article.png +0 -0
- data/rails/guides/assets/images/getting_started/rails_welcome.png +0 -0
- data/rails/guides/assets/images/getting_started/routing_error_no_controller.png +0 -0
- data/rails/guides/assets/images/getting_started/routing_error_no_route_matches.png +0 -0
- data/rails/guides/assets/images/getting_started/show_action_for_articles.png +0 -0
- data/rails/guides/assets/images/getting_started/template_is_missing_articles_new.png +0 -0
- data/rails/guides/assets/images/getting_started/unknown_action_create_for_articles.png +0 -0
- data/rails/guides/assets/images/getting_started/unknown_action_new_for_articles.png +0 -0
- data/rails/guides/assets/images/grey_bullet.gif +0 -0
- data/rails/guides/assets/images/habtm.png +0 -0
- data/rails/guides/assets/images/has_many.png +0 -0
- data/rails/guides/assets/images/has_many_through.png +0 -0
- data/rails/guides/assets/images/has_one.png +0 -0
- data/rails/guides/assets/images/has_one_through.png +0 -0
- data/rails/guides/assets/images/header_backdrop.png +0 -0
- data/rails/guides/assets/images/header_tile.gif +0 -0
- data/rails/guides/assets/images/i18n/demo_html_safe.png +0 -0
- data/rails/guides/assets/images/i18n/demo_localized_pirate.png +0 -0
- data/rails/guides/assets/images/i18n/demo_translated_en.png +0 -0
- data/rails/guides/assets/images/i18n/demo_translated_pirate.png +0 -0
- data/rails/guides/assets/images/i18n/demo_translation_missing.png +0 -0
- data/rails/guides/assets/images/i18n/demo_untranslated.png +0 -0
- data/rails/guides/assets/images/icons/README +5 -0
- data/rails/guides/assets/images/icons/callouts/1.png +0 -0
- data/rails/guides/assets/images/icons/callouts/10.png +0 -0
- data/rails/guides/assets/images/icons/callouts/11.png +0 -0
- data/rails/guides/assets/images/icons/callouts/12.png +0 -0
- data/rails/guides/assets/images/icons/callouts/13.png +0 -0
- data/rails/guides/assets/images/icons/callouts/14.png +0 -0
- data/rails/guides/assets/images/icons/callouts/15.png +0 -0
- data/rails/guides/assets/images/icons/callouts/2.png +0 -0
- data/rails/guides/assets/images/icons/callouts/3.png +0 -0
- data/rails/guides/assets/images/icons/callouts/4.png +0 -0
- data/rails/guides/assets/images/icons/callouts/5.png +0 -0
- data/rails/guides/assets/images/icons/callouts/6.png +0 -0
- data/rails/guides/assets/images/icons/callouts/7.png +0 -0
- data/rails/guides/assets/images/icons/callouts/8.png +0 -0
- data/rails/guides/assets/images/icons/callouts/9.png +0 -0
- data/rails/guides/assets/images/icons/caution.png +0 -0
- data/rails/guides/assets/images/icons/example.png +0 -0
- data/rails/guides/assets/images/icons/home.png +0 -0
- data/rails/guides/assets/images/icons/important.png +0 -0
- data/rails/guides/assets/images/icons/next.png +0 -0
- data/rails/guides/assets/images/icons/note.png +0 -0
- data/rails/guides/assets/images/icons/prev.png +0 -0
- data/rails/guides/assets/images/icons/tip.png +0 -0
- data/rails/guides/assets/images/icons/up.png +0 -0
- data/rails/guides/assets/images/icons/warning.png +0 -0
- data/rails/guides/assets/images/nav_arrow.gif +0 -0
- data/rails/guides/assets/images/oscardelben.jpg +0 -0
- data/rails/guides/assets/images/polymorphic.png +0 -0
- data/rails/guides/assets/images/radar.png +0 -0
- data/rails/guides/assets/images/rails4_features.png +0 -0
- data/rails/guides/assets/images/rails_guides_kindle_cover.jpg +0 -0
- data/rails/guides/assets/images/rails_guides_logo.gif +0 -0
- data/rails/guides/assets/images/rails_logo_remix.gif +0 -0
- data/rails/guides/assets/images/session_fixation.png +0 -0
- data/rails/guides/assets/images/tab_grey.gif +0 -0
- data/rails/guides/assets/images/tab_info.gif +0 -0
- data/rails/guides/assets/images/tab_note.gif +0 -0
- data/rails/guides/assets/images/tab_red.gif +0 -0
- data/rails/guides/assets/images/tab_yellow.gif +0 -0
- data/rails/guides/assets/images/tab_yellow.png +0 -0
- data/rails/guides/assets/images/vijaydev.jpg +0 -0
- data/rails/guides/assets/javascripts/guides.js +59 -0
- data/rails/guides/assets/javascripts/jquery.min.js +4 -0
- data/rails/guides/assets/javascripts/responsive-tables.js +43 -0
- data/rails/guides/assets/javascripts/syntaxhighlighter/shBrushAS3.js +59 -0
- data/rails/guides/assets/javascripts/syntaxhighlighter/shBrushAppleScript.js +75 -0
- data/rails/guides/assets/javascripts/syntaxhighlighter/shBrushBash.js +59 -0
- data/rails/guides/assets/javascripts/syntaxhighlighter/shBrushCSharp.js +65 -0
- data/rails/guides/assets/javascripts/syntaxhighlighter/shBrushColdFusion.js +100 -0
- data/rails/guides/assets/javascripts/syntaxhighlighter/shBrushCpp.js +97 -0
- data/rails/guides/assets/javascripts/syntaxhighlighter/shBrushCss.js +91 -0
- data/rails/guides/assets/javascripts/syntaxhighlighter/shBrushDelphi.js +55 -0
- data/rails/guides/assets/javascripts/syntaxhighlighter/shBrushDiff.js +41 -0
- data/rails/guides/assets/javascripts/syntaxhighlighter/shBrushErlang.js +52 -0
- data/rails/guides/assets/javascripts/syntaxhighlighter/shBrushGroovy.js +67 -0
- data/rails/guides/assets/javascripts/syntaxhighlighter/shBrushJScript.js +52 -0
- data/rails/guides/assets/javascripts/syntaxhighlighter/shBrushJava.js +57 -0
- data/rails/guides/assets/javascripts/syntaxhighlighter/shBrushJavaFX.js +58 -0
- data/rails/guides/assets/javascripts/syntaxhighlighter/shBrushPerl.js +72 -0
- data/rails/guides/assets/javascripts/syntaxhighlighter/shBrushPhp.js +88 -0
- data/rails/guides/assets/javascripts/syntaxhighlighter/shBrushPlain.js +33 -0
- data/rails/guides/assets/javascripts/syntaxhighlighter/shBrushPowerShell.js +74 -0
- data/rails/guides/assets/javascripts/syntaxhighlighter/shBrushPython.js +64 -0
- data/rails/guides/assets/javascripts/syntaxhighlighter/shBrushRuby.js +55 -0
- data/rails/guides/assets/javascripts/syntaxhighlighter/shBrushSass.js +94 -0
- data/rails/guides/assets/javascripts/syntaxhighlighter/shBrushScala.js +51 -0
- data/rails/guides/assets/javascripts/syntaxhighlighter/shBrushSql.js +66 -0
- data/rails/guides/assets/javascripts/syntaxhighlighter/shBrushVb.js +56 -0
- data/rails/guides/assets/javascripts/syntaxhighlighter/shBrushXml.js +69 -0
- data/rails/guides/assets/javascripts/syntaxhighlighter/shCore.js +17 -0
- data/rails/guides/assets/stylesheets/fixes.css +16 -0
- data/rails/guides/assets/stylesheets/kindle.css +11 -0
- data/rails/guides/assets/stylesheets/main.css +713 -0
- data/rails/guides/assets/stylesheets/print.css +52 -0
- data/rails/guides/assets/stylesheets/reset.css +43 -0
- data/rails/guides/assets/stylesheets/responsive-tables.css +50 -0
- data/rails/guides/assets/stylesheets/style.css +13 -0
- data/rails/guides/assets/stylesheets/syntaxhighlighter/shCore.css +226 -0
- data/rails/guides/assets/stylesheets/syntaxhighlighter/shCoreDefault.css +328 -0
- data/rails/guides/assets/stylesheets/syntaxhighlighter/shCoreDjango.css +331 -0
- data/rails/guides/assets/stylesheets/syntaxhighlighter/shCoreEclipse.css +339 -0
- data/rails/guides/assets/stylesheets/syntaxhighlighter/shCoreEmacs.css +324 -0
- data/rails/guides/assets/stylesheets/syntaxhighlighter/shCoreFadeToGrey.css +328 -0
- data/rails/guides/assets/stylesheets/syntaxhighlighter/shCoreMDUltra.css +324 -0
- data/rails/guides/assets/stylesheets/syntaxhighlighter/shCoreMidnight.css +324 -0
- data/rails/guides/assets/stylesheets/syntaxhighlighter/shCoreRDark.css +324 -0
- data/rails/guides/assets/stylesheets/syntaxhighlighter/shThemeDefault.css +117 -0
- data/rails/guides/assets/stylesheets/syntaxhighlighter/shThemeDjango.css +120 -0
- data/rails/guides/assets/stylesheets/syntaxhighlighter/shThemeEclipse.css +128 -0
- data/rails/guides/assets/stylesheets/syntaxhighlighter/shThemeEmacs.css +113 -0
- data/rails/guides/assets/stylesheets/syntaxhighlighter/shThemeFadeToGrey.css +117 -0
- data/rails/guides/assets/stylesheets/syntaxhighlighter/shThemeMDUltra.css +113 -0
- data/rails/guides/assets/stylesheets/syntaxhighlighter/shThemeMidnight.css +113 -0
- data/rails/guides/assets/stylesheets/syntaxhighlighter/shThemeRDark.css +113 -0
- data/rails/guides/assets/stylesheets/syntaxhighlighter/shThemeRailsGuides.css +116 -0
- data/rails/guides/bug_report_templates/action_controller_gem.rb +47 -0
- data/rails/guides/bug_report_templates/action_controller_master.rb +54 -0
- data/rails/guides/bug_report_templates/active_record_gem.rb +40 -0
- data/rails/guides/bug_report_templates/active_record_master.rb +49 -0
- data/rails/guides/rails_guides/generator.rb +248 -0
- data/rails/guides/rails_guides/helpers.rb +53 -0
- data/rails/guides/rails_guides/indexer.rb +68 -0
- data/rails/guides/rails_guides/kindle.rb +119 -0
- data/rails/guides/rails_guides/levenshtein.rb +39 -0
- data/rails/guides/rails_guides/markdown/renderer.rb +82 -0
- data/rails/guides/rails_guides/markdown.rb +167 -0
- data/rails/guides/rails_guides.rb +63 -0
- data/rails/guides/source/2_2_release_notes.md +435 -0
- data/rails/guides/source/2_3_release_notes.md +621 -0
- data/rails/guides/source/3_0_release_notes.md +611 -0
- data/rails/guides/source/3_1_release_notes.md +559 -0
- data/rails/guides/source/3_2_release_notes.md +568 -0
- data/rails/guides/source/4_0_release_notes.md +279 -0
- data/rails/guides/source/4_1_release_notes.md +730 -0
- data/rails/guides/source/4_2_release_notes.md +853 -0
- data/rails/guides/source/_license.html.erb +2 -0
- data/rails/guides/source/_welcome.html.erb +19 -0
- data/rails/guides/source/action_controller_overview.md +1192 -0
- data/rails/guides/source/action_mailer_basics.md +754 -0
- data/rails/guides/source/action_view_overview.md +1620 -0
- data/rails/guides/source/active_job_basics.md +318 -0
- data/rails/guides/source/active_model_basics.md +554 -0
- data/rails/guides/source/active_record_basics.md +374 -0
- data/rails/guides/source/active_record_callbacks.md +413 -0
- data/rails/guides/source/active_record_migrations.md +1018 -0
- data/rails/guides/source/active_record_postgresql.md +433 -0
- data/rails/guides/source/active_record_querying.md +1783 -0
- data/rails/guides/source/active_record_validations.md +1178 -0
- data/rails/guides/source/active_support_core_extensions.md +3904 -0
- data/rails/guides/source/active_support_instrumentation.md +499 -0
- data/rails/guides/source/api_documentation_guidelines.md +361 -0
- data/rails/guides/source/asset_pipeline.md +1360 -0
- data/rails/guides/source/association_basics.md +2235 -0
- data/rails/guides/source/autoloading_and_reloading_constants.md +1310 -0
- data/rails/guides/source/caching_with_rails.md +379 -0
- data/rails/guides/source/command_line.md +625 -0
- data/rails/guides/source/configuring.md +1045 -0
- data/rails/guides/source/contributing_to_ruby_on_rails.md +628 -0
- data/rails/guides/source/credits.html.erb +80 -0
- data/rails/guides/source/debugging_rails_applications.md +861 -0
- data/rails/guides/source/development_dependencies_install.md +289 -0
- data/rails/guides/source/documents.yaml +205 -0
- data/rails/guides/source/engines.md +1412 -0
- data/rails/guides/source/form_helpers.md +1024 -0
- data/rails/guides/source/generators.md +676 -0
- data/rails/guides/source/getting_started.md +2091 -0
- data/rails/guides/source/i18n.md +1087 -0
- data/rails/guides/source/index.html.erb +28 -0
- data/rails/guides/source/initialization.md +704 -0
- data/rails/guides/source/kindle/copyright.html.erb +1 -0
- data/rails/guides/source/kindle/layout.html.erb +27 -0
- data/rails/guides/source/kindle/rails_guides.opf.erb +52 -0
- data/rails/guides/source/kindle/toc.html.erb +24 -0
- data/rails/guides/source/kindle/toc.ncx.erb +64 -0
- data/rails/guides/source/kindle/welcome.html.erb +5 -0
- data/rails/guides/source/layout.html.erb +143 -0
- data/rails/guides/source/layouts_and_rendering.md +1227 -0
- data/rails/guides/source/maintenance_policy.md +78 -0
- data/rails/guides/source/nested_model_forms.md +228 -0
- data/rails/guides/source/plugins.md +444 -0
- data/rails/guides/source/rails_application_templates.md +266 -0
- data/rails/guides/source/rails_on_rack.md +336 -0
- data/rails/guides/source/routing.md +1141 -0
- data/rails/guides/source/ruby_on_rails_guides_guidelines.md +127 -0
- data/rails/guides/source/security.md +1024 -0
- data/rails/guides/source/testing.md +1132 -0
- data/rails/guides/source/upgrading_ruby_on_rails.md +1170 -0
- data/rails/guides/source/working_with_javascript_in_rails.md +407 -0
- data/rails/guides/w3c_validator.rb +97 -0
- data/rails/install.rb +16 -0
- data/rails/load_paths.rb +3 -0
- data/rails/rails.gemspec +32 -0
- data/rails/railties/.gitignore +1 -0
- data/rails/railties/CHANGELOG.md +233 -0
- data/rails/railties/MIT-LICENSE +20 -0
- data/rails/railties/RDOC_MAIN.rdoc +73 -0
- data/rails/railties/README.rdoc +41 -0
- data/rails/railties/Rakefile +50 -0
- data/rails/railties/bin/rails +9 -0
- data/rails/railties/lib/rails/all.rb +16 -0
- data/rails/railties/lib/rails/api/task.rb +170 -0
- data/rails/railties/lib/rails/app_rails_loader.rb +63 -0
- data/rails/railties/lib/rails/application/bootstrap.rb +94 -0
- data/rails/railties/lib/rails/application/configuration.rb +208 -0
- data/rails/railties/lib/rails/application/default_middleware_stack.rb +103 -0
- data/rails/railties/lib/rails/application/finisher.rb +113 -0
- data/rails/railties/lib/rails/application/routes_reloader.rb +56 -0
- data/rails/railties/lib/rails/application.rb +539 -0
- data/rails/railties/lib/rails/application_controller.rb +16 -0
- data/rails/railties/lib/rails/backtrace_cleaner.rb +32 -0
- data/rails/railties/lib/rails/cli.rb +15 -0
- data/rails/railties/lib/rails/code_statistics.rb +104 -0
- data/rails/railties/lib/rails/code_statistics_calculator.rb +79 -0
- data/rails/railties/lib/rails/commands/application.rb +17 -0
- data/rails/railties/lib/rails/commands/commands_tasks.rb +169 -0
- data/rails/railties/lib/rails/commands/console.rb +113 -0
- data/rails/railties/lib/rails/commands/dbconsole.rb +192 -0
- data/rails/railties/lib/rails/commands/destroy.rb +11 -0
- data/rails/railties/lib/rails/commands/generate.rb +13 -0
- data/rails/railties/lib/rails/commands/plugin.rb +23 -0
- data/rails/railties/lib/rails/commands/runner.rb +63 -0
- data/rails/railties/lib/rails/commands/server.rb +148 -0
- data/rails/railties/lib/rails/commands.rb +17 -0
- data/rails/railties/lib/rails/configuration.rb +119 -0
- data/rails/railties/lib/rails/console/app.rb +32 -0
- data/rails/railties/lib/rails/console/helpers.rb +17 -0
- data/rails/railties/lib/rails/deprecation.rb +19 -0
- data/rails/railties/lib/rails/engine/commands.rb +41 -0
- data/rails/railties/lib/rails/engine/configuration.rb +91 -0
- data/rails/railties/lib/rails/engine/railties.rb +21 -0
- data/rails/railties/lib/rails/engine.rb +694 -0
- data/rails/railties/lib/rails/gem_version.rb +15 -0
- data/rails/railties/lib/rails/generators/actions/create_migration.rb +69 -0
- data/rails/railties/lib/rails/generators/actions.rb +282 -0
- data/rails/railties/lib/rails/generators/active_model.rb +78 -0
- data/rails/railties/lib/rails/generators/app_base.rb +354 -0
- data/rails/railties/lib/rails/generators/base.rb +379 -0
- data/rails/railties/lib/rails/generators/css/assets/assets_generator.rb +13 -0
- data/rails/railties/lib/rails/generators/css/assets/templates/stylesheet.css +4 -0
- data/rails/railties/lib/rails/generators/css/scaffold/scaffold_generator.rb +16 -0
- data/rails/railties/lib/rails/generators/erb/controller/controller_generator.rb +22 -0
- data/rails/railties/lib/rails/generators/erb/controller/templates/view.html.erb +2 -0
- data/rails/railties/lib/rails/generators/erb/mailer/mailer_generator.rb +36 -0
- data/rails/railties/lib/rails/generators/erb/mailer/templates/layout.html.erb +5 -0
- data/rails/railties/lib/rails/generators/erb/mailer/templates/layout.text.erb +1 -0
- data/rails/railties/lib/rails/generators/erb/mailer/templates/view.html.erb +5 -0
- data/rails/railties/lib/rails/generators/erb/mailer/templates/view.text.erb +3 -0
- data/rails/railties/lib/rails/generators/erb/scaffold/scaffold_generator.rb +31 -0
- data/rails/railties/lib/rails/generators/erb/scaffold/templates/_form.html.erb +32 -0
- data/rails/railties/lib/rails/generators/erb/scaffold/templates/edit.html.erb +6 -0
- data/rails/railties/lib/rails/generators/erb/scaffold/templates/index.html.erb +31 -0
- data/rails/railties/lib/rails/generators/erb/scaffold/templates/new.html.erb +5 -0
- data/rails/railties/lib/rails/generators/erb/scaffold/templates/show.html.erb +11 -0
- data/rails/railties/lib/rails/generators/erb.rb +25 -0
- data/rails/railties/lib/rails/generators/generated_attribute.rb +170 -0
- data/rails/railties/lib/rails/generators/js/assets/assets_generator.rb +13 -0
- data/rails/railties/lib/rails/generators/js/assets/templates/javascript.js +2 -0
- data/rails/railties/lib/rails/generators/migration.rb +69 -0
- data/rails/railties/lib/rails/generators/model_helpers.rb +28 -0
- data/rails/railties/lib/rails/generators/named_base.rb +205 -0
- data/rails/railties/lib/rails/generators/rails/app/USAGE +15 -0
- data/rails/railties/lib/rails/generators/rails/app/app_generator.rb +407 -0
- data/rails/railties/lib/rails/generators/rails/app/templates/Gemfile +46 -0
- data/rails/railties/lib/rails/generators/rails/app/templates/README.rdoc +28 -0
- data/rails/railties/lib/rails/generators/rails/app/templates/Rakefile +6 -0
- data/rails/railties/lib/rails/generators/rails/app/templates/app/assets/javascripts/application.js.tt +20 -0
- data/rails/railties/lib/rails/generators/rails/app/templates/app/assets/stylesheets/application.css +15 -0
- data/rails/railties/lib/rails/generators/rails/app/templates/app/controllers/application_controller.rb.tt +5 -0
- data/rails/railties/lib/rails/generators/rails/app/templates/app/helpers/application_helper.rb +2 -0
- data/rails/railties/lib/rails/generators/rails/app/templates/app/views/layouts/application.html.erb.tt +23 -0
- data/rails/railties/lib/rails/generators/rails/app/templates/bin/bundle +2 -0
- data/rails/railties/lib/rails/generators/rails/app/templates/bin/rails +3 -0
- data/rails/railties/lib/rails/generators/rails/app/templates/bin/rake +3 -0
- data/rails/railties/lib/rails/generators/rails/app/templates/bin/setup +28 -0
- data/rails/railties/lib/rails/generators/rails/app/templates/config/application.rb +41 -0
- data/rails/railties/lib/rails/generators/rails/app/templates/config/boot.rb +3 -0
- data/rails/railties/lib/rails/generators/rails/app/templates/config/databases/frontbase.yml +49 -0
- data/rails/railties/lib/rails/generators/rails/app/templates/config/databases/ibm_db.yml +85 -0
- data/rails/railties/lib/rails/generators/rails/app/templates/config/databases/jdbc.yml +68 -0
- data/rails/railties/lib/rails/generators/rails/app/templates/config/databases/jdbcmysql.yml +52 -0
- data/rails/railties/lib/rails/generators/rails/app/templates/config/databases/jdbcpostgresql.yml +68 -0
- data/rails/railties/lib/rails/generators/rails/app/templates/config/databases/jdbcsqlite3.yml +23 -0
- data/rails/railties/lib/rails/generators/rails/app/templates/config/databases/mysql.yml +58 -0
- data/rails/railties/lib/rails/generators/rails/app/templates/config/databases/oracle.yml +58 -0
- data/rails/railties/lib/rails/generators/rails/app/templates/config/databases/postgresql.yml +85 -0
- data/rails/railties/lib/rails/generators/rails/app/templates/config/databases/sqlite3.yml +25 -0
- data/rails/railties/lib/rails/generators/rails/app/templates/config/databases/sqlserver.yml +68 -0
- data/rails/railties/lib/rails/generators/rails/app/templates/config/environment.rb +5 -0
- data/rails/railties/lib/rails/generators/rails/app/templates/config/environments/development.rb.tt +45 -0
- data/rails/railties/lib/rails/generators/rails/app/templates/config/environments/production.rb.tt +83 -0
- data/rails/railties/lib/rails/generators/rails/app/templates/config/environments/test.rb.tt +42 -0
- data/rails/railties/lib/rails/generators/rails/app/templates/config/initializers/assets.rb.tt +11 -0
- data/rails/railties/lib/rails/generators/rails/app/templates/config/initializers/backtrace_silencers.rb +7 -0
- data/rails/railties/lib/rails/generators/rails/app/templates/config/initializers/cookies_serializer.rb +3 -0
- data/rails/railties/lib/rails/generators/rails/app/templates/config/initializers/filter_parameter_logging.rb +4 -0
- data/rails/railties/lib/rails/generators/rails/app/templates/config/initializers/inflections.rb +16 -0
- data/rails/railties/lib/rails/generators/rails/app/templates/config/initializers/mime_types.rb +4 -0
- data/rails/railties/lib/rails/generators/rails/app/templates/config/initializers/session_store.rb.tt +3 -0
- data/rails/railties/lib/rails/generators/rails/app/templates/config/initializers/wrap_parameters.rb.tt +16 -0
- data/rails/railties/lib/rails/generators/rails/app/templates/config/locales/en.yml +23 -0
- data/rails/railties/lib/rails/generators/rails/app/templates/config/routes.rb +56 -0
- data/rails/railties/lib/rails/generators/rails/app/templates/config/secrets.yml +22 -0
- data/rails/railties/lib/rails/generators/rails/app/templates/config.ru +4 -0
- data/rails/railties/lib/rails/generators/rails/app/templates/db/seeds.rb.tt +7 -0
- data/rails/railties/lib/rails/generators/rails/app/templates/gitignore +19 -0
- data/rails/railties/lib/rails/generators/rails/app/templates/public/404.html +67 -0
- data/rails/railties/lib/rails/generators/rails/app/templates/public/422.html +67 -0
- data/rails/railties/lib/rails/generators/rails/app/templates/public/500.html +66 -0
- data/rails/railties/lib/rails/generators/rails/app/templates/public/favicon.ico +0 -0
- data/rails/railties/lib/rails/generators/rails/app/templates/public/robots.txt +5 -0
- data/rails/railties/lib/rails/generators/rails/app/templates/test/test_helper.rb +12 -0
- data/rails/railties/lib/rails/generators/rails/assets/USAGE +20 -0
- data/rails/railties/lib/rails/generators/rails/assets/assets_generator.rb +25 -0
- data/rails/railties/lib/rails/generators/rails/assets/templates/javascript.js +2 -0
- data/rails/railties/lib/rails/generators/rails/assets/templates/stylesheet.css +4 -0
- data/rails/railties/lib/rails/generators/rails/controller/USAGE +18 -0
- data/rails/railties/lib/rails/generators/rails/controller/controller_generator.rb +58 -0
- data/rails/railties/lib/rails/generators/rails/controller/templates/controller.rb +13 -0
- data/rails/railties/lib/rails/generators/rails/generator/USAGE +13 -0
- data/rails/railties/lib/rails/generators/rails/generator/generator_generator.rb +27 -0
- data/rails/railties/lib/rails/generators/rails/generator/templates/%file_name%_generator.rb.tt +3 -0
- data/rails/railties/lib/rails/generators/rails/generator/templates/USAGE.tt +8 -0
- data/rails/railties/lib/rails/generators/rails/generator/templates/templates/.empty_directory +0 -0
- data/rails/railties/lib/rails/generators/rails/helper/USAGE +13 -0
- data/rails/railties/lib/rails/generators/rails/helper/helper_generator.rb +13 -0
- data/rails/railties/lib/rails/generators/rails/helper/templates/helper.rb +4 -0
- data/rails/railties/lib/rails/generators/rails/integration_test/USAGE +10 -0
- data/rails/railties/lib/rails/generators/rails/integration_test/integration_test_generator.rb +7 -0
- data/rails/railties/lib/rails/generators/rails/migration/USAGE +35 -0
- data/rails/railties/lib/rails/generators/rails/migration/migration_generator.rb +8 -0
- data/rails/railties/lib/rails/generators/rails/model/USAGE +109 -0
- data/rails/railties/lib/rails/generators/rails/model/model_generator.rb +12 -0
- data/rails/railties/lib/rails/generators/rails/plugin/USAGE +10 -0
- data/rails/railties/lib/rails/generators/rails/plugin/plugin_generator.rb +393 -0
- data/rails/railties/lib/rails/generators/rails/plugin/templates/%name%.gemspec +27 -0
- data/rails/railties/lib/rails/generators/rails/plugin/templates/Gemfile +51 -0
- data/rails/railties/lib/rails/generators/rails/plugin/templates/MIT-LICENSE +20 -0
- data/rails/railties/lib/rails/generators/rails/plugin/templates/README.rdoc +3 -0
- data/rails/railties/lib/rails/generators/rails/plugin/templates/Rakefile +29 -0
- data/rails/railties/lib/rails/generators/rails/plugin/templates/app/controllers/%name%/application_controller.rb.tt +4 -0
- data/rails/railties/lib/rails/generators/rails/plugin/templates/app/helpers/%name%/application_helper.rb.tt +4 -0
- data/rails/railties/lib/rails/generators/rails/plugin/templates/app/mailers/.empty_directory +0 -0
- data/rails/railties/lib/rails/generators/rails/plugin/templates/app/models/.empty_directory +0 -0
- data/rails/railties/lib/rails/generators/rails/plugin/templates/app/views/layouts/%name%/application.html.erb.tt +14 -0
- data/rails/railties/lib/rails/generators/rails/plugin/templates/bin/rails.tt +11 -0
- data/rails/railties/lib/rails/generators/rails/plugin/templates/config/routes.rb +6 -0
- data/rails/railties/lib/rails/generators/rails/plugin/templates/gitignore +10 -0
- data/rails/railties/lib/rails/generators/rails/plugin/templates/lib/%name%/engine.rb +7 -0
- data/rails/railties/lib/rails/generators/rails/plugin/templates/lib/%name%/version.rb +3 -0
- data/rails/railties/lib/rails/generators/rails/plugin/templates/lib/%name%.rb +6 -0
- data/rails/railties/lib/rails/generators/rails/plugin/templates/lib/tasks/%name%_tasks.rake +4 -0
- data/rails/railties/lib/rails/generators/rails/plugin/templates/rails/application.rb +18 -0
- data/rails/railties/lib/rails/generators/rails/plugin/templates/rails/boot.rb +5 -0
- data/rails/railties/lib/rails/generators/rails/plugin/templates/rails/javascripts.js +13 -0
- data/rails/railties/lib/rails/generators/rails/plugin/templates/rails/routes.rb +4 -0
- data/rails/railties/lib/rails/generators/rails/plugin/templates/rails/stylesheets.css +15 -0
- data/rails/railties/lib/rails/generators/rails/plugin/templates/test/%name%_test.rb +7 -0
- data/rails/railties/lib/rails/generators/rails/plugin/templates/test/integration/navigation_test.rb +12 -0
- data/rails/railties/lib/rails/generators/rails/plugin/templates/test/test_helper.rb +24 -0
- data/rails/railties/lib/rails/generators/rails/resource/USAGE +23 -0
- data/rails/railties/lib/rails/generators/rails/resource/resource_generator.rb +20 -0
- data/rails/railties/lib/rails/generators/rails/resource_route/resource_route_generator.rb +50 -0
- data/rails/railties/lib/rails/generators/rails/scaffold/USAGE +41 -0
- data/rails/railties/lib/rails/generators/rails/scaffold/scaffold_generator.rb +32 -0
- data/rails/railties/lib/rails/generators/rails/scaffold/templates/scaffold.css +56 -0
- data/rails/railties/lib/rails/generators/rails/scaffold_controller/USAGE +19 -0
- data/rails/railties/lib/rails/generators/rails/scaffold_controller/scaffold_controller_generator.rb +28 -0
- data/rails/railties/lib/rails/generators/rails/scaffold_controller/templates/controller.rb +68 -0
- data/rails/railties/lib/rails/generators/rails/task/USAGE +9 -0
- data/rails/railties/lib/rails/generators/rails/task/task_generator.rb +12 -0
- data/rails/railties/lib/rails/generators/rails/task/templates/task.rb +8 -0
- data/rails/railties/lib/rails/generators/resource_helpers.rb +82 -0
- data/rails/railties/lib/rails/generators/test_case.rb +36 -0
- data/rails/railties/lib/rails/generators/test_unit/controller/controller_generator.rb +15 -0
- data/rails/railties/lib/rails/generators/test_unit/controller/templates/functional_test.rb +19 -0
- data/rails/railties/lib/rails/generators/test_unit/generator/generator_generator.rb +26 -0
- data/rails/railties/lib/rails/generators/test_unit/generator/templates/generator_test.rb +16 -0
- data/rails/railties/lib/rails/generators/test_unit/helper/helper_generator.rb +9 -0
- data/rails/railties/lib/rails/generators/test_unit/integration/integration_generator.rb +13 -0
- data/rails/railties/lib/rails/generators/test_unit/integration/templates/integration_test.rb +7 -0
- data/rails/railties/lib/rails/generators/test_unit/job/job_generator.rb +13 -0
- data/rails/railties/lib/rails/generators/test_unit/job/templates/unit_test.rb.erb +9 -0
- data/rails/railties/lib/rails/generators/test_unit/mailer/mailer_generator.rb +21 -0
- data/rails/railties/lib/rails/generators/test_unit/mailer/templates/functional_test.rb +21 -0
- data/rails/railties/lib/rails/generators/test_unit/mailer/templates/preview.rb +13 -0
- data/rails/railties/lib/rails/generators/test_unit/model/model_generator.rb +36 -0
- data/rails/railties/lib/rails/generators/test_unit/model/templates/fixtures.yml +27 -0
- data/rails/railties/lib/rails/generators/test_unit/model/templates/unit_test.rb +9 -0
- data/rails/railties/lib/rails/generators/test_unit/plugin/plugin_generator.rb +13 -0
- data/rails/railties/lib/rails/generators/test_unit/plugin/templates/%file_name%_test.rb.tt +7 -0
- data/rails/railties/lib/rails/generators/test_unit/plugin/templates/test_helper.rb +2 -0
- data/rails/railties/lib/rails/generators/test_unit/scaffold/scaffold_generator.rb +33 -0
- data/rails/railties/lib/rails/generators/test_unit/scaffold/templates/functional_test.rb +51 -0
- data/rails/railties/lib/rails/generators/test_unit.rb +8 -0
- data/rails/railties/lib/rails/generators/testing/assertions.rb +123 -0
- data/rails/railties/lib/rails/generators/testing/behaviour.rb +123 -0
- data/rails/railties/lib/rails/generators/testing/setup_and_teardown.rb +18 -0
- data/rails/railties/lib/rails/generators.rb +373 -0
- data/rails/railties/lib/rails/info.rb +102 -0
- data/rails/railties/lib/rails/info_controller.rb +23 -0
- data/rails/railties/lib/rails/initializable.rb +89 -0
- data/rails/railties/lib/rails/mailers_controller.rb +73 -0
- data/rails/railties/lib/rails/paths.rb +211 -0
- data/rails/railties/lib/rails/rack/debugger.rb +24 -0
- data/rails/railties/lib/rails/rack/log_tailer.rb +38 -0
- data/rails/railties/lib/rails/rack/logger.rb +86 -0
- data/rails/railties/lib/rails/rack.rb +7 -0
- data/rails/railties/lib/rails/railtie/configurable.rb +35 -0
- data/rails/railties/lib/rails/railtie/configuration.rb +100 -0
- data/rails/railties/lib/rails/railtie.rb +250 -0
- data/rails/railties/lib/rails/ruby_version_check.rb +13 -0
- data/rails/railties/lib/rails/source_annotation_extractor.rb +133 -0
- data/rails/railties/lib/rails/tasks/annotations.rake +20 -0
- data/rails/railties/lib/rails/tasks/documentation.rake +70 -0
- data/rails/railties/lib/rails/tasks/engine.rake +72 -0
- data/rails/railties/lib/rails/tasks/framework.rake +66 -0
- data/rails/railties/lib/rails/tasks/log.rake +23 -0
- data/rails/railties/lib/rails/tasks/middleware.rake +7 -0
- data/rails/railties/lib/rails/tasks/misc.rake +60 -0
- data/rails/railties/lib/rails/tasks/routes.rake +7 -0
- data/rails/railties/lib/rails/tasks/statistics.rake +29 -0
- data/rails/railties/lib/rails/tasks/tmp.rake +45 -0
- data/rails/railties/lib/rails/tasks.rb +14 -0
- data/rails/railties/lib/rails/templates/layouts/application.html.erb +36 -0
- data/rails/railties/lib/rails/templates/rails/info/properties.html.erb +1 -0
- data/rails/railties/lib/rails/templates/rails/info/routes.html.erb +9 -0
- data/rails/railties/lib/rails/templates/rails/mailers/email.html.erb +105 -0
- data/rails/railties/lib/rails/templates/rails/mailers/index.html.erb +8 -0
- data/rails/railties/lib/rails/templates/rails/mailers/mailer.html.erb +6 -0
- data/rails/railties/lib/rails/templates/rails/welcome/index.html.erb +261 -0
- data/rails/railties/lib/rails/test_help.rb +43 -0
- data/rails/railties/lib/rails/test_unit/railtie.rb +18 -0
- data/rails/railties/lib/rails/test_unit/sub_test_task.rb +126 -0
- data/rails/railties/lib/rails/test_unit/testing.rake +66 -0
- data/rails/railties/lib/rails/version.rb +8 -0
- data/rails/railties/lib/rails/welcome_controller.rb +8 -0
- data/rails/railties/lib/rails.rb +93 -0
- data/rails/railties/railties.gemspec +33 -0
- data/rails/railties/test/abstract_unit.rb +53 -0
- data/rails/railties/test/app_rails_loader_test.rb +89 -0
- data/rails/railties/test/application/asset_debugging_test.rb +64 -0
- data/rails/railties/test/application/assets_test.rb +493 -0
- data/rails/railties/test/application/build_original_fullpath_test.rb +27 -0
- data/rails/railties/test/application/configuration/base_test.rb +37 -0
- data/rails/railties/test/application/configuration/custom_test.rb +22 -0
- data/rails/railties/test/application/configuration_test.rb +1344 -0
- data/rails/railties/test/application/console_test.rb +153 -0
- data/rails/railties/test/application/generators_test.rb +129 -0
- data/rails/railties/test/application/initializers/frameworks_test.rb +231 -0
- data/rails/railties/test/application/initializers/hooks_test.rb +90 -0
- data/rails/railties/test/application/initializers/i18n_test.rb +216 -0
- data/rails/railties/test/application/initializers/load_path_test.rb +110 -0
- data/rails/railties/test/application/initializers/notifications_test.rb +56 -0
- data/rails/railties/test/application/loading_test.rb +341 -0
- data/rails/railties/test/application/mailer_previews_test.rb +494 -0
- data/rails/railties/test/application/middleware/cache_test.rb +180 -0
- data/rails/railties/test/application/middleware/cookies_test.rb +47 -0
- data/rails/railties/test/application/middleware/exceptions_test.rb +126 -0
- data/rails/railties/test/application/middleware/remote_ip_test.rb +78 -0
- data/rails/railties/test/application/middleware/sendfile_test.rb +74 -0
- data/rails/railties/test/application/middleware/session_test.rb +343 -0
- data/rails/railties/test/application/middleware/static_test.rb +31 -0
- data/rails/railties/test/application/middleware_test.rb +240 -0
- data/rails/railties/test/application/multiple_applications_test.rb +176 -0
- data/rails/railties/test/application/paths_test.rb +83 -0
- data/rails/railties/test/application/rack/logger_test.rb +56 -0
- data/rails/railties/test/application/rackup_test.rb +43 -0
- data/rails/railties/test/application/rake/dbs_test.rb +233 -0
- data/rails/railties/test/application/rake/migrations_test.rb +204 -0
- data/rails/railties/test/application/rake/notes_test.rb +156 -0
- data/rails/railties/test/application/rake_test.rb +286 -0
- data/rails/railties/test/application/rendering_test.rb +45 -0
- data/rails/railties/test/application/routing_test.rb +468 -0
- data/rails/railties/test/application/runner_test.rb +89 -0
- data/rails/railties/test/application/test_runner_test.rb +331 -0
- data/rails/railties/test/application/test_test.rb +322 -0
- data/rails/railties/test/application/url_generation_test.rb +46 -0
- data/rails/railties/test/backtrace_cleaner_test.rb +24 -0
- data/rails/railties/test/code_statistics_calculator_test.rb +288 -0
- data/rails/railties/test/commands/console_test.rb +176 -0
- data/rails/railties/test/commands/dbconsole_test.rb +274 -0
- data/rails/railties/test/commands/server_test.rb +88 -0
- data/rails/railties/test/configuration/middleware_stack_proxy_test.rb +61 -0
- data/rails/railties/test/engine_test.rb +25 -0
- data/rails/railties/test/env_helpers.rb +30 -0
- data/rails/railties/test/fixtures/about_yml_plugins/bad_about_yml/about.yml +1 -0
- data/rails/railties/test/fixtures/about_yml_plugins/bad_about_yml/init.rb +1 -0
- data/rails/railties/test/fixtures/about_yml_plugins/plugin_without_about_yml/init.rb +1 -0
- data/rails/railties/test/fixtures/lib/create_test_dummy_template.rb +1 -0
- data/rails/railties/test/fixtures/lib/generators/active_record/fixjour_generator.rb +8 -0
- data/rails/railties/test/fixtures/lib/generators/fixjour_generator.rb +2 -0
- data/rails/railties/test/fixtures/lib/generators/model_generator.rb +1 -0
- data/rails/railties/test/fixtures/lib/generators/usage_template/USAGE +1 -0
- data/rails/railties/test/fixtures/lib/generators/usage_template/usage_template_generator.rb +5 -0
- data/rails/railties/test/fixtures/lib/rails/generators/foobar/foobar_generator.rb +4 -0
- data/rails/railties/test/fixtures/lib/template.rb +1 -0
- data/rails/railties/test/generators/actions_test.rb +259 -0
- data/rails/railties/test/generators/app_generator_test.rb +528 -0
- data/rails/railties/test/generators/argv_scrubber_test.rb +136 -0
- data/rails/railties/test/generators/assets_generator_test.rb +19 -0
- data/rails/railties/test/generators/controller_generator_test.rb +101 -0
- data/rails/railties/test/generators/create_migration_test.rb +134 -0
- data/rails/railties/test/generators/generated_attribute_test.rb +152 -0
- data/rails/railties/test/generators/generator_generator_test.rb +71 -0
- data/rails/railties/test/generators/generator_test.rb +85 -0
- data/rails/railties/test/generators/generators_test_helper.rb +52 -0
- data/rails/railties/test/generators/helper_generator_test.rb +39 -0
- data/rails/railties/test/generators/integration_test_generator_test.rb +12 -0
- data/rails/railties/test/generators/mailer_generator_test.rb +170 -0
- data/rails/railties/test/generators/migration_generator_test.rb +288 -0
- data/rails/railties/test/generators/model_generator_test.rb +446 -0
- data/rails/railties/test/generators/named_base_test.rb +145 -0
- data/rails/railties/test/generators/namespaced_generators_test.rb +398 -0
- data/rails/railties/test/generators/orm_test.rb +38 -0
- data/rails/railties/test/generators/plugin_generator_test.rb +442 -0
- data/rails/railties/test/generators/resource_generator_test.rb +88 -0
- data/rails/railties/test/generators/scaffold_controller_generator_test.rb +177 -0
- data/rails/railties/test/generators/scaffold_generator_test.rb +386 -0
- data/rails/railties/test/generators/shared_generator_tests.rb +144 -0
- data/rails/railties/test/generators/task_generator_test.rb +24 -0
- data/rails/railties/test/generators_test.rb +234 -0
- data/rails/railties/test/initializable_test.rb +230 -0
- data/rails/railties/test/isolation/abstract_unit.rb +359 -0
- data/rails/railties/test/path_generation_test.rb +88 -0
- data/rails/railties/test/paths_test.rb +234 -0
- data/rails/railties/test/rack_logger_test.rb +75 -0
- data/rails/railties/test/rails_info_controller_test.rb +57 -0
- data/rails/railties/test/rails_info_test.rb +71 -0
- data/rails/railties/test/railties/engine_test.rb +1317 -0
- data/rails/railties/test/railties/generators_test.rb +126 -0
- data/rails/railties/test/railties/mounted_engine_test.rb +274 -0
- data/rails/railties/test/railties/railtie_test.rb +208 -0
- data/rails/railties/test/test_info_test.rb +60 -0
- data/rails/railties/test/version_test.rb +12 -0
- data/rails/tasks/release.rb +128 -0
- data/rails/tools/README.md +7 -0
- data/rails/tools/console +7 -0
- data/rails/tools/line_statistics +42 -0
- data/rails/tools/profile +136 -0
- data/rails/version.rb +15 -0
- data/test/cases/lock_test.rb +29 -0
- data/test/helper.rb +30 -0
- data/test/integration/lock_queuing_test.rb +43 -0
- metadata +3007 -0
@@ -0,0 +1,1725 @@
|
|
1
|
+
require 'active_support/core_ext/enumerable'
|
2
|
+
require 'active_support/core_ext/string/conversions'
|
3
|
+
require 'active_support/core_ext/module/remove_method'
|
4
|
+
require 'active_record/errors'
|
5
|
+
|
6
|
+
module ActiveRecord
|
7
|
+
class AssociationNotFoundError < ConfigurationError #:nodoc:
|
8
|
+
def initialize(record, association_name)
|
9
|
+
super("Association named '#{association_name}' was not found on #{record.class.name}; perhaps you misspelled it?")
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
class InverseOfAssociationNotFoundError < ActiveRecordError #:nodoc:
|
14
|
+
def initialize(reflection, associated_class = nil)
|
15
|
+
super("Could not find the inverse association for #{reflection.name} (#{reflection.options[:inverse_of].inspect} in #{associated_class.nil? ? reflection.class_name : associated_class.name})")
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
class HasManyThroughAssociationNotFoundError < ActiveRecordError #:nodoc:
|
20
|
+
def initialize(owner_class_name, reflection)
|
21
|
+
super("Could not find the association #{reflection.options[:through].inspect} in model #{owner_class_name}")
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
class HasManyThroughAssociationPolymorphicSourceError < ActiveRecordError #:nodoc:
|
26
|
+
def initialize(owner_class_name, reflection, source_reflection)
|
27
|
+
super("Cannot have a has_many :through association '#{owner_class_name}##{reflection.name}' on the polymorphic object '#{source_reflection.class_name}##{source_reflection.name}' without 'source_type'. Try adding 'source_type: \"#{reflection.name.to_s.classify}\"' to 'has_many :through' definition.")
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
class HasManyThroughAssociationPolymorphicThroughError < ActiveRecordError #:nodoc:
|
32
|
+
def initialize(owner_class_name, reflection)
|
33
|
+
super("Cannot have a has_many :through association '#{owner_class_name}##{reflection.name}' which goes through the polymorphic association '#{owner_class_name}##{reflection.through_reflection.name}'.")
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
class HasManyThroughAssociationPointlessSourceTypeError < ActiveRecordError #:nodoc:
|
38
|
+
def initialize(owner_class_name, reflection, source_reflection)
|
39
|
+
super("Cannot have a has_many :through association '#{owner_class_name}##{reflection.name}' with a :source_type option if the '#{reflection.through_reflection.class_name}##{source_reflection.name}' is not polymorphic. Try removing :source_type on your association.")
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
class HasOneThroughCantAssociateThroughCollection < ActiveRecordError #:nodoc:
|
44
|
+
def initialize(owner_class_name, reflection, through_reflection)
|
45
|
+
super("Cannot have a has_one :through association '#{owner_class_name}##{reflection.name}' where the :through association '#{owner_class_name}##{through_reflection.name}' is a collection. Specify a has_one or belongs_to association in the :through option instead.")
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
class HasOneAssociationPolymorphicThroughError < ActiveRecordError #:nodoc:
|
50
|
+
def initialize(owner_class_name, reflection)
|
51
|
+
super("Cannot have a has_one :through association '#{owner_class_name}##{reflection.name}' which goes through the polymorphic association '#{owner_class_name}##{reflection.through_reflection.name}'.")
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
class HasManyThroughSourceAssociationNotFoundError < ActiveRecordError #:nodoc:
|
56
|
+
def initialize(reflection)
|
57
|
+
through_reflection = reflection.through_reflection
|
58
|
+
source_reflection_names = reflection.source_reflection_names
|
59
|
+
source_associations = reflection.through_reflection.klass._reflections.keys
|
60
|
+
super("Could not find the source association(s) #{source_reflection_names.collect{ |a| a.inspect }.to_sentence(:two_words_connector => ' or ', :last_word_connector => ', or ', :locale => :en)} in model #{through_reflection.klass}. Try 'has_many #{reflection.name.inspect}, :through => #{through_reflection.name.inspect}, :source => <name>'. Is it one of #{source_associations.to_sentence(:two_words_connector => ' or ', :last_word_connector => ', or ', :locale => :en)}?")
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
class HasManyThroughCantAssociateThroughHasOneOrManyReflection < ActiveRecordError #:nodoc:
|
65
|
+
def initialize(owner, reflection)
|
66
|
+
super("Cannot modify association '#{owner.class.name}##{reflection.name}' because the source reflection class '#{reflection.source_reflection.class_name}' is associated to '#{reflection.through_reflection.class_name}' via :#{reflection.source_reflection.macro}.")
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
class HasManyThroughCantAssociateNewRecords < ActiveRecordError #:nodoc:
|
71
|
+
def initialize(owner, reflection)
|
72
|
+
super("Cannot associate new records through '#{owner.class.name}##{reflection.name}' on '#{reflection.source_reflection.class_name rescue nil}##{reflection.source_reflection.name rescue nil}'. Both records must have an id in order to create the has_many :through record associating them.")
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
class HasManyThroughCantDissociateNewRecords < ActiveRecordError #:nodoc:
|
77
|
+
def initialize(owner, reflection)
|
78
|
+
super("Cannot dissociate new records through '#{owner.class.name}##{reflection.name}' on '#{reflection.source_reflection.class_name rescue nil}##{reflection.source_reflection.name rescue nil}'. Both records must have an id in order to delete the has_many :through record associating them.")
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
class HasManyThroughNestedAssociationsAreReadonly < ActiveRecordError #:nodoc:
|
83
|
+
def initialize(owner, reflection)
|
84
|
+
super("Cannot modify association '#{owner.class.name}##{reflection.name}' because it goes through more than one other association.")
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
88
|
+
class EagerLoadPolymorphicError < ActiveRecordError #:nodoc:
|
89
|
+
def initialize(reflection)
|
90
|
+
super("Cannot eagerly load the polymorphic association #{reflection.name.inspect}")
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
94
|
+
class ReadOnlyAssociation < ActiveRecordError #:nodoc:
|
95
|
+
def initialize(reflection)
|
96
|
+
super("Cannot add to a has_many :through association. Try adding to #{reflection.through_reflection.name.inspect}.")
|
97
|
+
end
|
98
|
+
end
|
99
|
+
|
100
|
+
# This error is raised when trying to destroy a parent instance in N:1 or 1:1 associations
|
101
|
+
# (has_many, has_one) when there is at least 1 child associated instance.
|
102
|
+
# ex: if @project.tasks.size > 0, DeleteRestrictionError will be raised when trying to destroy @project
|
103
|
+
class DeleteRestrictionError < ActiveRecordError #:nodoc:
|
104
|
+
def initialize(name)
|
105
|
+
super("Cannot delete record because of dependent #{name}")
|
106
|
+
end
|
107
|
+
end
|
108
|
+
|
109
|
+
# See ActiveRecord::Associations::ClassMethods for documentation.
|
110
|
+
module Associations # :nodoc:
|
111
|
+
extend ActiveSupport::Autoload
|
112
|
+
extend ActiveSupport::Concern
|
113
|
+
|
114
|
+
# These classes will be loaded when associations are created.
|
115
|
+
# So there is no need to eager load them.
|
116
|
+
autoload :Association, 'active_record/associations/association'
|
117
|
+
autoload :SingularAssociation, 'active_record/associations/singular_association'
|
118
|
+
autoload :CollectionAssociation, 'active_record/associations/collection_association'
|
119
|
+
autoload :ForeignAssociation, 'active_record/associations/foreign_association'
|
120
|
+
autoload :CollectionProxy, 'active_record/associations/collection_proxy'
|
121
|
+
|
122
|
+
autoload :BelongsToAssociation, 'active_record/associations/belongs_to_association'
|
123
|
+
autoload :BelongsToPolymorphicAssociation, 'active_record/associations/belongs_to_polymorphic_association'
|
124
|
+
autoload :HasManyAssociation, 'active_record/associations/has_many_association'
|
125
|
+
autoload :HasManyThroughAssociation, 'active_record/associations/has_many_through_association'
|
126
|
+
autoload :HasOneAssociation, 'active_record/associations/has_one_association'
|
127
|
+
autoload :HasOneThroughAssociation, 'active_record/associations/has_one_through_association'
|
128
|
+
autoload :ThroughAssociation, 'active_record/associations/through_association'
|
129
|
+
|
130
|
+
module Builder #:nodoc:
|
131
|
+
autoload :Association, 'active_record/associations/builder/association'
|
132
|
+
autoload :SingularAssociation, 'active_record/associations/builder/singular_association'
|
133
|
+
autoload :CollectionAssociation, 'active_record/associations/builder/collection_association'
|
134
|
+
|
135
|
+
autoload :BelongsTo, 'active_record/associations/builder/belongs_to'
|
136
|
+
autoload :HasOne, 'active_record/associations/builder/has_one'
|
137
|
+
autoload :HasMany, 'active_record/associations/builder/has_many'
|
138
|
+
autoload :HasAndBelongsToMany, 'active_record/associations/builder/has_and_belongs_to_many'
|
139
|
+
end
|
140
|
+
|
141
|
+
eager_autoload do
|
142
|
+
autoload :Preloader, 'active_record/associations/preloader'
|
143
|
+
autoload :JoinDependency, 'active_record/associations/join_dependency'
|
144
|
+
autoload :AssociationScope, 'active_record/associations/association_scope'
|
145
|
+
autoload :AliasTracker, 'active_record/associations/alias_tracker'
|
146
|
+
end
|
147
|
+
|
148
|
+
# Clears out the association cache.
|
149
|
+
def clear_association_cache #:nodoc:
|
150
|
+
@association_cache.clear if persisted?
|
151
|
+
end
|
152
|
+
|
153
|
+
# :nodoc:
|
154
|
+
attr_reader :association_cache
|
155
|
+
|
156
|
+
# Returns the association instance for the given name, instantiating it if it doesn't already exist
|
157
|
+
def association(name) #:nodoc:
|
158
|
+
association = association_instance_get(name)
|
159
|
+
|
160
|
+
if association.nil?
|
161
|
+
raise AssociationNotFoundError.new(self, name) unless reflection = self.class._reflect_on_association(name)
|
162
|
+
association = reflection.association_class.new(self, reflection)
|
163
|
+
association_instance_set(name, association)
|
164
|
+
end
|
165
|
+
|
166
|
+
association
|
167
|
+
end
|
168
|
+
|
169
|
+
private
|
170
|
+
# Returns the specified association instance if it responds to :loaded?, nil otherwise.
|
171
|
+
def association_instance_get(name)
|
172
|
+
@association_cache[name]
|
173
|
+
end
|
174
|
+
|
175
|
+
# Set the specified association instance.
|
176
|
+
def association_instance_set(name, association)
|
177
|
+
@association_cache[name] = association
|
178
|
+
end
|
179
|
+
|
180
|
+
# \Associations are a set of macro-like class methods for tying objects together through
|
181
|
+
# foreign keys. They express relationships like "Project has one Project Manager"
|
182
|
+
# or "Project belongs to a Portfolio". Each macro adds a number of methods to the
|
183
|
+
# class which are specialized according to the collection or association symbol and the
|
184
|
+
# options hash. It works much the same way as Ruby's own <tt>attr*</tt>
|
185
|
+
# methods.
|
186
|
+
#
|
187
|
+
# class Project < ActiveRecord::Base
|
188
|
+
# belongs_to :portfolio
|
189
|
+
# has_one :project_manager
|
190
|
+
# has_many :milestones
|
191
|
+
# has_and_belongs_to_many :categories
|
192
|
+
# end
|
193
|
+
#
|
194
|
+
# The project class now has the following methods (and more) to ease the traversal and
|
195
|
+
# manipulation of its relationships:
|
196
|
+
# * <tt>Project#portfolio, Project#portfolio=(portfolio), Project#portfolio.nil?</tt>
|
197
|
+
# * <tt>Project#project_manager, Project#project_manager=(project_manager), Project#project_manager.nil?,</tt>
|
198
|
+
# * <tt>Project#milestones.empty?, Project#milestones.size, Project#milestones, Project#milestones<<(milestone),</tt>
|
199
|
+
# <tt>Project#milestones.delete(milestone), Project#milestones.destroy(milestone), Project#milestones.find(milestone_id),</tt>
|
200
|
+
# <tt>Project#milestones.build, Project#milestones.create</tt>
|
201
|
+
# * <tt>Project#categories.empty?, Project#categories.size, Project#categories, Project#categories<<(category1),</tt>
|
202
|
+
# <tt>Project#categories.delete(category1), Project#categories.destroy(category1)</tt>
|
203
|
+
#
|
204
|
+
# === A word of warning
|
205
|
+
#
|
206
|
+
# Don't create associations that have the same name as instance methods of
|
207
|
+
# <tt>ActiveRecord::Base</tt>. Since the association adds a method with that name to
|
208
|
+
# its model, it will override the inherited method and break things.
|
209
|
+
# For instance, +attributes+ and +connection+ would be bad choices for association names.
|
210
|
+
#
|
211
|
+
# == Auto-generated methods
|
212
|
+
# See also Instance Public methods below for more details.
|
213
|
+
#
|
214
|
+
# === Singular associations (one-to-one)
|
215
|
+
# | | belongs_to |
|
216
|
+
# generated methods | belongs_to | :polymorphic | has_one
|
217
|
+
# ----------------------------------+------------+--------------+---------
|
218
|
+
# other(force_reload=false) | X | X | X
|
219
|
+
# other=(other) | X | X | X
|
220
|
+
# build_other(attributes={}) | X | | X
|
221
|
+
# create_other(attributes={}) | X | | X
|
222
|
+
# create_other!(attributes={}) | X | | X
|
223
|
+
#
|
224
|
+
# ===Collection associations (one-to-many / many-to-many)
|
225
|
+
# | | | has_many
|
226
|
+
# generated methods | habtm | has_many | :through
|
227
|
+
# ----------------------------------+-------+----------+----------
|
228
|
+
# others(force_reload=false) | X | X | X
|
229
|
+
# others=(other,other,...) | X | X | X
|
230
|
+
# other_ids | X | X | X
|
231
|
+
# other_ids=(id,id,...) | X | X | X
|
232
|
+
# others<< | X | X | X
|
233
|
+
# others.push | X | X | X
|
234
|
+
# others.concat | X | X | X
|
235
|
+
# others.build(attributes={}) | X | X | X
|
236
|
+
# others.create(attributes={}) | X | X | X
|
237
|
+
# others.create!(attributes={}) | X | X | X
|
238
|
+
# others.size | X | X | X
|
239
|
+
# others.length | X | X | X
|
240
|
+
# others.count | X | X | X
|
241
|
+
# others.sum(*args) | X | X | X
|
242
|
+
# others.empty? | X | X | X
|
243
|
+
# others.clear | X | X | X
|
244
|
+
# others.delete(other,other,...) | X | X | X
|
245
|
+
# others.delete_all | X | X | X
|
246
|
+
# others.destroy(other,other,...) | X | X | X
|
247
|
+
# others.destroy_all | X | X | X
|
248
|
+
# others.find(*args) | X | X | X
|
249
|
+
# others.exists? | X | X | X
|
250
|
+
# others.distinct | X | X | X
|
251
|
+
# others.uniq | X | X | X
|
252
|
+
# others.reset | X | X | X
|
253
|
+
#
|
254
|
+
# === Overriding generated methods
|
255
|
+
#
|
256
|
+
# Association methods are generated in a module that is included into the model class,
|
257
|
+
# which allows you to easily override with your own methods and call the original
|
258
|
+
# generated method with +super+. For example:
|
259
|
+
#
|
260
|
+
# class Car < ActiveRecord::Base
|
261
|
+
# belongs_to :owner
|
262
|
+
# belongs_to :old_owner
|
263
|
+
# def owner=(new_owner)
|
264
|
+
# self.old_owner = self.owner
|
265
|
+
# super
|
266
|
+
# end
|
267
|
+
# end
|
268
|
+
#
|
269
|
+
# If your model class is <tt>Project</tt>, the module is
|
270
|
+
# named <tt>Project::GeneratedFeatureMethods</tt>. The GeneratedFeatureMethods module is
|
271
|
+
# included in the model class immediately after the (anonymous) generated attributes methods
|
272
|
+
# module, meaning an association will override the methods for an attribute with the same name.
|
273
|
+
#
|
274
|
+
# == Cardinality and associations
|
275
|
+
#
|
276
|
+
# Active Record associations can be used to describe one-to-one, one-to-many and many-to-many
|
277
|
+
# relationships between models. Each model uses an association to describe its role in
|
278
|
+
# the relation. The +belongs_to+ association is always used in the model that has
|
279
|
+
# the foreign key.
|
280
|
+
#
|
281
|
+
# === One-to-one
|
282
|
+
#
|
283
|
+
# Use +has_one+ in the base, and +belongs_to+ in the associated model.
|
284
|
+
#
|
285
|
+
# class Employee < ActiveRecord::Base
|
286
|
+
# has_one :office
|
287
|
+
# end
|
288
|
+
# class Office < ActiveRecord::Base
|
289
|
+
# belongs_to :employee # foreign key - employee_id
|
290
|
+
# end
|
291
|
+
#
|
292
|
+
# === One-to-many
|
293
|
+
#
|
294
|
+
# Use +has_many+ in the base, and +belongs_to+ in the associated model.
|
295
|
+
#
|
296
|
+
# class Manager < ActiveRecord::Base
|
297
|
+
# has_many :employees
|
298
|
+
# end
|
299
|
+
# class Employee < ActiveRecord::Base
|
300
|
+
# belongs_to :manager # foreign key - manager_id
|
301
|
+
# end
|
302
|
+
#
|
303
|
+
# === Many-to-many
|
304
|
+
#
|
305
|
+
# There are two ways to build a many-to-many relationship.
|
306
|
+
#
|
307
|
+
# The first way uses a +has_many+ association with the <tt>:through</tt> option and a join model, so
|
308
|
+
# there are two stages of associations.
|
309
|
+
#
|
310
|
+
# class Assignment < ActiveRecord::Base
|
311
|
+
# belongs_to :programmer # foreign key - programmer_id
|
312
|
+
# belongs_to :project # foreign key - project_id
|
313
|
+
# end
|
314
|
+
# class Programmer < ActiveRecord::Base
|
315
|
+
# has_many :assignments
|
316
|
+
# has_many :projects, through: :assignments
|
317
|
+
# end
|
318
|
+
# class Project < ActiveRecord::Base
|
319
|
+
# has_many :assignments
|
320
|
+
# has_many :programmers, through: :assignments
|
321
|
+
# end
|
322
|
+
#
|
323
|
+
# For the second way, use +has_and_belongs_to_many+ in both models. This requires a join table
|
324
|
+
# that has no corresponding model or primary key.
|
325
|
+
#
|
326
|
+
# class Programmer < ActiveRecord::Base
|
327
|
+
# has_and_belongs_to_many :projects # foreign keys in the join table
|
328
|
+
# end
|
329
|
+
# class Project < ActiveRecord::Base
|
330
|
+
# has_and_belongs_to_many :programmers # foreign keys in the join table
|
331
|
+
# end
|
332
|
+
#
|
333
|
+
# Choosing which way to build a many-to-many relationship is not always simple.
|
334
|
+
# If you need to work with the relationship model as its own entity,
|
335
|
+
# use <tt>has_many :through</tt>. Use +has_and_belongs_to_many+ when working with legacy schemas or when
|
336
|
+
# you never work directly with the relationship itself.
|
337
|
+
#
|
338
|
+
# == Is it a +belongs_to+ or +has_one+ association?
|
339
|
+
#
|
340
|
+
# Both express a 1-1 relationship. The difference is mostly where to place the foreign
|
341
|
+
# key, which goes on the table for the class declaring the +belongs_to+ relationship.
|
342
|
+
#
|
343
|
+
# class User < ActiveRecord::Base
|
344
|
+
# # I reference an account.
|
345
|
+
# belongs_to :account
|
346
|
+
# end
|
347
|
+
#
|
348
|
+
# class Account < ActiveRecord::Base
|
349
|
+
# # One user references me.
|
350
|
+
# has_one :user
|
351
|
+
# end
|
352
|
+
#
|
353
|
+
# The tables for these classes could look something like:
|
354
|
+
#
|
355
|
+
# CREATE TABLE users (
|
356
|
+
# id int(11) NOT NULL auto_increment,
|
357
|
+
# account_id int(11) default NULL,
|
358
|
+
# name varchar default NULL,
|
359
|
+
# PRIMARY KEY (id)
|
360
|
+
# )
|
361
|
+
#
|
362
|
+
# CREATE TABLE accounts (
|
363
|
+
# id int(11) NOT NULL auto_increment,
|
364
|
+
# name varchar default NULL,
|
365
|
+
# PRIMARY KEY (id)
|
366
|
+
# )
|
367
|
+
#
|
368
|
+
# == Unsaved objects and associations
|
369
|
+
#
|
370
|
+
# You can manipulate objects and associations before they are saved to the database, but
|
371
|
+
# there is some special behavior you should be aware of, mostly involving the saving of
|
372
|
+
# associated objects.
|
373
|
+
#
|
374
|
+
# You can set the <tt>:autosave</tt> option on a <tt>has_one</tt>, <tt>belongs_to</tt>,
|
375
|
+
# <tt>has_many</tt>, or <tt>has_and_belongs_to_many</tt> association. Setting it
|
376
|
+
# to +true+ will _always_ save the members, whereas setting it to +false+ will
|
377
|
+
# _never_ save the members. More details about <tt>:autosave</tt> option is available at
|
378
|
+
# AutosaveAssociation.
|
379
|
+
#
|
380
|
+
# === One-to-one associations
|
381
|
+
#
|
382
|
+
# * Assigning an object to a +has_one+ association automatically saves that object and
|
383
|
+
# the object being replaced (if there is one), in order to update their foreign
|
384
|
+
# keys - except if the parent object is unsaved (<tt>new_record? == true</tt>).
|
385
|
+
# * If either of these saves fail (due to one of the objects being invalid), an
|
386
|
+
# <tt>ActiveRecord::RecordNotSaved</tt> exception is raised and the assignment is
|
387
|
+
# cancelled.
|
388
|
+
# * If you wish to assign an object to a +has_one+ association without saving it,
|
389
|
+
# use the <tt>build_association</tt> method (documented below). The object being
|
390
|
+
# replaced will still be saved to update its foreign key.
|
391
|
+
# * Assigning an object to a +belongs_to+ association does not save the object, since
|
392
|
+
# the foreign key field belongs on the parent. It does not save the parent either.
|
393
|
+
#
|
394
|
+
# === Collections
|
395
|
+
#
|
396
|
+
# * Adding an object to a collection (+has_many+ or +has_and_belongs_to_many+) automatically
|
397
|
+
# saves that object, except if the parent object (the owner of the collection) is not yet
|
398
|
+
# stored in the database.
|
399
|
+
# * If saving any of the objects being added to a collection (via <tt>push</tt> or similar)
|
400
|
+
# fails, then <tt>push</tt> returns +false+.
|
401
|
+
# * If saving fails while replacing the collection (via <tt>association=</tt>), an
|
402
|
+
# <tt>ActiveRecord::RecordNotSaved</tt> exception is raised and the assignment is
|
403
|
+
# cancelled.
|
404
|
+
# * You can add an object to a collection without automatically saving it by using the
|
405
|
+
# <tt>collection.build</tt> method (documented below).
|
406
|
+
# * All unsaved (<tt>new_record? == true</tt>) members of the collection are automatically
|
407
|
+
# saved when the parent is saved.
|
408
|
+
#
|
409
|
+
# == Customizing the query
|
410
|
+
#
|
411
|
+
# \Associations are built from <tt>Relation</tt>s, and you can use the <tt>Relation</tt> syntax
|
412
|
+
# to customize them. For example, to add a condition:
|
413
|
+
#
|
414
|
+
# class Blog < ActiveRecord::Base
|
415
|
+
# has_many :published_posts, -> { where published: true }, class_name: 'Post'
|
416
|
+
# end
|
417
|
+
#
|
418
|
+
# Inside the <tt>-> { ... }</tt> block you can use all of the usual <tt>Relation</tt> methods.
|
419
|
+
#
|
420
|
+
# === Accessing the owner object
|
421
|
+
#
|
422
|
+
# Sometimes it is useful to have access to the owner object when building the query. The owner
|
423
|
+
# is passed as a parameter to the block. For example, the following association would find all
|
424
|
+
# events that occur on the user's birthday:
|
425
|
+
#
|
426
|
+
# class User < ActiveRecord::Base
|
427
|
+
# has_many :birthday_events, ->(user) { where starts_on: user.birthday }, class_name: 'Event'
|
428
|
+
# end
|
429
|
+
#
|
430
|
+
# Note: Joining, eager loading and preloading of these associations is not fully possible.
|
431
|
+
# These operations happen before instance creation and the scope will be called with a +nil+ argument.
|
432
|
+
# This can lead to unexpected behavior and is deprecated.
|
433
|
+
#
|
434
|
+
# == Association callbacks
|
435
|
+
#
|
436
|
+
# Similar to the normal callbacks that hook into the life cycle of an Active Record object,
|
437
|
+
# you can also define callbacks that get triggered when you add an object to or remove an
|
438
|
+
# object from an association collection.
|
439
|
+
#
|
440
|
+
# class Project
|
441
|
+
# has_and_belongs_to_many :developers, after_add: :evaluate_velocity
|
442
|
+
#
|
443
|
+
# def evaluate_velocity(developer)
|
444
|
+
# ...
|
445
|
+
# end
|
446
|
+
# end
|
447
|
+
#
|
448
|
+
# It's possible to stack callbacks by passing them as an array. Example:
|
449
|
+
#
|
450
|
+
# class Project
|
451
|
+
# has_and_belongs_to_many :developers,
|
452
|
+
# after_add: [:evaluate_velocity, Proc.new { |p, d| p.shipping_date = Time.now}]
|
453
|
+
# end
|
454
|
+
#
|
455
|
+
# Possible callbacks are: +before_add+, +after_add+, +before_remove+ and +after_remove+.
|
456
|
+
#
|
457
|
+
# If any of the +before_add+ callbacks throw an exception, the object will not be
|
458
|
+
# added to the collection.
|
459
|
+
#
|
460
|
+
# Similarly, if any of the +before_remove+ callbacks throw an exception, the object
|
461
|
+
# will not be removed from the collection.
|
462
|
+
#
|
463
|
+
# == Association extensions
|
464
|
+
#
|
465
|
+
# The proxy objects that control the access to associations can be extended through anonymous
|
466
|
+
# modules. This is especially beneficial for adding new finders, creators, and other
|
467
|
+
# factory-type methods that are only used as part of this association.
|
468
|
+
#
|
469
|
+
# class Account < ActiveRecord::Base
|
470
|
+
# has_many :people do
|
471
|
+
# def find_or_create_by_name(name)
|
472
|
+
# first_name, last_name = name.split(" ", 2)
|
473
|
+
# find_or_create_by(first_name: first_name, last_name: last_name)
|
474
|
+
# end
|
475
|
+
# end
|
476
|
+
# end
|
477
|
+
#
|
478
|
+
# person = Account.first.people.find_or_create_by_name("David Heinemeier Hansson")
|
479
|
+
# person.first_name # => "David"
|
480
|
+
# person.last_name # => "Heinemeier Hansson"
|
481
|
+
#
|
482
|
+
# If you need to share the same extensions between many associations, you can use a named
|
483
|
+
# extension module.
|
484
|
+
#
|
485
|
+
# module FindOrCreateByNameExtension
|
486
|
+
# def find_or_create_by_name(name)
|
487
|
+
# first_name, last_name = name.split(" ", 2)
|
488
|
+
# find_or_create_by(first_name: first_name, last_name: last_name)
|
489
|
+
# end
|
490
|
+
# end
|
491
|
+
#
|
492
|
+
# class Account < ActiveRecord::Base
|
493
|
+
# has_many :people, -> { extending FindOrCreateByNameExtension }
|
494
|
+
# end
|
495
|
+
#
|
496
|
+
# class Company < ActiveRecord::Base
|
497
|
+
# has_many :people, -> { extending FindOrCreateByNameExtension }
|
498
|
+
# end
|
499
|
+
#
|
500
|
+
# Some extensions can only be made to work with knowledge of the association's internals.
|
501
|
+
# Extensions can access relevant state using the following methods (where +items+ is the
|
502
|
+
# name of the association):
|
503
|
+
#
|
504
|
+
# * <tt>record.association(:items).owner</tt> - Returns the object the association is part of.
|
505
|
+
# * <tt>record.association(:items).reflection</tt> - Returns the reflection object that describes the association.
|
506
|
+
# * <tt>record.association(:items).target</tt> - Returns the associated object for +belongs_to+ and +has_one+, or
|
507
|
+
# the collection of associated objects for +has_many+ and +has_and_belongs_to_many+.
|
508
|
+
#
|
509
|
+
# However, inside the actual extension code, you will not have access to the <tt>record</tt> as
|
510
|
+
# above. In this case, you can access <tt>proxy_association</tt>. For example,
|
511
|
+
# <tt>record.association(:items)</tt> and <tt>record.items.proxy_association</tt> will return
|
512
|
+
# the same object, allowing you to make calls like <tt>proxy_association.owner</tt> inside
|
513
|
+
# association extensions.
|
514
|
+
#
|
515
|
+
# == Association Join Models
|
516
|
+
#
|
517
|
+
# Has Many associations can be configured with the <tt>:through</tt> option to use an
|
518
|
+
# explicit join model to retrieve the data. This operates similarly to a
|
519
|
+
# +has_and_belongs_to_many+ association. The advantage is that you're able to add validations,
|
520
|
+
# callbacks, and extra attributes on the join model. Consider the following schema:
|
521
|
+
#
|
522
|
+
# class Author < ActiveRecord::Base
|
523
|
+
# has_many :authorships
|
524
|
+
# has_many :books, through: :authorships
|
525
|
+
# end
|
526
|
+
#
|
527
|
+
# class Authorship < ActiveRecord::Base
|
528
|
+
# belongs_to :author
|
529
|
+
# belongs_to :book
|
530
|
+
# end
|
531
|
+
#
|
532
|
+
# @author = Author.first
|
533
|
+
# @author.authorships.collect { |a| a.book } # selects all books that the author's authorships belong to
|
534
|
+
# @author.books # selects all books by using the Authorship join model
|
535
|
+
#
|
536
|
+
# You can also go through a +has_many+ association on the join model:
|
537
|
+
#
|
538
|
+
# class Firm < ActiveRecord::Base
|
539
|
+
# has_many :clients
|
540
|
+
# has_many :invoices, through: :clients
|
541
|
+
# end
|
542
|
+
#
|
543
|
+
# class Client < ActiveRecord::Base
|
544
|
+
# belongs_to :firm
|
545
|
+
# has_many :invoices
|
546
|
+
# end
|
547
|
+
#
|
548
|
+
# class Invoice < ActiveRecord::Base
|
549
|
+
# belongs_to :client
|
550
|
+
# end
|
551
|
+
#
|
552
|
+
# @firm = Firm.first
|
553
|
+
# @firm.clients.flat_map { |c| c.invoices } # select all invoices for all clients of the firm
|
554
|
+
# @firm.invoices # selects all invoices by going through the Client join model
|
555
|
+
#
|
556
|
+
# Similarly you can go through a +has_one+ association on the join model:
|
557
|
+
#
|
558
|
+
# class Group < ActiveRecord::Base
|
559
|
+
# has_many :users
|
560
|
+
# has_many :avatars, through: :users
|
561
|
+
# end
|
562
|
+
#
|
563
|
+
# class User < ActiveRecord::Base
|
564
|
+
# belongs_to :group
|
565
|
+
# has_one :avatar
|
566
|
+
# end
|
567
|
+
#
|
568
|
+
# class Avatar < ActiveRecord::Base
|
569
|
+
# belongs_to :user
|
570
|
+
# end
|
571
|
+
#
|
572
|
+
# @group = Group.first
|
573
|
+
# @group.users.collect { |u| u.avatar }.compact # select all avatars for all users in the group
|
574
|
+
# @group.avatars # selects all avatars by going through the User join model.
|
575
|
+
#
|
576
|
+
# An important caveat with going through +has_one+ or +has_many+ associations on the
|
577
|
+
# join model is that these associations are *read-only*. For example, the following
|
578
|
+
# would not work following the previous example:
|
579
|
+
#
|
580
|
+
# @group.avatars << Avatar.new # this would work if User belonged_to Avatar rather than the other way around
|
581
|
+
# @group.avatars.delete(@group.avatars.last) # so would this
|
582
|
+
#
|
583
|
+
# == Setting Inverses
|
584
|
+
#
|
585
|
+
# If you are using a +belongs_to+ on the join model, it is a good idea to set the
|
586
|
+
# <tt>:inverse_of</tt> option on the +belongs_to+, which will mean that the following example
|
587
|
+
# works correctly (where <tt>tags</tt> is a +has_many+ <tt>:through</tt> association):
|
588
|
+
#
|
589
|
+
# @post = Post.first
|
590
|
+
# @tag = @post.tags.build name: "ruby"
|
591
|
+
# @tag.save
|
592
|
+
#
|
593
|
+
# The last line ought to save the through record (a <tt>Taggable</tt>). This will only work if the
|
594
|
+
# <tt>:inverse_of</tt> is set:
|
595
|
+
#
|
596
|
+
# class Taggable < ActiveRecord::Base
|
597
|
+
# belongs_to :post
|
598
|
+
# belongs_to :tag, inverse_of: :taggings
|
599
|
+
# end
|
600
|
+
#
|
601
|
+
# If you do not set the <tt>:inverse_of</tt> record, the association will
|
602
|
+
# do its best to match itself up with the correct inverse. Automatic
|
603
|
+
# inverse detection only works on <tt>has_many</tt>, <tt>has_one</tt>, and
|
604
|
+
# <tt>belongs_to</tt> associations.
|
605
|
+
#
|
606
|
+
# Extra options on the associations, as defined in the
|
607
|
+
# <tt>AssociationReflection::INVALID_AUTOMATIC_INVERSE_OPTIONS</tt> constant, will
|
608
|
+
# also prevent the association's inverse from being found automatically.
|
609
|
+
#
|
610
|
+
# The automatic guessing of the inverse association uses a heuristic based
|
611
|
+
# on the name of the class, so it may not work for all associations,
|
612
|
+
# especially the ones with non-standard names.
|
613
|
+
#
|
614
|
+
# You can turn off the automatic detection of inverse associations by setting
|
615
|
+
# the <tt>:inverse_of</tt> option to <tt>false</tt> like so:
|
616
|
+
#
|
617
|
+
# class Taggable < ActiveRecord::Base
|
618
|
+
# belongs_to :tag, inverse_of: false
|
619
|
+
# end
|
620
|
+
#
|
621
|
+
# == Nested \Associations
|
622
|
+
#
|
623
|
+
# You can actually specify *any* association with the <tt>:through</tt> option, including an
|
624
|
+
# association which has a <tt>:through</tt> option itself. For example:
|
625
|
+
#
|
626
|
+
# class Author < ActiveRecord::Base
|
627
|
+
# has_many :posts
|
628
|
+
# has_many :comments, through: :posts
|
629
|
+
# has_many :commenters, through: :comments
|
630
|
+
# end
|
631
|
+
#
|
632
|
+
# class Post < ActiveRecord::Base
|
633
|
+
# has_many :comments
|
634
|
+
# end
|
635
|
+
#
|
636
|
+
# class Comment < ActiveRecord::Base
|
637
|
+
# belongs_to :commenter
|
638
|
+
# end
|
639
|
+
#
|
640
|
+
# @author = Author.first
|
641
|
+
# @author.commenters # => People who commented on posts written by the author
|
642
|
+
#
|
643
|
+
# An equivalent way of setting up this association this would be:
|
644
|
+
#
|
645
|
+
# class Author < ActiveRecord::Base
|
646
|
+
# has_many :posts
|
647
|
+
# has_many :commenters, through: :posts
|
648
|
+
# end
|
649
|
+
#
|
650
|
+
# class Post < ActiveRecord::Base
|
651
|
+
# has_many :comments
|
652
|
+
# has_many :commenters, through: :comments
|
653
|
+
# end
|
654
|
+
#
|
655
|
+
# class Comment < ActiveRecord::Base
|
656
|
+
# belongs_to :commenter
|
657
|
+
# end
|
658
|
+
#
|
659
|
+
# When using a nested association, you will not be able to modify the association because there
|
660
|
+
# is not enough information to know what modification to make. For example, if you tried to
|
661
|
+
# add a <tt>Commenter</tt> in the example above, there would be no way to tell how to set up the
|
662
|
+
# intermediate <tt>Post</tt> and <tt>Comment</tt> objects.
|
663
|
+
#
|
664
|
+
# == Polymorphic \Associations
|
665
|
+
#
|
666
|
+
# Polymorphic associations on models are not restricted on what types of models they
|
667
|
+
# can be associated with. Rather, they specify an interface that a +has_many+ association
|
668
|
+
# must adhere to.
|
669
|
+
#
|
670
|
+
# class Asset < ActiveRecord::Base
|
671
|
+
# belongs_to :attachable, polymorphic: true
|
672
|
+
# end
|
673
|
+
#
|
674
|
+
# class Post < ActiveRecord::Base
|
675
|
+
# has_many :assets, as: :attachable # The :as option specifies the polymorphic interface to use.
|
676
|
+
# end
|
677
|
+
#
|
678
|
+
# @asset.attachable = @post
|
679
|
+
#
|
680
|
+
# This works by using a type column in addition to a foreign key to specify the associated
|
681
|
+
# record. In the Asset example, you'd need an +attachable_id+ integer column and an
|
682
|
+
# +attachable_type+ string column.
|
683
|
+
#
|
684
|
+
# Using polymorphic associations in combination with single table inheritance (STI) is
|
685
|
+
# a little tricky. In order for the associations to work as expected, ensure that you
|
686
|
+
# store the base model for the STI models in the type column of the polymorphic
|
687
|
+
# association. To continue with the asset example above, suppose there are guest posts
|
688
|
+
# and member posts that use the posts table for STI. In this case, there must be a +type+
|
689
|
+
# column in the posts table.
|
690
|
+
#
|
691
|
+
# Note: The <tt>attachable_type=</tt> method is being called when assigning an +attachable+.
|
692
|
+
# The +class_name+ of the +attachable+ is passed as a String.
|
693
|
+
#
|
694
|
+
# class Asset < ActiveRecord::Base
|
695
|
+
# belongs_to :attachable, polymorphic: true
|
696
|
+
#
|
697
|
+
# def attachable_type=(class_name)
|
698
|
+
# super(class_name.constantize.base_class.to_s)
|
699
|
+
# end
|
700
|
+
# end
|
701
|
+
#
|
702
|
+
# class Post < ActiveRecord::Base
|
703
|
+
# # because we store "Post" in attachable_type now dependent: :destroy will work
|
704
|
+
# has_many :assets, as: :attachable, dependent: :destroy
|
705
|
+
# end
|
706
|
+
#
|
707
|
+
# class GuestPost < Post
|
708
|
+
# end
|
709
|
+
#
|
710
|
+
# class MemberPost < Post
|
711
|
+
# end
|
712
|
+
#
|
713
|
+
# == Caching
|
714
|
+
#
|
715
|
+
# All of the methods are built on a simple caching principle that will keep the result
|
716
|
+
# of the last query around unless specifically instructed not to. The cache is even
|
717
|
+
# shared across methods to make it even cheaper to use the macro-added methods without
|
718
|
+
# worrying too much about performance at the first go.
|
719
|
+
#
|
720
|
+
# project.milestones # fetches milestones from the database
|
721
|
+
# project.milestones.size # uses the milestone cache
|
722
|
+
# project.milestones.empty? # uses the milestone cache
|
723
|
+
# project.milestones(true).size # fetches milestones from the database
|
724
|
+
# project.milestones # uses the milestone cache
|
725
|
+
#
|
726
|
+
# == Eager loading of associations
|
727
|
+
#
|
728
|
+
# Eager loading is a way to find objects of a certain class and a number of named associations.
|
729
|
+
# It is one of the easiest ways to prevent the dreaded N+1 problem in which fetching 100
|
730
|
+
# posts that each need to display their author triggers 101 database queries. Through the
|
731
|
+
# use of eager loading, the number of queries will be reduced from 101 to 2.
|
732
|
+
#
|
733
|
+
# class Post < ActiveRecord::Base
|
734
|
+
# belongs_to :author
|
735
|
+
# has_many :comments
|
736
|
+
# end
|
737
|
+
#
|
738
|
+
# Consider the following loop using the class above:
|
739
|
+
#
|
740
|
+
# Post.all.each do |post|
|
741
|
+
# puts "Post: " + post.title
|
742
|
+
# puts "Written by: " + post.author.name
|
743
|
+
# puts "Last comment on: " + post.comments.first.created_on
|
744
|
+
# end
|
745
|
+
#
|
746
|
+
# To iterate over these one hundred posts, we'll generate 201 database queries. Let's
|
747
|
+
# first just optimize it for retrieving the author:
|
748
|
+
#
|
749
|
+
# Post.includes(:author).each do |post|
|
750
|
+
#
|
751
|
+
# This references the name of the +belongs_to+ association that also used the <tt>:author</tt>
|
752
|
+
# symbol. After loading the posts, find will collect the +author_id+ from each one and load
|
753
|
+
# all the referenced authors with one query. Doing so will cut down the number of queries
|
754
|
+
# from 201 to 102.
|
755
|
+
#
|
756
|
+
# We can improve upon the situation further by referencing both associations in the finder with:
|
757
|
+
#
|
758
|
+
# Post.includes(:author, :comments).each do |post|
|
759
|
+
#
|
760
|
+
# This will load all comments with a single query. This reduces the total number of queries
|
761
|
+
# to 3. In general, the number of queries will be 1 plus the number of associations
|
762
|
+
# named (except if some of the associations are polymorphic +belongs_to+ - see below).
|
763
|
+
#
|
764
|
+
# To include a deep hierarchy of associations, use a hash:
|
765
|
+
#
|
766
|
+
# Post.includes(:author, { comments: { author: :gravatar } }).each do |post|
|
767
|
+
#
|
768
|
+
# The above code will load all the comments and all of their associated
|
769
|
+
# authors and gravatars. You can mix and match any combination of symbols,
|
770
|
+
# arrays, and hashes to retrieve the associations you want to load.
|
771
|
+
#
|
772
|
+
# All of this power shouldn't fool you into thinking that you can pull out huge amounts
|
773
|
+
# of data with no performance penalty just because you've reduced the number of queries.
|
774
|
+
# The database still needs to send all the data to Active Record and it still needs to
|
775
|
+
# be processed. So it's no catch-all for performance problems, but it's a great way to
|
776
|
+
# cut down on the number of queries in a situation as the one described above.
|
777
|
+
#
|
778
|
+
# Since only one table is loaded at a time, conditions or orders cannot reference tables
|
779
|
+
# other than the main one. If this is the case, Active Record falls back to the previously
|
780
|
+
# used LEFT OUTER JOIN based strategy. For example:
|
781
|
+
#
|
782
|
+
# Post.includes([:author, :comments]).where(['comments.approved = ?', true])
|
783
|
+
#
|
784
|
+
# This will result in a single SQL query with joins along the lines of:
|
785
|
+
# <tt>LEFT OUTER JOIN comments ON comments.post_id = posts.id</tt> and
|
786
|
+
# <tt>LEFT OUTER JOIN authors ON authors.id = posts.author_id</tt>. Note that using conditions
|
787
|
+
# like this can have unintended consequences.
|
788
|
+
# In the above example posts with no approved comments are not returned at all, because
|
789
|
+
# the conditions apply to the SQL statement as a whole and not just to the association.
|
790
|
+
#
|
791
|
+
# You must disambiguate column references for this fallback to happen, for example
|
792
|
+
# <tt>order: "author.name DESC"</tt> will work but <tt>order: "name DESC"</tt> will not.
|
793
|
+
#
|
794
|
+
# If you want to load all posts (including posts with no approved comments) then write
|
795
|
+
# your own LEFT OUTER JOIN query using ON
|
796
|
+
#
|
797
|
+
# Post.joins("LEFT OUTER JOIN comments ON comments.post_id = posts.id AND comments.approved = '1'")
|
798
|
+
#
|
799
|
+
# In this case it is usually more natural to include an association which has conditions defined on it:
|
800
|
+
#
|
801
|
+
# class Post < ActiveRecord::Base
|
802
|
+
# has_many :approved_comments, -> { where approved: true }, class_name: 'Comment'
|
803
|
+
# end
|
804
|
+
#
|
805
|
+
# Post.includes(:approved_comments)
|
806
|
+
#
|
807
|
+
# This will load posts and eager load the +approved_comments+ association, which contains
|
808
|
+
# only those comments that have been approved.
|
809
|
+
#
|
810
|
+
# If you eager load an association with a specified <tt>:limit</tt> option, it will be ignored,
|
811
|
+
# returning all the associated objects:
|
812
|
+
#
|
813
|
+
# class Picture < ActiveRecord::Base
|
814
|
+
# has_many :most_recent_comments, -> { order('id DESC').limit(10) }, class_name: 'Comment'
|
815
|
+
# end
|
816
|
+
#
|
817
|
+
# Picture.includes(:most_recent_comments).first.most_recent_comments # => returns all associated comments.
|
818
|
+
#
|
819
|
+
# Eager loading is supported with polymorphic associations.
|
820
|
+
#
|
821
|
+
# class Address < ActiveRecord::Base
|
822
|
+
# belongs_to :addressable, polymorphic: true
|
823
|
+
# end
|
824
|
+
#
|
825
|
+
# A call that tries to eager load the addressable model
|
826
|
+
#
|
827
|
+
# Address.includes(:addressable)
|
828
|
+
#
|
829
|
+
# This will execute one query to load the addresses and load the addressables with one
|
830
|
+
# query per addressable type.
|
831
|
+
# For example if all the addressables are either of class Person or Company then a total
|
832
|
+
# of 3 queries will be executed. The list of addressable types to load is determined on
|
833
|
+
# the back of the addresses loaded. This is not supported if Active Record has to fallback
|
834
|
+
# to the previous implementation of eager loading and will raise <tt>ActiveRecord::EagerLoadPolymorphicError</tt>.
|
835
|
+
# The reason is that the parent model's type is a column value so its corresponding table
|
836
|
+
# name cannot be put in the +FROM+/+JOIN+ clauses of that query.
|
837
|
+
#
|
838
|
+
# == Table Aliasing
|
839
|
+
#
|
840
|
+
# Active Record uses table aliasing in the case that a table is referenced multiple times
|
841
|
+
# in a join. If a table is referenced only once, the standard table name is used. The
|
842
|
+
# second time, the table is aliased as <tt>#{reflection_name}_#{parent_table_name}</tt>.
|
843
|
+
# Indexes are appended for any more successive uses of the table name.
|
844
|
+
#
|
845
|
+
# Post.joins(:comments)
|
846
|
+
# # => SELECT ... FROM posts INNER JOIN comments ON ...
|
847
|
+
# Post.joins(:special_comments) # STI
|
848
|
+
# # => SELECT ... FROM posts INNER JOIN comments ON ... AND comments.type = 'SpecialComment'
|
849
|
+
# Post.joins(:comments, :special_comments) # special_comments is the reflection name, posts is the parent table name
|
850
|
+
# # => SELECT ... FROM posts INNER JOIN comments ON ... INNER JOIN comments special_comments_posts
|
851
|
+
#
|
852
|
+
# Acts as tree example:
|
853
|
+
#
|
854
|
+
# TreeMixin.joins(:children)
|
855
|
+
# # => SELECT ... FROM mixins INNER JOIN mixins childrens_mixins ...
|
856
|
+
# TreeMixin.joins(children: :parent)
|
857
|
+
# # => SELECT ... FROM mixins INNER JOIN mixins childrens_mixins ...
|
858
|
+
# INNER JOIN parents_mixins ...
|
859
|
+
# TreeMixin.joins(children: {parent: :children})
|
860
|
+
# # => SELECT ... FROM mixins INNER JOIN mixins childrens_mixins ...
|
861
|
+
# INNER JOIN parents_mixins ...
|
862
|
+
# INNER JOIN mixins childrens_mixins_2
|
863
|
+
#
|
864
|
+
# Has and Belongs to Many join tables use the same idea, but add a <tt>_join</tt> suffix:
|
865
|
+
#
|
866
|
+
# Post.joins(:categories)
|
867
|
+
# # => SELECT ... FROM posts INNER JOIN categories_posts ... INNER JOIN categories ...
|
868
|
+
# Post.joins(categories: :posts)
|
869
|
+
# # => SELECT ... FROM posts INNER JOIN categories_posts ... INNER JOIN categories ...
|
870
|
+
# INNER JOIN categories_posts posts_categories_join INNER JOIN posts posts_categories
|
871
|
+
# Post.joins(categories: {posts: :categories})
|
872
|
+
# # => SELECT ... FROM posts INNER JOIN categories_posts ... INNER JOIN categories ...
|
873
|
+
# INNER JOIN categories_posts posts_categories_join INNER JOIN posts posts_categories
|
874
|
+
# INNER JOIN categories_posts categories_posts_join INNER JOIN categories categories_posts_2
|
875
|
+
#
|
876
|
+
# If you wish to specify your own custom joins using <tt>joins</tt> method, those table
|
877
|
+
# names will take precedence over the eager associations:
|
878
|
+
#
|
879
|
+
# Post.joins(:comments).joins("inner join comments ...")
|
880
|
+
# # => SELECT ... FROM posts INNER JOIN comments_posts ON ... INNER JOIN comments ...
|
881
|
+
# Post.joins(:comments, :special_comments).joins("inner join comments ...")
|
882
|
+
# # => SELECT ... FROM posts INNER JOIN comments comments_posts ON ...
|
883
|
+
# INNER JOIN comments special_comments_posts ...
|
884
|
+
# INNER JOIN comments ...
|
885
|
+
#
|
886
|
+
# Table aliases are automatically truncated according to the maximum length of table identifiers
|
887
|
+
# according to the specific database.
|
888
|
+
#
|
889
|
+
# == Modules
|
890
|
+
#
|
891
|
+
# By default, associations will look for objects within the current module scope. Consider:
|
892
|
+
#
|
893
|
+
# module MyApplication
|
894
|
+
# module Business
|
895
|
+
# class Firm < ActiveRecord::Base
|
896
|
+
# has_many :clients
|
897
|
+
# end
|
898
|
+
#
|
899
|
+
# class Client < ActiveRecord::Base; end
|
900
|
+
# end
|
901
|
+
# end
|
902
|
+
#
|
903
|
+
# When <tt>Firm#clients</tt> is called, it will in turn call
|
904
|
+
# <tt>MyApplication::Business::Client.find_all_by_firm_id(firm.id)</tt>.
|
905
|
+
# If you want to associate with a class in another module scope, this can be done by
|
906
|
+
# specifying the complete class name.
|
907
|
+
#
|
908
|
+
# module MyApplication
|
909
|
+
# module Business
|
910
|
+
# class Firm < ActiveRecord::Base; end
|
911
|
+
# end
|
912
|
+
#
|
913
|
+
# module Billing
|
914
|
+
# class Account < ActiveRecord::Base
|
915
|
+
# belongs_to :firm, class_name: "MyApplication::Business::Firm"
|
916
|
+
# end
|
917
|
+
# end
|
918
|
+
# end
|
919
|
+
#
|
920
|
+
# == Bi-directional associations
|
921
|
+
#
|
922
|
+
# When you specify an association there is usually an association on the associated model
|
923
|
+
# that specifies the same relationship in reverse. For example, with the following models:
|
924
|
+
#
|
925
|
+
# class Dungeon < ActiveRecord::Base
|
926
|
+
# has_many :traps
|
927
|
+
# has_one :evil_wizard
|
928
|
+
# end
|
929
|
+
#
|
930
|
+
# class Trap < ActiveRecord::Base
|
931
|
+
# belongs_to :dungeon
|
932
|
+
# end
|
933
|
+
#
|
934
|
+
# class EvilWizard < ActiveRecord::Base
|
935
|
+
# belongs_to :dungeon
|
936
|
+
# end
|
937
|
+
#
|
938
|
+
# The +traps+ association on +Dungeon+ and the +dungeon+ association on +Trap+ are
|
939
|
+
# the inverse of each other and the inverse of the +dungeon+ association on +EvilWizard+
|
940
|
+
# is the +evil_wizard+ association on +Dungeon+ (and vice-versa). By default,
|
941
|
+
# Active Record doesn't know anything about these inverse relationships and so no object
|
942
|
+
# loading optimization is possible. For example:
|
943
|
+
#
|
944
|
+
# d = Dungeon.first
|
945
|
+
# t = d.traps.first
|
946
|
+
# d.level == t.dungeon.level # => true
|
947
|
+
# d.level = 10
|
948
|
+
# d.level == t.dungeon.level # => false
|
949
|
+
#
|
950
|
+
# The +Dungeon+ instances +d+ and <tt>t.dungeon</tt> in the above example refer to
|
951
|
+
# the same object data from the database, but are actually different in-memory copies
|
952
|
+
# of that data. Specifying the <tt>:inverse_of</tt> option on associations lets you tell
|
953
|
+
# Active Record about inverse relationships and it will optimise object loading. For
|
954
|
+
# example, if we changed our model definitions to:
|
955
|
+
#
|
956
|
+
# class Dungeon < ActiveRecord::Base
|
957
|
+
# has_many :traps, inverse_of: :dungeon
|
958
|
+
# has_one :evil_wizard, inverse_of: :dungeon
|
959
|
+
# end
|
960
|
+
#
|
961
|
+
# class Trap < ActiveRecord::Base
|
962
|
+
# belongs_to :dungeon, inverse_of: :traps
|
963
|
+
# end
|
964
|
+
#
|
965
|
+
# class EvilWizard < ActiveRecord::Base
|
966
|
+
# belongs_to :dungeon, inverse_of: :evil_wizard
|
967
|
+
# end
|
968
|
+
#
|
969
|
+
# Then, from our code snippet above, +d+ and <tt>t.dungeon</tt> are actually the same
|
970
|
+
# in-memory instance and our final <tt>d.level == t.dungeon.level</tt> will return +true+.
|
971
|
+
#
|
972
|
+
# There are limitations to <tt>:inverse_of</tt> support:
|
973
|
+
#
|
974
|
+
# * does not work with <tt>:through</tt> associations.
|
975
|
+
# * does not work with <tt>:polymorphic</tt> associations.
|
976
|
+
# * for +belongs_to+ associations +has_many+ inverse associations are ignored.
|
977
|
+
#
|
978
|
+
# == Deleting from associations
|
979
|
+
#
|
980
|
+
# === Dependent associations
|
981
|
+
#
|
982
|
+
# +has_many+, +has_one+ and +belongs_to+ associations support the <tt>:dependent</tt> option.
|
983
|
+
# This allows you to specify that associated records should be deleted when the owner is
|
984
|
+
# deleted.
|
985
|
+
#
|
986
|
+
# For example:
|
987
|
+
#
|
988
|
+
# class Author
|
989
|
+
# has_many :posts, dependent: :destroy
|
990
|
+
# end
|
991
|
+
# Author.find(1).destroy # => Will destroy all of the author's posts, too
|
992
|
+
#
|
993
|
+
# The <tt>:dependent</tt> option can have different values which specify how the deletion
|
994
|
+
# is done. For more information, see the documentation for this option on the different
|
995
|
+
# specific association types. When no option is given, the behavior is to do nothing
|
996
|
+
# with the associated records when destroying a record.
|
997
|
+
#
|
998
|
+
# Note that <tt>:dependent</tt> is implemented using Rails' callback
|
999
|
+
# system, which works by processing callbacks in order. Therefore, other
|
1000
|
+
# callbacks declared either before or after the <tt>:dependent</tt> option
|
1001
|
+
# can affect what it does.
|
1002
|
+
#
|
1003
|
+
# === Delete or destroy?
|
1004
|
+
#
|
1005
|
+
# +has_many+ and +has_and_belongs_to_many+ associations have the methods <tt>destroy</tt>,
|
1006
|
+
# <tt>delete</tt>, <tt>destroy_all</tt> and <tt>delete_all</tt>.
|
1007
|
+
#
|
1008
|
+
# For +has_and_belongs_to_many+, <tt>delete</tt> and <tt>destroy</tt> are the same: they
|
1009
|
+
# cause the records in the join table to be removed.
|
1010
|
+
#
|
1011
|
+
# For +has_many+, <tt>destroy</tt> and <tt>destroy_all</tt> will always call the <tt>destroy</tt> method of the
|
1012
|
+
# record(s) being removed so that callbacks are run. However <tt>delete</tt> and <tt>delete_all</tt> will either
|
1013
|
+
# do the deletion according to the strategy specified by the <tt>:dependent</tt> option, or
|
1014
|
+
# if no <tt>:dependent</tt> option is given, then it will follow the default strategy.
|
1015
|
+
# The default strategy is to do nothing (leave the foreign keys with the parent ids set), except for
|
1016
|
+
# +has_many+ <tt>:through</tt>, where the default strategy is <tt>delete_all</tt> (delete
|
1017
|
+
# the join records, without running their callbacks).
|
1018
|
+
#
|
1019
|
+
# There is also a <tt>clear</tt> method which is the same as <tt>delete_all</tt>, except that
|
1020
|
+
# it returns the association rather than the records which have been deleted.
|
1021
|
+
#
|
1022
|
+
# === What gets deleted?
|
1023
|
+
#
|
1024
|
+
# There is a potential pitfall here: +has_and_belongs_to_many+ and +has_many+ <tt>:through</tt>
|
1025
|
+
# associations have records in join tables, as well as the associated records. So when we
|
1026
|
+
# call one of these deletion methods, what exactly should be deleted?
|
1027
|
+
#
|
1028
|
+
# The answer is that it is assumed that deletion on an association is about removing the
|
1029
|
+
# <i>link</i> between the owner and the associated object(s), rather than necessarily the
|
1030
|
+
# associated objects themselves. So with +has_and_belongs_to_many+ and +has_many+
|
1031
|
+
# <tt>:through</tt>, the join records will be deleted, but the associated records won't.
|
1032
|
+
#
|
1033
|
+
# This makes sense if you think about it: if you were to call <tt>post.tags.delete(Tag.find_by(name: 'food'))</tt>
|
1034
|
+
# you would want the 'food' tag to be unlinked from the post, rather than for the tag itself
|
1035
|
+
# to be removed from the database.
|
1036
|
+
#
|
1037
|
+
# However, there are examples where this strategy doesn't make sense. For example, suppose
|
1038
|
+
# a person has many projects, and each project has many tasks. If we deleted one of a person's
|
1039
|
+
# tasks, we would probably not want the project to be deleted. In this scenario, the delete method
|
1040
|
+
# won't actually work: it can only be used if the association on the join model is a
|
1041
|
+
# +belongs_to+. In other situations you are expected to perform operations directly on
|
1042
|
+
# either the associated records or the <tt>:through</tt> association.
|
1043
|
+
#
|
1044
|
+
# With a regular +has_many+ there is no distinction between the "associated records"
|
1045
|
+
# and the "link", so there is only one choice for what gets deleted.
|
1046
|
+
#
|
1047
|
+
# With +has_and_belongs_to_many+ and +has_many+ <tt>:through</tt>, if you want to delete the
|
1048
|
+
# associated records themselves, you can always do something along the lines of
|
1049
|
+
# <tt>person.tasks.each(&:destroy)</tt>.
|
1050
|
+
#
|
1051
|
+
# == Type safety with <tt>ActiveRecord::AssociationTypeMismatch</tt>
|
1052
|
+
#
|
1053
|
+
# If you attempt to assign an object to an association that doesn't match the inferred
|
1054
|
+
# or specified <tt>:class_name</tt>, you'll get an <tt>ActiveRecord::AssociationTypeMismatch</tt>.
|
1055
|
+
#
|
1056
|
+
# == Options
|
1057
|
+
#
|
1058
|
+
# All of the association macros can be specialized through options. This makes cases
|
1059
|
+
# more complex than the simple and guessable ones possible.
|
1060
|
+
module ClassMethods
|
1061
|
+
# Specifies a one-to-many association. The following methods for retrieval and query of
|
1062
|
+
# collections of associated objects will be added:
|
1063
|
+
#
|
1064
|
+
# +collection+ is a placeholder for the symbol passed as the +name+ argument, so
|
1065
|
+
# <tt>has_many :clients</tt> would add among others <tt>clients.empty?</tt>.
|
1066
|
+
#
|
1067
|
+
# [collection(force_reload = false)]
|
1068
|
+
# Returns an array of all the associated objects.
|
1069
|
+
# An empty array is returned if none are found.
|
1070
|
+
# [collection<<(object, ...)]
|
1071
|
+
# Adds one or more objects to the collection by setting their foreign keys to the collection's primary key.
|
1072
|
+
# Note that this operation instantly fires update SQL without waiting for the save or update call on the
|
1073
|
+
# parent object, unless the parent object is a new record.
|
1074
|
+
# [collection.delete(object, ...)]
|
1075
|
+
# Removes one or more objects from the collection by setting their foreign keys to +NULL+.
|
1076
|
+
# Objects will be in addition destroyed if they're associated with <tt>dependent: :destroy</tt>,
|
1077
|
+
# and deleted if they're associated with <tt>dependent: :delete_all</tt>.
|
1078
|
+
#
|
1079
|
+
# If the <tt>:through</tt> option is used, then the join records are deleted (rather than
|
1080
|
+
# nullified) by default, but you can specify <tt>dependent: :destroy</tt> or
|
1081
|
+
# <tt>dependent: :nullify</tt> to override this.
|
1082
|
+
# [collection.destroy(object, ...)]
|
1083
|
+
# Removes one or more objects from the collection by running <tt>destroy</tt> on
|
1084
|
+
# each record, regardless of any dependent option, ensuring callbacks are run.
|
1085
|
+
#
|
1086
|
+
# If the <tt>:through</tt> option is used, then the join records are destroyed
|
1087
|
+
# instead, not the objects themselves.
|
1088
|
+
# [collection=objects]
|
1089
|
+
# Replaces the collections content by deleting and adding objects as appropriate. If the <tt>:through</tt>
|
1090
|
+
# option is true callbacks in the join models are triggered except destroy callbacks, since deletion is
|
1091
|
+
# direct.
|
1092
|
+
# [collection_singular_ids]
|
1093
|
+
# Returns an array of the associated objects' ids
|
1094
|
+
# [collection_singular_ids=ids]
|
1095
|
+
# Replace the collection with the objects identified by the primary keys in +ids+. This
|
1096
|
+
# method loads the models and calls <tt>collection=</tt>. See above.
|
1097
|
+
# [collection.clear]
|
1098
|
+
# Removes every object from the collection. This destroys the associated objects if they
|
1099
|
+
# are associated with <tt>dependent: :destroy</tt>, deletes them directly from the
|
1100
|
+
# database if <tt>dependent: :delete_all</tt>, otherwise sets their foreign keys to +NULL+.
|
1101
|
+
# If the <tt>:through</tt> option is true no destroy callbacks are invoked on the join models.
|
1102
|
+
# Join models are directly deleted.
|
1103
|
+
# [collection.empty?]
|
1104
|
+
# Returns +true+ if there are no associated objects.
|
1105
|
+
# [collection.size]
|
1106
|
+
# Returns the number of associated objects.
|
1107
|
+
# [collection.find(...)]
|
1108
|
+
# Finds an associated object according to the same rules as <tt>ActiveRecord::Base.find</tt>.
|
1109
|
+
# [collection.exists?(...)]
|
1110
|
+
# Checks whether an associated object with the given conditions exists.
|
1111
|
+
# Uses the same rules as <tt>ActiveRecord::Base.exists?</tt>.
|
1112
|
+
# [collection.build(attributes = {}, ...)]
|
1113
|
+
# Returns one or more new objects of the collection type that have been instantiated
|
1114
|
+
# with +attributes+ and linked to this object through a foreign key, but have not yet
|
1115
|
+
# been saved.
|
1116
|
+
# [collection.create(attributes = {})]
|
1117
|
+
# Returns a new object of the collection type that has been instantiated
|
1118
|
+
# with +attributes+, linked to this object through a foreign key, and that has already
|
1119
|
+
# been saved (if it passed the validation). *Note*: This only works if the base model
|
1120
|
+
# already exists in the DB, not if it is a new (unsaved) record!
|
1121
|
+
# [collection.create!(attributes = {})]
|
1122
|
+
# Does the same as <tt>collection.create</tt>, but raises <tt>ActiveRecord::RecordInvalid</tt>
|
1123
|
+
# if the record is invalid.
|
1124
|
+
#
|
1125
|
+
# === Example
|
1126
|
+
#
|
1127
|
+
# A <tt>Firm</tt> class declares <tt>has_many :clients</tt>, which will add:
|
1128
|
+
# * <tt>Firm#clients</tt> (similar to <tt>Client.where(firm_id: id)</tt>)
|
1129
|
+
# * <tt>Firm#clients<<</tt>
|
1130
|
+
# * <tt>Firm#clients.delete</tt>
|
1131
|
+
# * <tt>Firm#clients.destroy</tt>
|
1132
|
+
# * <tt>Firm#clients=</tt>
|
1133
|
+
# * <tt>Firm#client_ids</tt>
|
1134
|
+
# * <tt>Firm#client_ids=</tt>
|
1135
|
+
# * <tt>Firm#clients.clear</tt>
|
1136
|
+
# * <tt>Firm#clients.empty?</tt> (similar to <tt>firm.clients.size == 0</tt>)
|
1137
|
+
# * <tt>Firm#clients.size</tt> (similar to <tt>Client.count "firm_id = #{id}"</tt>)
|
1138
|
+
# * <tt>Firm#clients.find</tt> (similar to <tt>Client.where(firm_id: id).find(id)</tt>)
|
1139
|
+
# * <tt>Firm#clients.exists?(name: 'ACME')</tt> (similar to <tt>Client.exists?(name: 'ACME', firm_id: firm.id)</tt>)
|
1140
|
+
# * <tt>Firm#clients.build</tt> (similar to <tt>Client.new("firm_id" => id)</tt>)
|
1141
|
+
# * <tt>Firm#clients.create</tt> (similar to <tt>c = Client.new("firm_id" => id); c.save; c</tt>)
|
1142
|
+
# * <tt>Firm#clients.create!</tt> (similar to <tt>c = Client.new("firm_id" => id); c.save!</tt>)
|
1143
|
+
# The declaration can also include an +options+ hash to specialize the behavior of the association.
|
1144
|
+
#
|
1145
|
+
# === Scopes
|
1146
|
+
#
|
1147
|
+
# You can pass a second argument +scope+ as a callable (i.e. proc or
|
1148
|
+
# lambda) to retrieve a specific set of records or customize the generated
|
1149
|
+
# query when you access the associated collection.
|
1150
|
+
#
|
1151
|
+
# Scope examples:
|
1152
|
+
# has_many :comments, -> { where(author_id: 1) }
|
1153
|
+
# has_many :employees, -> { joins(:address) }
|
1154
|
+
# has_many :posts, ->(post) { where("max_post_length > ?", post.length) }
|
1155
|
+
#
|
1156
|
+
# === Extensions
|
1157
|
+
#
|
1158
|
+
# The +extension+ argument allows you to pass a block into a has_many
|
1159
|
+
# association. This is useful for adding new finders, creators and other
|
1160
|
+
# factory-type methods to be used as part of the association.
|
1161
|
+
#
|
1162
|
+
# Extension examples:
|
1163
|
+
# has_many :employees do
|
1164
|
+
# def find_or_create_by_name(name)
|
1165
|
+
# first_name, last_name = name.split(" ", 2)
|
1166
|
+
# find_or_create_by(first_name: first_name, last_name: last_name)
|
1167
|
+
# end
|
1168
|
+
# end
|
1169
|
+
#
|
1170
|
+
# === Options
|
1171
|
+
# [:class_name]
|
1172
|
+
# Specify the class name of the association. Use it only if that name can't be inferred
|
1173
|
+
# from the association name. So <tt>has_many :products</tt> will by default be linked
|
1174
|
+
# to the Product class, but if the real class name is SpecialProduct, you'll have to
|
1175
|
+
# specify it with this option.
|
1176
|
+
# [:foreign_key]
|
1177
|
+
# Specify the foreign key used for the association. By default this is guessed to be the name
|
1178
|
+
# of this class in lower-case and "_id" suffixed. So a Person class that makes a +has_many+
|
1179
|
+
# association will use "person_id" as the default <tt>:foreign_key</tt>.
|
1180
|
+
# [:foreign_type]
|
1181
|
+
# Specify the column used to store the associated object's type, if this is a polymorphic
|
1182
|
+
# association. By default this is guessed to be the name of the polymorphic association
|
1183
|
+
# specified on "as" option with a "_type" suffix. So a class that defines a
|
1184
|
+
# <tt>has_many :tags, as: :taggable</tt> association will use "taggable_type" as the
|
1185
|
+
# default <tt>:foreign_type</tt>.
|
1186
|
+
# [:primary_key]
|
1187
|
+
# Specify the name of the column to use as the primary key for the association. By default this is +id+.
|
1188
|
+
# [:dependent]
|
1189
|
+
# Controls what happens to the associated objects when
|
1190
|
+
# their owner is destroyed. Note that these are implemented as
|
1191
|
+
# callbacks, and Rails executes callbacks in order. Therefore, other
|
1192
|
+
# similar callbacks may affect the <tt>:dependent</tt> behavior, and the
|
1193
|
+
# <tt>:dependent</tt> behavior may affect other callbacks.
|
1194
|
+
#
|
1195
|
+
# * <tt>:destroy</tt> causes all the associated objects to also be destroyed.
|
1196
|
+
# * <tt>:delete_all</tt> causes all the associated objects to be deleted directly from the database (so callbacks will not be executed).
|
1197
|
+
# * <tt>:nullify</tt> causes the foreign keys to be set to +NULL+. Callbacks are not executed.
|
1198
|
+
# * <tt>:restrict_with_exception</tt> causes an exception to be raised if there are any associated records.
|
1199
|
+
# * <tt>:restrict_with_error</tt> causes an error to be added to the owner if there are any associated objects.
|
1200
|
+
#
|
1201
|
+
# If using with the <tt>:through</tt> option, the association on the join model must be
|
1202
|
+
# a +belongs_to+, and the records which get deleted are the join records, rather than
|
1203
|
+
# the associated records.
|
1204
|
+
# [:counter_cache]
|
1205
|
+
# This option can be used to configure a custom named <tt>:counter_cache.</tt> You only need this option,
|
1206
|
+
# when you customized the name of your <tt>:counter_cache</tt> on the <tt>belongs_to</tt> association.
|
1207
|
+
# [:as]
|
1208
|
+
# Specifies a polymorphic interface (See <tt>belongs_to</tt>).
|
1209
|
+
# [:through]
|
1210
|
+
# Specifies an association through which to perform the query. This can be any other type
|
1211
|
+
# of association, including other <tt>:through</tt> associations. Options for <tt>:class_name</tt>,
|
1212
|
+
# <tt>:primary_key</tt> and <tt>:foreign_key</tt> are ignored, as the association uses the
|
1213
|
+
# source reflection.
|
1214
|
+
#
|
1215
|
+
# If the association on the join model is a +belongs_to+, the collection can be modified
|
1216
|
+
# and the records on the <tt>:through</tt> model will be automatically created and removed
|
1217
|
+
# as appropriate. Otherwise, the collection is read-only, so you should manipulate the
|
1218
|
+
# <tt>:through</tt> association directly.
|
1219
|
+
#
|
1220
|
+
# If you are going to modify the association (rather than just read from it), then it is
|
1221
|
+
# a good idea to set the <tt>:inverse_of</tt> option on the source association on the
|
1222
|
+
# join model. This allows associated records to be built which will automatically create
|
1223
|
+
# the appropriate join model records when they are saved. (See the 'Association Join Models'
|
1224
|
+
# section above.)
|
1225
|
+
# [:source]
|
1226
|
+
# Specifies the source association name used by <tt>has_many :through</tt> queries.
|
1227
|
+
# Only use it if the name cannot be inferred from the association.
|
1228
|
+
# <tt>has_many :subscribers, through: :subscriptions</tt> will look for either <tt>:subscribers</tt> or
|
1229
|
+
# <tt>:subscriber</tt> on Subscription, unless a <tt>:source</tt> is given.
|
1230
|
+
# [:source_type]
|
1231
|
+
# Specifies type of the source association used by <tt>has_many :through</tt> queries where the source
|
1232
|
+
# association is a polymorphic +belongs_to+.
|
1233
|
+
# [:validate]
|
1234
|
+
# If +false+, don't validate the associated objects when saving the parent object. true by default.
|
1235
|
+
# [:autosave]
|
1236
|
+
# If true, always save the associated objects or destroy them if marked for destruction,
|
1237
|
+
# when saving the parent object. If false, never save or destroy the associated objects.
|
1238
|
+
# By default, only save associated objects that are new records. This option is implemented as a
|
1239
|
+
# +before_save+ callback. Because callbacks are run in the order they are defined, associated objects
|
1240
|
+
# may need to be explicitly saved in any user-defined +before_save+ callbacks.
|
1241
|
+
#
|
1242
|
+
# Note that <tt>accepts_nested_attributes_for</tt> sets <tt>:autosave</tt> to <tt>true</tt>.
|
1243
|
+
# [:inverse_of]
|
1244
|
+
# Specifies the name of the <tt>belongs_to</tt> association on the associated object
|
1245
|
+
# that is the inverse of this <tt>has_many</tt> association. Does not work in combination
|
1246
|
+
# with <tt>:through</tt> or <tt>:as</tt> options.
|
1247
|
+
# See ActiveRecord::Associations::ClassMethods's overview on Bi-directional associations for more detail.
|
1248
|
+
#
|
1249
|
+
# Option examples:
|
1250
|
+
# has_many :comments, -> { order "posted_on" }
|
1251
|
+
# has_many :comments, -> { includes :author }
|
1252
|
+
# has_many :people, -> { where(deleted: false).order("name") }, class_name: "Person"
|
1253
|
+
# has_many :tracks, -> { order "position" }, dependent: :destroy
|
1254
|
+
# has_many :comments, dependent: :nullify
|
1255
|
+
# has_many :tags, as: :taggable
|
1256
|
+
# has_many :reports, -> { readonly }
|
1257
|
+
# has_many :subscribers, through: :subscriptions, source: :user
|
1258
|
+
def has_many(name, scope = nil, options = {}, &extension)
|
1259
|
+
reflection = Builder::HasMany.build(self, name, scope, options, &extension)
|
1260
|
+
Reflection.add_reflection self, name, reflection
|
1261
|
+
end
|
1262
|
+
|
1263
|
+
# Specifies a one-to-one association with another class. This method should only be used
|
1264
|
+
# if the other class contains the foreign key. If the current class contains the foreign key,
|
1265
|
+
# then you should use +belongs_to+ instead. See also ActiveRecord::Associations::ClassMethods's overview
|
1266
|
+
# on when to use +has_one+ and when to use +belongs_to+.
|
1267
|
+
#
|
1268
|
+
# The following methods for retrieval and query of a single associated object will be added:
|
1269
|
+
#
|
1270
|
+
# +association+ is a placeholder for the symbol passed as the +name+ argument, so
|
1271
|
+
# <tt>has_one :manager</tt> would add among others <tt>manager.nil?</tt>.
|
1272
|
+
#
|
1273
|
+
# [association(force_reload = false)]
|
1274
|
+
# Returns the associated object. +nil+ is returned if none is found.
|
1275
|
+
# [association=(associate)]
|
1276
|
+
# Assigns the associate object, extracts the primary key, sets it as the foreign key,
|
1277
|
+
# and saves the associate object. To avoid database inconsistencies, permanently deletes an existing
|
1278
|
+
# associated object when assigning a new one, even if the new one isn't saved to database.
|
1279
|
+
# [build_association(attributes = {})]
|
1280
|
+
# Returns a new object of the associated type that has been instantiated
|
1281
|
+
# with +attributes+ and linked to this object through a foreign key, but has not
|
1282
|
+
# yet been saved.
|
1283
|
+
# [create_association(attributes = {})]
|
1284
|
+
# Returns a new object of the associated type that has been instantiated
|
1285
|
+
# with +attributes+, linked to this object through a foreign key, and that
|
1286
|
+
# has already been saved (if it passed the validation).
|
1287
|
+
# [create_association!(attributes = {})]
|
1288
|
+
# Does the same as <tt>create_association</tt>, but raises <tt>ActiveRecord::RecordInvalid</tt>
|
1289
|
+
# if the record is invalid.
|
1290
|
+
#
|
1291
|
+
# === Example
|
1292
|
+
#
|
1293
|
+
# An Account class declares <tt>has_one :beneficiary</tt>, which will add:
|
1294
|
+
# * <tt>Account#beneficiary</tt> (similar to <tt>Beneficiary.where(account_id: id).first</tt>)
|
1295
|
+
# * <tt>Account#beneficiary=(beneficiary)</tt> (similar to <tt>beneficiary.account_id = account.id; beneficiary.save</tt>)
|
1296
|
+
# * <tt>Account#build_beneficiary</tt> (similar to <tt>Beneficiary.new("account_id" => id)</tt>)
|
1297
|
+
# * <tt>Account#create_beneficiary</tt> (similar to <tt>b = Beneficiary.new("account_id" => id); b.save; b</tt>)
|
1298
|
+
# * <tt>Account#create_beneficiary!</tt> (similar to <tt>b = Beneficiary.new("account_id" => id); b.save!; b</tt>)
|
1299
|
+
#
|
1300
|
+
# === Scopes
|
1301
|
+
#
|
1302
|
+
# You can pass a second argument +scope+ as a callable (i.e. proc or
|
1303
|
+
# lambda) to retrieve a specific record or customize the generated query
|
1304
|
+
# when you access the associated object.
|
1305
|
+
#
|
1306
|
+
# Scope examples:
|
1307
|
+
# has_one :author, -> { where(comment_id: 1) }
|
1308
|
+
# has_one :employer, -> { joins(:company) }
|
1309
|
+
# has_one :dob, ->(dob) { where("Date.new(2000, 01, 01) > ?", dob) }
|
1310
|
+
#
|
1311
|
+
# === Options
|
1312
|
+
#
|
1313
|
+
# The declaration can also include an +options+ hash to specialize the behavior of the association.
|
1314
|
+
#
|
1315
|
+
# Options are:
|
1316
|
+
# [:class_name]
|
1317
|
+
# Specify the class name of the association. Use it only if that name can't be inferred
|
1318
|
+
# from the association name. So <tt>has_one :manager</tt> will by default be linked to the Manager class, but
|
1319
|
+
# if the real class name is Person, you'll have to specify it with this option.
|
1320
|
+
# [:dependent]
|
1321
|
+
# Controls what happens to the associated object when
|
1322
|
+
# its owner is destroyed:
|
1323
|
+
#
|
1324
|
+
# * <tt>:destroy</tt> causes the associated object to also be destroyed
|
1325
|
+
# * <tt>:delete</tt> causes the associated object to be deleted directly from the database (so callbacks will not execute)
|
1326
|
+
# * <tt>:nullify</tt> causes the foreign key to be set to +NULL+. Callbacks are not executed.
|
1327
|
+
# * <tt>:restrict_with_exception</tt> causes an exception to be raised if there is an associated record
|
1328
|
+
# * <tt>:restrict_with_error</tt> causes an error to be added to the owner if there is an associated object
|
1329
|
+
# [:foreign_key]
|
1330
|
+
# Specify the foreign key used for the association. By default this is guessed to be the name
|
1331
|
+
# of this class in lower-case and "_id" suffixed. So a Person class that makes a +has_one+ association
|
1332
|
+
# will use "person_id" as the default <tt>:foreign_key</tt>.
|
1333
|
+
# [:foreign_type]
|
1334
|
+
# Specify the column used to store the associated object's type, if this is a polymorphic
|
1335
|
+
# association. By default this is guessed to be the name of the polymorphic association
|
1336
|
+
# specified on "as" option with a "_type" suffix. So a class that defines a
|
1337
|
+
# <tt>has_one :tag, as: :taggable</tt> association will use "taggable_type" as the
|
1338
|
+
# default <tt>:foreign_type</tt>.
|
1339
|
+
# [:primary_key]
|
1340
|
+
# Specify the method that returns the primary key used for the association. By default this is +id+.
|
1341
|
+
# [:as]
|
1342
|
+
# Specifies a polymorphic interface (See <tt>belongs_to</tt>).
|
1343
|
+
# [:through]
|
1344
|
+
# Specifies a Join Model through which to perform the query. Options for <tt>:class_name</tt>,
|
1345
|
+
# <tt>:primary_key</tt>, and <tt>:foreign_key</tt> are ignored, as the association uses the
|
1346
|
+
# source reflection. You can only use a <tt>:through</tt> query through a <tt>has_one</tt>
|
1347
|
+
# or <tt>belongs_to</tt> association on the join model.
|
1348
|
+
# [:source]
|
1349
|
+
# Specifies the source association name used by <tt>has_one :through</tt> queries.
|
1350
|
+
# Only use it if the name cannot be inferred from the association.
|
1351
|
+
# <tt>has_one :favorite, through: :favorites</tt> will look for a
|
1352
|
+
# <tt>:favorite</tt> on Favorite, unless a <tt>:source</tt> is given.
|
1353
|
+
# [:source_type]
|
1354
|
+
# Specifies type of the source association used by <tt>has_one :through</tt> queries where the source
|
1355
|
+
# association is a polymorphic +belongs_to+.
|
1356
|
+
# [:validate]
|
1357
|
+
# If +false+, don't validate the associated object when saving the parent object. +false+ by default.
|
1358
|
+
# [:autosave]
|
1359
|
+
# If true, always save the associated object or destroy it if marked for destruction,
|
1360
|
+
# when saving the parent object. If false, never save or destroy the associated object.
|
1361
|
+
# By default, only save the associated object if it's a new record.
|
1362
|
+
#
|
1363
|
+
# Note that <tt>accepts_nested_attributes_for</tt> sets <tt>:autosave</tt> to <tt>true</tt>.
|
1364
|
+
# [:inverse_of]
|
1365
|
+
# Specifies the name of the <tt>belongs_to</tt> association on the associated object
|
1366
|
+
# that is the inverse of this <tt>has_one</tt> association. Does not work in combination
|
1367
|
+
# with <tt>:through</tt> or <tt>:as</tt> options.
|
1368
|
+
# See ActiveRecord::Associations::ClassMethods's overview on Bi-directional associations for more detail.
|
1369
|
+
# [:required]
|
1370
|
+
# When set to +true+, the association will also have its presence validated.
|
1371
|
+
# This will validate the association itself, not the id. You can use
|
1372
|
+
# +:inverse_of+ to avoid an extra query during validation.
|
1373
|
+
#
|
1374
|
+
# Option examples:
|
1375
|
+
# has_one :credit_card, dependent: :destroy # destroys the associated credit card
|
1376
|
+
# has_one :credit_card, dependent: :nullify # updates the associated records foreign
|
1377
|
+
# # key value to NULL rather than destroying it
|
1378
|
+
# has_one :last_comment, -> { order 'posted_on' }, class_name: "Comment"
|
1379
|
+
# has_one :project_manager, -> { where role: 'project_manager' }, class_name: "Person"
|
1380
|
+
# has_one :attachment, as: :attachable
|
1381
|
+
# has_one :boss, -> { readonly }
|
1382
|
+
# has_one :club, through: :membership
|
1383
|
+
# has_one :primary_address, -> { where primary: true }, through: :addressables, source: :addressable
|
1384
|
+
# has_one :credit_card, required: true
|
1385
|
+
def has_one(name, scope = nil, options = {})
|
1386
|
+
reflection = Builder::HasOne.build(self, name, scope, options)
|
1387
|
+
Reflection.add_reflection self, name, reflection
|
1388
|
+
end
|
1389
|
+
|
1390
|
+
# Specifies a one-to-one association with another class. This method should only be used
|
1391
|
+
# if this class contains the foreign key. If the other class contains the foreign key,
|
1392
|
+
# then you should use +has_one+ instead. See also ActiveRecord::Associations::ClassMethods's overview
|
1393
|
+
# on when to use +has_one+ and when to use +belongs_to+.
|
1394
|
+
#
|
1395
|
+
# Methods will be added for retrieval and query for a single associated object, for which
|
1396
|
+
# this object holds an id:
|
1397
|
+
#
|
1398
|
+
# +association+ is a placeholder for the symbol passed as the +name+ argument, so
|
1399
|
+
# <tt>belongs_to :author</tt> would add among others <tt>author.nil?</tt>.
|
1400
|
+
#
|
1401
|
+
# [association(force_reload = false)]
|
1402
|
+
# Returns the associated object. +nil+ is returned if none is found.
|
1403
|
+
# [association=(associate)]
|
1404
|
+
# Assigns the associate object, extracts the primary key, and sets it as the foreign key.
|
1405
|
+
# [build_association(attributes = {})]
|
1406
|
+
# Returns a new object of the associated type that has been instantiated
|
1407
|
+
# with +attributes+ and linked to this object through a foreign key, but has not yet been saved.
|
1408
|
+
# [create_association(attributes = {})]
|
1409
|
+
# Returns a new object of the associated type that has been instantiated
|
1410
|
+
# with +attributes+, linked to this object through a foreign key, and that
|
1411
|
+
# has already been saved (if it passed the validation).
|
1412
|
+
# [create_association!(attributes = {})]
|
1413
|
+
# Does the same as <tt>create_association</tt>, but raises <tt>ActiveRecord::RecordInvalid</tt>
|
1414
|
+
# if the record is invalid.
|
1415
|
+
#
|
1416
|
+
# === Example
|
1417
|
+
#
|
1418
|
+
# A Post class declares <tt>belongs_to :author</tt>, which will add:
|
1419
|
+
# * <tt>Post#author</tt> (similar to <tt>Author.find(author_id)</tt>)
|
1420
|
+
# * <tt>Post#author=(author)</tt> (similar to <tt>post.author_id = author.id</tt>)
|
1421
|
+
# * <tt>Post#build_author</tt> (similar to <tt>post.author = Author.new</tt>)
|
1422
|
+
# * <tt>Post#create_author</tt> (similar to <tt>post.author = Author.new; post.author.save; post.author</tt>)
|
1423
|
+
# * <tt>Post#create_author!</tt> (similar to <tt>post.author = Author.new; post.author.save!; post.author</tt>)
|
1424
|
+
# The declaration can also include an +options+ hash to specialize the behavior of the association.
|
1425
|
+
#
|
1426
|
+
# === Scopes
|
1427
|
+
#
|
1428
|
+
# You can pass a second argument +scope+ as a callable (i.e. proc or
|
1429
|
+
# lambda) to retrieve a specific record or customize the generated query
|
1430
|
+
# when you access the associated object.
|
1431
|
+
#
|
1432
|
+
# Scope examples:
|
1433
|
+
# belongs_to :user, -> { where(id: 2) }
|
1434
|
+
# belongs_to :user, -> { joins(:friends) }
|
1435
|
+
# belongs_to :level, ->(level) { where("game_level > ?", level.current) }
|
1436
|
+
#
|
1437
|
+
# === Options
|
1438
|
+
#
|
1439
|
+
# [:class_name]
|
1440
|
+
# Specify the class name of the association. Use it only if that name can't be inferred
|
1441
|
+
# from the association name. So <tt>belongs_to :author</tt> will by default be linked to the Author class, but
|
1442
|
+
# if the real class name is Person, you'll have to specify it with this option.
|
1443
|
+
# [:foreign_key]
|
1444
|
+
# Specify the foreign key used for the association. By default this is guessed to be the name
|
1445
|
+
# of the association with an "_id" suffix. So a class that defines a <tt>belongs_to :person</tt>
|
1446
|
+
# association will use "person_id" as the default <tt>:foreign_key</tt>. Similarly,
|
1447
|
+
# <tt>belongs_to :favorite_person, class_name: "Person"</tt> will use a foreign key
|
1448
|
+
# of "favorite_person_id".
|
1449
|
+
# [:foreign_type]
|
1450
|
+
# Specify the column used to store the associated object's type, if this is a polymorphic
|
1451
|
+
# association. By default this is guessed to be the name of the association with a "_type"
|
1452
|
+
# suffix. So a class that defines a <tt>belongs_to :taggable, polymorphic: true</tt>
|
1453
|
+
# association will use "taggable_type" as the default <tt>:foreign_type</tt>.
|
1454
|
+
# [:primary_key]
|
1455
|
+
# Specify the method that returns the primary key of associated object used for the association.
|
1456
|
+
# By default this is id.
|
1457
|
+
# [:dependent]
|
1458
|
+
# If set to <tt>:destroy</tt>, the associated object is destroyed when this object is. If set to
|
1459
|
+
# <tt>:delete</tt>, the associated object is deleted *without* calling its destroy method.
|
1460
|
+
# This option should not be specified when <tt>belongs_to</tt> is used in conjunction with
|
1461
|
+
# a <tt>has_many</tt> relationship on another class because of the potential to leave
|
1462
|
+
# orphaned records behind.
|
1463
|
+
# [:counter_cache]
|
1464
|
+
# Caches the number of belonging objects on the associate class through the use of +increment_counter+
|
1465
|
+
# and +decrement_counter+. The counter cache is incremented when an object of this
|
1466
|
+
# class is created and decremented when it's destroyed. This requires that a column
|
1467
|
+
# named <tt>#{table_name}_count</tt> (such as +comments_count+ for a belonging Comment class)
|
1468
|
+
# is used on the associate class (such as a Post class) - that is the migration for
|
1469
|
+
# <tt>#{table_name}_count</tt> is created on the associate class (such that <tt>Post.comments_count</tt> will
|
1470
|
+
# return the count cached, see note below). You can also specify a custom counter
|
1471
|
+
# cache column by providing a column name instead of a +true+/+false+ value to this
|
1472
|
+
# option (e.g., <tt>counter_cache: :my_custom_counter</tt>.)
|
1473
|
+
# Note: Specifying a counter cache will add it to that model's list of readonly attributes
|
1474
|
+
# using +attr_readonly+.
|
1475
|
+
# [:polymorphic]
|
1476
|
+
# Specify this association is a polymorphic association by passing +true+.
|
1477
|
+
# Note: If you've enabled the counter cache, then you may want to add the counter cache attribute
|
1478
|
+
# to the +attr_readonly+ list in the associated classes (e.g. <tt>class Post; attr_readonly :comments_count; end</tt>).
|
1479
|
+
# [:validate]
|
1480
|
+
# If +false+, don't validate the associated objects when saving the parent object. +false+ by default.
|
1481
|
+
# [:autosave]
|
1482
|
+
# If true, always save the associated object or destroy it if marked for destruction, when
|
1483
|
+
# saving the parent object.
|
1484
|
+
# If false, never save or destroy the associated object.
|
1485
|
+
# By default, only save the associated object if it's a new record.
|
1486
|
+
#
|
1487
|
+
# Note that <tt>accepts_nested_attributes_for</tt> sets <tt>:autosave</tt> to <tt>true</tt>.
|
1488
|
+
# [:touch]
|
1489
|
+
# If true, the associated object will be touched (the updated_at/on attributes set to current time)
|
1490
|
+
# when this record is either saved or destroyed. If you specify a symbol, that attribute
|
1491
|
+
# will be updated with the current time in addition to the updated_at/on attribute.
|
1492
|
+
# [:inverse_of]
|
1493
|
+
# Specifies the name of the <tt>has_one</tt> or <tt>has_many</tt> association on the associated
|
1494
|
+
# object that is the inverse of this <tt>belongs_to</tt> association. Does not work in
|
1495
|
+
# combination with the <tt>:polymorphic</tt> options.
|
1496
|
+
# See ActiveRecord::Associations::ClassMethods's overview on Bi-directional associations for more detail.
|
1497
|
+
# [:required]
|
1498
|
+
# When set to +true+, the association will also have its presence validated.
|
1499
|
+
# This will validate the association itself, not the id. You can use
|
1500
|
+
# +:inverse_of+ to avoid an extra query during validation.
|
1501
|
+
#
|
1502
|
+
# Option examples:
|
1503
|
+
# belongs_to :firm, foreign_key: "client_of"
|
1504
|
+
# belongs_to :person, primary_key: "name", foreign_key: "person_name"
|
1505
|
+
# belongs_to :author, class_name: "Person", foreign_key: "author_id"
|
1506
|
+
# belongs_to :valid_coupon, ->(o) { where "discounts > ?", o.payments_count },
|
1507
|
+
# class_name: "Coupon", foreign_key: "coupon_id"
|
1508
|
+
# belongs_to :attachable, polymorphic: true
|
1509
|
+
# belongs_to :project, -> { readonly }
|
1510
|
+
# belongs_to :post, counter_cache: true
|
1511
|
+
# belongs_to :company, touch: true
|
1512
|
+
# belongs_to :company, touch: :employees_last_updated_at
|
1513
|
+
# belongs_to :company, required: true
|
1514
|
+
def belongs_to(name, scope = nil, options = {})
|
1515
|
+
reflection = Builder::BelongsTo.build(self, name, scope, options)
|
1516
|
+
Reflection.add_reflection self, name, reflection
|
1517
|
+
end
|
1518
|
+
|
1519
|
+
# Specifies a many-to-many relationship with another class. This associates two classes via an
|
1520
|
+
# intermediate join table. Unless the join table is explicitly specified as an option, it is
|
1521
|
+
# guessed using the lexical order of the class names. So a join between Developer and Project
|
1522
|
+
# will give the default join table name of "developers_projects" because "D" precedes "P" alphabetically.
|
1523
|
+
# Note that this precedence is calculated using the <tt><</tt> operator for String. This
|
1524
|
+
# means that if the strings are of different lengths, and the strings are equal when compared
|
1525
|
+
# up to the shortest length, then the longer string is considered of higher
|
1526
|
+
# lexical precedence than the shorter one. For example, one would expect the tables "paper_boxes" and "papers"
|
1527
|
+
# to generate a join table name of "papers_paper_boxes" because of the length of the name "paper_boxes",
|
1528
|
+
# but it in fact generates a join table name of "paper_boxes_papers". Be aware of this caveat, and use the
|
1529
|
+
# custom <tt>:join_table</tt> option if you need to.
|
1530
|
+
# If your tables share a common prefix, it will only appear once at the beginning. For example,
|
1531
|
+
# the tables "catalog_categories" and "catalog_products" generate a join table name of "catalog_categories_products".
|
1532
|
+
#
|
1533
|
+
# The join table should not have a primary key or a model associated with it. You must manually generate the
|
1534
|
+
# join table with a migration such as this:
|
1535
|
+
#
|
1536
|
+
# class CreateDevelopersProjectsJoinTable < ActiveRecord::Migration
|
1537
|
+
# def change
|
1538
|
+
# create_table :developers_projects, id: false do |t|
|
1539
|
+
# t.integer :developer_id
|
1540
|
+
# t.integer :project_id
|
1541
|
+
# end
|
1542
|
+
# end
|
1543
|
+
# end
|
1544
|
+
#
|
1545
|
+
# It's also a good idea to add indexes to each of those columns to speed up the joins process.
|
1546
|
+
# However, in MySQL it is advised to add a compound index for both of the columns as MySQL only
|
1547
|
+
# uses one index per table during the lookup.
|
1548
|
+
#
|
1549
|
+
# Adds the following methods for retrieval and query:
|
1550
|
+
#
|
1551
|
+
# +collection+ is a placeholder for the symbol passed as the +name+ argument, so
|
1552
|
+
# <tt>has_and_belongs_to_many :categories</tt> would add among others <tt>categories.empty?</tt>.
|
1553
|
+
#
|
1554
|
+
# [collection(force_reload = false)]
|
1555
|
+
# Returns an array of all the associated objects.
|
1556
|
+
# An empty array is returned if none are found.
|
1557
|
+
# [collection<<(object, ...)]
|
1558
|
+
# Adds one or more objects to the collection by creating associations in the join table
|
1559
|
+
# (<tt>collection.push</tt> and <tt>collection.concat</tt> are aliases to this method).
|
1560
|
+
# Note that this operation instantly fires update SQL without waiting for the save or update call on the
|
1561
|
+
# parent object, unless the parent object is a new record.
|
1562
|
+
# [collection.delete(object, ...)]
|
1563
|
+
# Removes one or more objects from the collection by removing their associations from the join table.
|
1564
|
+
# This does not destroy the objects.
|
1565
|
+
# [collection.destroy(object, ...)]
|
1566
|
+
# Removes one or more objects from the collection by running destroy on each association in the join table, overriding any dependent option.
|
1567
|
+
# This does not destroy the objects.
|
1568
|
+
# [collection=objects]
|
1569
|
+
# Replaces the collection's content by deleting and adding objects as appropriate.
|
1570
|
+
# [collection_singular_ids]
|
1571
|
+
# Returns an array of the associated objects' ids.
|
1572
|
+
# [collection_singular_ids=ids]
|
1573
|
+
# Replace the collection by the objects identified by the primary keys in +ids+.
|
1574
|
+
# [collection.clear]
|
1575
|
+
# Removes every object from the collection. This does not destroy the objects.
|
1576
|
+
# [collection.empty?]
|
1577
|
+
# Returns +true+ if there are no associated objects.
|
1578
|
+
# [collection.size]
|
1579
|
+
# Returns the number of associated objects.
|
1580
|
+
# [collection.find(id)]
|
1581
|
+
# Finds an associated object responding to the +id+ and that
|
1582
|
+
# meets the condition that it has to be associated with this object.
|
1583
|
+
# Uses the same rules as <tt>ActiveRecord::Base.find</tt>.
|
1584
|
+
# [collection.exists?(...)]
|
1585
|
+
# Checks whether an associated object with the given conditions exists.
|
1586
|
+
# Uses the same rules as <tt>ActiveRecord::Base.exists?</tt>.
|
1587
|
+
# [collection.build(attributes = {})]
|
1588
|
+
# Returns a new object of the collection type that has been instantiated
|
1589
|
+
# with +attributes+ and linked to this object through the join table, but has not yet been saved.
|
1590
|
+
# [collection.create(attributes = {})]
|
1591
|
+
# Returns a new object of the collection type that has been instantiated
|
1592
|
+
# with +attributes+, linked to this object through the join table, and that has already been
|
1593
|
+
# saved (if it passed the validation).
|
1594
|
+
#
|
1595
|
+
# === Example
|
1596
|
+
#
|
1597
|
+
# A Developer class declares <tt>has_and_belongs_to_many :projects</tt>, which will add:
|
1598
|
+
# * <tt>Developer#projects</tt>
|
1599
|
+
# * <tt>Developer#projects<<</tt>
|
1600
|
+
# * <tt>Developer#projects.delete</tt>
|
1601
|
+
# * <tt>Developer#projects.destroy</tt>
|
1602
|
+
# * <tt>Developer#projects=</tt>
|
1603
|
+
# * <tt>Developer#project_ids</tt>
|
1604
|
+
# * <tt>Developer#project_ids=</tt>
|
1605
|
+
# * <tt>Developer#projects.clear</tt>
|
1606
|
+
# * <tt>Developer#projects.empty?</tt>
|
1607
|
+
# * <tt>Developer#projects.size</tt>
|
1608
|
+
# * <tt>Developer#projects.find(id)</tt>
|
1609
|
+
# * <tt>Developer#projects.exists?(...)</tt>
|
1610
|
+
# * <tt>Developer#projects.build</tt> (similar to <tt>Project.new("developer_id" => id)</tt>)
|
1611
|
+
# * <tt>Developer#projects.create</tt> (similar to <tt>c = Project.new("developer_id" => id); c.save; c</tt>)
|
1612
|
+
# The declaration may include an +options+ hash to specialize the behavior of the association.
|
1613
|
+
#
|
1614
|
+
# === Scopes
|
1615
|
+
#
|
1616
|
+
# You can pass a second argument +scope+ as a callable (i.e. proc or
|
1617
|
+
# lambda) to retrieve a specific set of records or customize the generated
|
1618
|
+
# query when you access the associated collection.
|
1619
|
+
#
|
1620
|
+
# Scope examples:
|
1621
|
+
# has_and_belongs_to_many :projects, -> { includes :milestones, :manager }
|
1622
|
+
# has_and_belongs_to_many :categories, ->(category) {
|
1623
|
+
# where("default_category = ?", category.name)
|
1624
|
+
# }
|
1625
|
+
#
|
1626
|
+
# === Extensions
|
1627
|
+
#
|
1628
|
+
# The +extension+ argument allows you to pass a block into a
|
1629
|
+
# has_and_belongs_to_many association. This is useful for adding new
|
1630
|
+
# finders, creators and other factory-type methods to be used as part of
|
1631
|
+
# the association.
|
1632
|
+
#
|
1633
|
+
# Extension examples:
|
1634
|
+
# has_and_belongs_to_many :contractors do
|
1635
|
+
# def find_or_create_by_name(name)
|
1636
|
+
# first_name, last_name = name.split(" ", 2)
|
1637
|
+
# find_or_create_by(first_name: first_name, last_name: last_name)
|
1638
|
+
# end
|
1639
|
+
# end
|
1640
|
+
#
|
1641
|
+
# === Options
|
1642
|
+
#
|
1643
|
+
# [:class_name]
|
1644
|
+
# Specify the class name of the association. Use it only if that name can't be inferred
|
1645
|
+
# from the association name. So <tt>has_and_belongs_to_many :projects</tt> will by default be linked to the
|
1646
|
+
# Project class, but if the real class name is SuperProject, you'll have to specify it with this option.
|
1647
|
+
# [:join_table]
|
1648
|
+
# Specify the name of the join table if the default based on lexical order isn't what you want.
|
1649
|
+
# <b>WARNING:</b> If you're overwriting the table name of either class, the +table_name+ method
|
1650
|
+
# MUST be declared underneath any +has_and_belongs_to_many+ declaration in order to work.
|
1651
|
+
# [:foreign_key]
|
1652
|
+
# Specify the foreign key used for the association. By default this is guessed to be the name
|
1653
|
+
# of this class in lower-case and "_id" suffixed. So a Person class that makes
|
1654
|
+
# a +has_and_belongs_to_many+ association to Project will use "person_id" as the
|
1655
|
+
# default <tt>:foreign_key</tt>.
|
1656
|
+
# [:association_foreign_key]
|
1657
|
+
# Specify the foreign key used for the association on the receiving side of the association.
|
1658
|
+
# By default this is guessed to be the name of the associated class in lower-case and "_id" suffixed.
|
1659
|
+
# So if a Person class makes a +has_and_belongs_to_many+ association to Project,
|
1660
|
+
# the association will use "project_id" as the default <tt>:association_foreign_key</tt>.
|
1661
|
+
# [:readonly]
|
1662
|
+
# If true, all the associated objects are readonly through the association.
|
1663
|
+
# [:validate]
|
1664
|
+
# If +false+, don't validate the associated objects when saving the parent object. +true+ by default.
|
1665
|
+
# [:autosave]
|
1666
|
+
# If true, always save the associated objects or destroy them if marked for destruction, when
|
1667
|
+
# saving the parent object.
|
1668
|
+
# If false, never save or destroy the associated objects.
|
1669
|
+
# By default, only save associated objects that are new records.
|
1670
|
+
#
|
1671
|
+
# Note that <tt>accepts_nested_attributes_for</tt> sets <tt>:autosave</tt> to <tt>true</tt>.
|
1672
|
+
#
|
1673
|
+
# Option examples:
|
1674
|
+
# has_and_belongs_to_many :projects
|
1675
|
+
# has_and_belongs_to_many :projects, -> { includes :milestones, :manager }
|
1676
|
+
# has_and_belongs_to_many :nations, class_name: "Country"
|
1677
|
+
# has_and_belongs_to_many :categories, join_table: "prods_cats"
|
1678
|
+
# has_and_belongs_to_many :categories, -> { readonly }
|
1679
|
+
def has_and_belongs_to_many(name, scope = nil, options = {}, &extension)
|
1680
|
+
if scope.is_a?(Hash)
|
1681
|
+
options = scope
|
1682
|
+
scope = nil
|
1683
|
+
end
|
1684
|
+
|
1685
|
+
habtm_reflection = ActiveRecord::Reflection::HasAndBelongsToManyReflection.new(name, scope, options, self)
|
1686
|
+
|
1687
|
+
builder = Builder::HasAndBelongsToMany.new name, self, options
|
1688
|
+
|
1689
|
+
join_model = builder.through_model
|
1690
|
+
|
1691
|
+
# FIXME: we should move this to the internal constants. Also people
|
1692
|
+
# should never directly access this constant so I'm not happy about
|
1693
|
+
# setting it.
|
1694
|
+
const_set join_model.name, join_model
|
1695
|
+
|
1696
|
+
middle_reflection = builder.middle_reflection join_model
|
1697
|
+
|
1698
|
+
Builder::HasMany.define_callbacks self, middle_reflection
|
1699
|
+
Reflection.add_reflection self, middle_reflection.name, middle_reflection
|
1700
|
+
middle_reflection.parent_reflection = [name.to_s, habtm_reflection]
|
1701
|
+
|
1702
|
+
include Module.new {
|
1703
|
+
class_eval <<-RUBY, __FILE__, __LINE__ + 1
|
1704
|
+
def destroy_associations
|
1705
|
+
association(:#{middle_reflection.name}).delete_all(:delete_all)
|
1706
|
+
association(:#{name}).reset
|
1707
|
+
super
|
1708
|
+
end
|
1709
|
+
RUBY
|
1710
|
+
}
|
1711
|
+
|
1712
|
+
hm_options = {}
|
1713
|
+
hm_options[:through] = middle_reflection.name
|
1714
|
+
hm_options[:source] = join_model.right_reflection.name
|
1715
|
+
|
1716
|
+
[:before_add, :after_add, :before_remove, :after_remove, :autosave, :validate, :join_table, :class_name].each do |k|
|
1717
|
+
hm_options[k] = options[k] if options.key? k
|
1718
|
+
end
|
1719
|
+
|
1720
|
+
has_many name, scope, hm_options, &extension
|
1721
|
+
self._reflections[name.to_s].parent_reflection = [name.to_s, habtm_reflection]
|
1722
|
+
end
|
1723
|
+
end
|
1724
|
+
end
|
1725
|
+
end
|