jets 1.4.11 → 1.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitmodules +3 -0
- data/CHANGELOG.md +4 -0
- data/Gemfile.lock +6 -5
- data/jets.gemspec +3 -2
- data/lib/jets.rb +8 -2
- data/lib/jets/builders/tidy.rb +2 -1
- data/lib/jets/commands/db.rb +3 -3
- data/lib/jets/commands/db/tasks.rb +5 -4
- data/lib/jets/generator.rb +3 -2
- data/lib/jets/router.rb +29 -4
- data/lib/jets/router/scope.rb +30 -0
- data/lib/jets/version.rb +1 -1
- data/vendor/rails/Brewfile +13 -0
- data/vendor/rails/CODE_OF_CONDUCT.md +12 -0
- data/vendor/rails/CONTRIBUTING.md +49 -0
- data/vendor/rails/Gemfile +174 -0
- data/vendor/rails/Gemfile.lock +564 -0
- data/vendor/rails/MIT-LICENSE +20 -0
- data/vendor/rails/RAILS_VERSION +1 -0
- data/vendor/rails/README.md +97 -0
- data/vendor/rails/RELEASING_RAILS.md +225 -0
- data/vendor/rails/Rakefile +72 -0
- data/vendor/rails/actionpack/CHANGELOG.md +407 -0
- data/vendor/rails/actionpack/MIT-LICENSE +21 -0
- data/vendor/rails/actionpack/README.rdoc +57 -0
- data/vendor/rails/actionpack/Rakefile +40 -0
- data/vendor/rails/actionpack/actionpack.gemspec +38 -0
- data/vendor/rails/actionpack/bin/test +5 -0
- data/vendor/rails/actionpack/lib/abstract_controller.rb +27 -0
- data/vendor/rails/actionpack/lib/abstract_controller/asset_paths.rb +12 -0
- data/vendor/rails/actionpack/lib/abstract_controller/base.rb +265 -0
- data/vendor/rails/actionpack/lib/abstract_controller/caching.rb +66 -0
- data/vendor/rails/actionpack/lib/abstract_controller/caching/fragments.rb +166 -0
- data/vendor/rails/actionpack/lib/abstract_controller/callbacks.rb +212 -0
- data/vendor/rails/actionpack/lib/abstract_controller/collector.rb +43 -0
- data/vendor/rails/actionpack/lib/abstract_controller/error.rb +6 -0
- data/vendor/rails/actionpack/lib/abstract_controller/helpers.rb +194 -0
- data/vendor/rails/actionpack/lib/abstract_controller/logger.rb +14 -0
- data/vendor/rails/actionpack/lib/abstract_controller/railties/routes_helpers.rb +20 -0
- data/vendor/rails/actionpack/lib/abstract_controller/rendering.rb +127 -0
- data/vendor/rails/actionpack/lib/abstract_controller/translation.rb +31 -0
- data/vendor/rails/actionpack/lib/abstract_controller/url_for.rb +35 -0
- data/vendor/rails/actionpack/lib/action_controller.rb +66 -0
- data/vendor/rails/actionpack/lib/action_controller/api.rb +149 -0
- data/vendor/rails/actionpack/lib/action_controller/api/api_rendering.rb +16 -0
- data/vendor/rails/actionpack/lib/action_controller/base.rb +276 -0
- data/vendor/rails/actionpack/lib/action_controller/caching.rb +46 -0
- data/vendor/rails/actionpack/lib/action_controller/form_builder.rb +50 -0
- data/vendor/rails/actionpack/lib/action_controller/log_subscriber.rb +78 -0
- data/vendor/rails/actionpack/lib/action_controller/metal.rb +256 -0
- data/vendor/rails/actionpack/lib/action_controller/metal/basic_implicit_render.rb +13 -0
- data/vendor/rails/actionpack/lib/action_controller/metal/conditional_get.rb +274 -0
- data/vendor/rails/actionpack/lib/action_controller/metal/content_security_policy.rb +52 -0
- data/vendor/rails/actionpack/lib/action_controller/metal/cookies.rb +16 -0
- data/vendor/rails/actionpack/lib/action_controller/metal/data_streaming.rb +152 -0
- data/vendor/rails/actionpack/lib/action_controller/metal/etag_with_flash.rb +18 -0
- data/vendor/rails/actionpack/lib/action_controller/metal/etag_with_template_digest.rb +57 -0
- data/vendor/rails/actionpack/lib/action_controller/metal/exceptions.rb +53 -0
- data/vendor/rails/actionpack/lib/action_controller/metal/flash.rb +61 -0
- data/vendor/rails/actionpack/lib/action_controller/metal/force_ssl.rb +99 -0
- data/vendor/rails/actionpack/lib/action_controller/metal/head.rb +60 -0
- data/vendor/rails/actionpack/lib/action_controller/metal/helpers.rb +123 -0
- data/vendor/rails/actionpack/lib/action_controller/metal/http_authentication.rb +519 -0
- data/vendor/rails/actionpack/lib/action_controller/metal/implicit_render.rb +73 -0
- data/vendor/rails/actionpack/lib/action_controller/metal/instrumentation.rb +107 -0
- data/vendor/rails/actionpack/lib/action_controller/metal/live.rb +312 -0
- data/vendor/rails/actionpack/lib/action_controller/metal/mime_responds.rb +313 -0
- data/vendor/rails/actionpack/lib/action_controller/metal/parameter_encoding.rb +51 -0
- data/vendor/rails/actionpack/lib/action_controller/metal/params_wrapper.rb +293 -0
- data/vendor/rails/actionpack/lib/action_controller/metal/redirecting.rb +133 -0
- data/vendor/rails/actionpack/lib/action_controller/metal/renderers.rb +181 -0
- data/vendor/rails/actionpack/lib/action_controller/metal/rendering.rb +122 -0
- data/vendor/rails/actionpack/lib/action_controller/metal/request_forgery_protection.rb +445 -0
- data/vendor/rails/actionpack/lib/action_controller/metal/rescue.rb +28 -0
- data/vendor/rails/actionpack/lib/action_controller/metal/streaming.rb +223 -0
- data/vendor/rails/actionpack/lib/action_controller/metal/strong_parameters.rb +1086 -0
- data/vendor/rails/actionpack/lib/action_controller/metal/testing.rb +16 -0
- data/vendor/rails/actionpack/lib/action_controller/metal/url_for.rb +58 -0
- data/vendor/rails/actionpack/lib/action_controller/railtie.rb +89 -0
- data/vendor/rails/actionpack/lib/action_controller/railties/helpers.rb +24 -0
- data/vendor/rails/actionpack/lib/action_controller/renderer.rb +117 -0
- data/vendor/rails/actionpack/lib/action_controller/template_assertions.rb +11 -0
- data/vendor/rails/actionpack/lib/action_controller/test_case.rb +629 -0
- data/vendor/rails/actionpack/lib/action_dispatch.rb +112 -0
- data/vendor/rails/actionpack/lib/action_dispatch/http/cache.rb +220 -0
- data/vendor/rails/actionpack/lib/action_dispatch/http/content_security_policy.rb +272 -0
- data/vendor/rails/actionpack/lib/action_dispatch/http/filter_parameters.rb +84 -0
- data/vendor/rails/actionpack/lib/action_dispatch/http/filter_redirect.rb +37 -0
- data/vendor/rails/actionpack/lib/action_dispatch/http/headers.rb +132 -0
- data/vendor/rails/actionpack/lib/action_dispatch/http/mime_negotiation.rb +170 -0
- data/vendor/rails/actionpack/lib/action_dispatch/http/mime_type.rb +342 -0
- data/vendor/rails/actionpack/lib/action_dispatch/http/mime_types.rb +50 -0
- data/vendor/rails/actionpack/lib/action_dispatch/http/parameter_filter.rb +86 -0
- data/vendor/rails/actionpack/lib/action_dispatch/http/parameters.rb +126 -0
- data/vendor/rails/actionpack/lib/action_dispatch/http/rack_cache.rb +63 -0
- data/vendor/rails/actionpack/lib/action_dispatch/http/request.rb +430 -0
- data/vendor/rails/actionpack/lib/action_dispatch/http/response.rb +520 -0
- data/vendor/rails/actionpack/lib/action_dispatch/http/upload.rb +84 -0
- data/vendor/rails/actionpack/lib/action_dispatch/http/url.rb +350 -0
- data/vendor/rails/actionpack/lib/action_dispatch/journey.rb +7 -0
- data/vendor/rails/actionpack/lib/action_dispatch/journey/formatter.rb +189 -0
- data/vendor/rails/actionpack/lib/action_dispatch/journey/gtg/builder.rb +164 -0
- data/vendor/rails/actionpack/lib/action_dispatch/journey/gtg/simulator.rb +41 -0
- data/vendor/rails/actionpack/lib/action_dispatch/journey/gtg/transition_table.rb +158 -0
- data/vendor/rails/actionpack/lib/action_dispatch/journey/nfa/builder.rb +78 -0
- data/vendor/rails/actionpack/lib/action_dispatch/journey/nfa/dot.rb +36 -0
- data/vendor/rails/actionpack/lib/action_dispatch/journey/nfa/simulator.rb +49 -0
- data/vendor/rails/actionpack/lib/action_dispatch/journey/nfa/transition_table.rb +120 -0
- data/vendor/rails/actionpack/lib/action_dispatch/journey/nodes/node.rb +140 -0
- data/vendor/rails/actionpack/lib/action_dispatch/journey/parser.rb +199 -0
- data/vendor/rails/actionpack/lib/action_dispatch/journey/parser.y +50 -0
- data/vendor/rails/actionpack/lib/action_dispatch/journey/parser_extras.rb +31 -0
- data/vendor/rails/actionpack/lib/action_dispatch/journey/path/pattern.rb +198 -0
- data/vendor/rails/actionpack/lib/action_dispatch/journey/route.rb +203 -0
- data/vendor/rails/actionpack/lib/action_dispatch/journey/router.rb +156 -0
- data/vendor/rails/actionpack/lib/action_dispatch/journey/router/utils.rb +102 -0
- data/vendor/rails/actionpack/lib/action_dispatch/journey/routes.rb +82 -0
- data/vendor/rails/actionpack/lib/action_dispatch/journey/scanner.rb +64 -0
- data/vendor/rails/actionpack/lib/action_dispatch/journey/visitors.rb +268 -0
- data/vendor/rails/actionpack/lib/action_dispatch/journey/visualizer/fsm.css +30 -0
- data/vendor/rails/actionpack/lib/action_dispatch/journey/visualizer/fsm.js +134 -0
- data/vendor/rails/actionpack/lib/action_dispatch/journey/visualizer/index.html.erb +52 -0
- data/vendor/rails/actionpack/lib/action_dispatch/middleware/callbacks.rb +36 -0
- data/vendor/rails/actionpack/lib/action_dispatch/middleware/cookies.rb +685 -0
- data/vendor/rails/actionpack/lib/action_dispatch/middleware/debug_exceptions.rb +205 -0
- data/vendor/rails/actionpack/lib/action_dispatch/middleware/debug_locks.rb +124 -0
- data/vendor/rails/actionpack/lib/action_dispatch/middleware/exception_wrapper.rb +147 -0
- data/vendor/rails/actionpack/lib/action_dispatch/middleware/executor.rb +21 -0
- data/vendor/rails/actionpack/lib/action_dispatch/middleware/flash.rb +300 -0
- data/vendor/rails/actionpack/lib/action_dispatch/middleware/public_exceptions.rb +57 -0
- data/vendor/rails/actionpack/lib/action_dispatch/middleware/reloader.rb +12 -0
- data/vendor/rails/actionpack/lib/action_dispatch/middleware/remote_ip.rb +183 -0
- data/vendor/rails/actionpack/lib/action_dispatch/middleware/request_id.rb +43 -0
- data/vendor/rails/actionpack/lib/action_dispatch/middleware/session/abstract_store.rb +92 -0
- data/vendor/rails/actionpack/lib/action_dispatch/middleware/session/cache_store.rb +54 -0
- data/vendor/rails/actionpack/lib/action_dispatch/middleware/session/cookie_store.rb +117 -0
- data/vendor/rails/actionpack/lib/action_dispatch/middleware/session/mem_cache_store.rb +28 -0
- data/vendor/rails/actionpack/lib/action_dispatch/middleware/show_exceptions.rb +62 -0
- data/vendor/rails/actionpack/lib/action_dispatch/middleware/ssl.rb +150 -0
- data/vendor/rails/actionpack/lib/action_dispatch/middleware/stack.rb +116 -0
- data/vendor/rails/actionpack/lib/action_dispatch/middleware/static.rb +130 -0
- data/vendor/rails/actionpack/lib/action_dispatch/middleware/templates/rescues/_request_and_response.html.erb +22 -0
- data/vendor/rails/actionpack/lib/action_dispatch/middleware/templates/rescues/_request_and_response.text.erb +23 -0
- data/vendor/rails/actionpack/lib/action_dispatch/middleware/templates/rescues/_source.html.erb +27 -0
- data/vendor/rails/actionpack/lib/action_dispatch/middleware/templates/rescues/_source.text.erb +8 -0
- data/vendor/rails/actionpack/lib/action_dispatch/middleware/templates/rescues/_trace.html.erb +52 -0
- data/vendor/rails/actionpack/lib/action_dispatch/middleware/templates/rescues/_trace.text.erb +9 -0
- data/vendor/rails/actionpack/lib/action_dispatch/middleware/templates/rescues/diagnostics.html.erb +16 -0
- data/vendor/rails/actionpack/lib/action_dispatch/middleware/templates/rescues/diagnostics.text.erb +9 -0
- data/vendor/rails/actionpack/lib/action_dispatch/middleware/templates/rescues/invalid_statement.html.erb +21 -0
- data/vendor/rails/actionpack/lib/action_dispatch/middleware/templates/rescues/invalid_statement.text.erb +13 -0
- data/vendor/rails/actionpack/lib/action_dispatch/middleware/templates/rescues/layout.erb +161 -0
- data/vendor/rails/actionpack/lib/action_dispatch/middleware/templates/rescues/missing_template.html.erb +11 -0
- data/vendor/rails/actionpack/lib/action_dispatch/middleware/templates/rescues/missing_template.text.erb +3 -0
- data/vendor/rails/actionpack/lib/action_dispatch/middleware/templates/rescues/routing_error.html.erb +32 -0
- data/vendor/rails/actionpack/lib/action_dispatch/middleware/templates/rescues/routing_error.text.erb +11 -0
- data/vendor/rails/actionpack/lib/action_dispatch/middleware/templates/rescues/template_error.html.erb +20 -0
- data/vendor/rails/actionpack/lib/action_dispatch/middleware/templates/rescues/template_error.text.erb +7 -0
- data/vendor/rails/actionpack/lib/action_dispatch/middleware/templates/rescues/unknown_action.html.erb +6 -0
- data/vendor/rails/actionpack/lib/action_dispatch/middleware/templates/rescues/unknown_action.text.erb +3 -0
- data/vendor/rails/actionpack/lib/action_dispatch/middleware/templates/routes/_route.html.erb +16 -0
- data/vendor/rails/actionpack/lib/action_dispatch/middleware/templates/routes/_table.html.erb +200 -0
- data/vendor/rails/actionpack/lib/action_dispatch/railtie.rb +55 -0
- data/vendor/rails/actionpack/lib/action_dispatch/request/session.rb +234 -0
- data/vendor/rails/actionpack/lib/action_dispatch/request/utils.rb +78 -0
- data/vendor/rails/actionpack/lib/action_dispatch/routing.rb +260 -0
- data/vendor/rails/actionpack/lib/action_dispatch/routing/endpoint.rb +17 -0
- data/vendor/rails/actionpack/lib/action_dispatch/routing/inspector.rb +225 -0
- data/vendor/rails/actionpack/lib/action_dispatch/routing/mapper.rb +2267 -0
- data/vendor/rails/actionpack/lib/action_dispatch/routing/polymorphic_routes.rb +352 -0
- data/vendor/rails/actionpack/lib/action_dispatch/routing/redirection.rb +201 -0
- data/vendor/rails/actionpack/lib/action_dispatch/routing/route_set.rb +890 -0
- data/vendor/rails/actionpack/lib/action_dispatch/routing/routes_proxy.rb +69 -0
- data/vendor/rails/actionpack/lib/action_dispatch/routing/url_for.rb +236 -0
- data/vendor/rails/actionpack/lib/action_dispatch/system_test_case.rb +147 -0
- data/vendor/rails/actionpack/lib/action_dispatch/system_testing/browser.rb +49 -0
- data/vendor/rails/actionpack/lib/action_dispatch/system_testing/driver.rb +59 -0
- data/vendor/rails/actionpack/lib/action_dispatch/system_testing/server.rb +31 -0
- data/vendor/rails/actionpack/lib/action_dispatch/system_testing/test_helpers/screenshot_helper.rb +96 -0
- data/vendor/rails/actionpack/lib/action_dispatch/system_testing/test_helpers/setup_and_teardown.rb +31 -0
- data/vendor/rails/actionpack/lib/action_dispatch/system_testing/test_helpers/undef_methods.rb +26 -0
- data/vendor/rails/actionpack/lib/action_dispatch/testing/assertion_response.rb +47 -0
- data/vendor/rails/actionpack/lib/action_dispatch/testing/assertions.rb +24 -0
- data/vendor/rails/actionpack/lib/action_dispatch/testing/assertions/response.rb +107 -0
- data/vendor/rails/actionpack/lib/action_dispatch/testing/assertions/routing.rb +222 -0
- data/vendor/rails/actionpack/lib/action_dispatch/testing/integration.rb +652 -0
- data/vendor/rails/actionpack/lib/action_dispatch/testing/request_encoder.rb +55 -0
- data/vendor/rails/actionpack/lib/action_dispatch/testing/test_process.rb +50 -0
- data/vendor/rails/actionpack/lib/action_dispatch/testing/test_request.rb +71 -0
- data/vendor/rails/actionpack/lib/action_dispatch/testing/test_response.rb +53 -0
- data/vendor/rails/actionpack/lib/action_pack.rb +26 -0
- data/vendor/rails/actionpack/lib/action_pack/gem_version.rb +17 -0
- data/vendor/rails/actionpack/lib/action_pack/version.rb +10 -0
- data/vendor/rails/actionpack/test/abstract/callbacks_test.rb +270 -0
- data/vendor/rails/actionpack/test/abstract/collector_test.rb +65 -0
- data/vendor/rails/actionpack/test/abstract/translation_test.rb +79 -0
- data/vendor/rails/actionpack/test/abstract_unit.rb +457 -0
- data/vendor/rails/actionpack/test/assertions/response_assertions_test.rb +141 -0
- data/vendor/rails/actionpack/test/controller/action_pack_assertions_test.rb +493 -0
- data/vendor/rails/actionpack/test/controller/api/conditional_get_test.rb +59 -0
- data/vendor/rails/actionpack/test/controller/api/data_streaming_test.rb +28 -0
- data/vendor/rails/actionpack/test/controller/api/force_ssl_test.rb +22 -0
- data/vendor/rails/actionpack/test/controller/api/implicit_render_test.rb +17 -0
- data/vendor/rails/actionpack/test/controller/api/params_wrapper_test.rb +28 -0
- data/vendor/rails/actionpack/test/controller/api/redirect_to_test.rb +21 -0
- data/vendor/rails/actionpack/test/controller/api/renderers_test.rb +50 -0
- data/vendor/rails/actionpack/test/controller/api/url_for_test.rb +22 -0
- data/vendor/rails/actionpack/test/controller/api/with_cookies_test.rb +23 -0
- data/vendor/rails/actionpack/test/controller/api/with_helpers_test.rb +44 -0
- data/vendor/rails/actionpack/test/controller/base_test.rb +323 -0
- data/vendor/rails/actionpack/test/controller/caching_test.rb +511 -0
- data/vendor/rails/actionpack/test/controller/content_type_test.rb +169 -0
- data/vendor/rails/actionpack/test/controller/controller_fixtures/app/controllers/admin/user_controller.rb +0 -0
- data/vendor/rails/actionpack/test/controller/controller_fixtures/app/controllers/user_controller.rb +0 -0
- data/vendor/rails/actionpack/test/controller/controller_fixtures/vendor/plugins/bad_plugin/lib/plugin_controller.rb +0 -0
- data/vendor/rails/actionpack/test/controller/default_url_options_with_before_action_test.rb +28 -0
- data/vendor/rails/actionpack/test/controller/filters_test.rb +1050 -0
- data/vendor/rails/actionpack/test/controller/flash_hash_test.rb +216 -0
- data/vendor/rails/actionpack/test/controller/flash_test.rb +373 -0
- data/vendor/rails/actionpack/test/controller/force_ssl_test.rb +333 -0
- data/vendor/rails/actionpack/test/controller/form_builder_test.rb +19 -0
- data/vendor/rails/actionpack/test/controller/helper_test.rb +295 -0
- data/vendor/rails/actionpack/test/controller/http_basic_authentication_test.rb +179 -0
- data/vendor/rails/actionpack/test/controller/http_digest_authentication_test.rb +282 -0
- data/vendor/rails/actionpack/test/controller/http_token_authentication_test.rb +216 -0
- data/vendor/rails/actionpack/test/controller/integration_test.rb +1136 -0
- data/vendor/rails/actionpack/test/controller/live_stream_test.rb +518 -0
- data/vendor/rails/actionpack/test/controller/localized_templates_test.rb +48 -0
- data/vendor/rails/actionpack/test/controller/log_subscriber_test.rb +371 -0
- data/vendor/rails/actionpack/test/controller/metal/renderers_test.rb +50 -0
- data/vendor/rails/actionpack/test/controller/metal_test.rb +32 -0
- data/vendor/rails/actionpack/test/controller/mime/accept_format_test.rb +94 -0
- data/vendor/rails/actionpack/test/controller/mime/respond_to_test.rb +843 -0
- data/vendor/rails/actionpack/test/controller/new_base/bare_metal_test.rb +184 -0
- data/vendor/rails/actionpack/test/controller/new_base/base_test.rb +131 -0
- data/vendor/rails/actionpack/test/controller/new_base/content_negotiation_test.rb +28 -0
- data/vendor/rails/actionpack/test/controller/new_base/content_type_test.rb +116 -0
- data/vendor/rails/actionpack/test/controller/new_base/middleware_test.rb +112 -0
- data/vendor/rails/actionpack/test/controller/new_base/render_action_test.rb +314 -0
- data/vendor/rails/actionpack/test/controller/new_base/render_body_test.rb +172 -0
- data/vendor/rails/actionpack/test/controller/new_base/render_context_test.rb +54 -0
- data/vendor/rails/actionpack/test/controller/new_base/render_file_test.rb +72 -0
- data/vendor/rails/actionpack/test/controller/new_base/render_html_test.rb +192 -0
- data/vendor/rails/actionpack/test/controller/new_base/render_implicit_action_test.rb +59 -0
- data/vendor/rails/actionpack/test/controller/new_base/render_layout_test.rb +128 -0
- data/vendor/rails/actionpack/test/controller/new_base/render_partial_test.rb +62 -0
- data/vendor/rails/actionpack/test/controller/new_base/render_plain_test.rb +170 -0
- data/vendor/rails/actionpack/test/controller/new_base/render_streaming_test.rb +116 -0
- data/vendor/rails/actionpack/test/controller/new_base/render_template_test.rb +240 -0
- data/vendor/rails/actionpack/test/controller/new_base/render_test.rb +142 -0
- data/vendor/rails/actionpack/test/controller/new_base/render_xml_test.rb +12 -0
- data/vendor/rails/actionpack/test/controller/output_escaping_test.rb +17 -0
- data/vendor/rails/actionpack/test/controller/parameter_encoding_test.rb +52 -0
- data/vendor/rails/actionpack/test/controller/parameters/accessors_test.rb +324 -0
- data/vendor/rails/actionpack/test/controller/parameters/always_permitted_parameters_test.rb +30 -0
- data/vendor/rails/actionpack/test/controller/parameters/dup_test.rb +67 -0
- data/vendor/rails/actionpack/test/controller/parameters/log_on_unpermitted_params_test.rb +70 -0
- data/vendor/rails/actionpack/test/controller/parameters/multi_parameter_attributes_test.rb +39 -0
- data/vendor/rails/actionpack/test/controller/parameters/mutators_test.rb +122 -0
- data/vendor/rails/actionpack/test/controller/parameters/nested_parameters_permit_test.rb +184 -0
- data/vendor/rails/actionpack/test/controller/parameters/parameters_permit_test.rb +516 -0
- data/vendor/rails/actionpack/test/controller/parameters/raise_on_unpermitted_params_test.rb +33 -0
- data/vendor/rails/actionpack/test/controller/parameters/serialization_test.rb +55 -0
- data/vendor/rails/actionpack/test/controller/params_wrapper_test.rb +422 -0
- data/vendor/rails/actionpack/test/controller/permitted_params_test.rb +27 -0
- data/vendor/rails/actionpack/test/controller/redirect_test.rb +395 -0
- data/vendor/rails/actionpack/test/controller/render_js_test.rb +36 -0
- data/vendor/rails/actionpack/test/controller/render_json_test.rb +137 -0
- data/vendor/rails/actionpack/test/controller/render_test.rb +843 -0
- data/vendor/rails/actionpack/test/controller/render_xml_test.rb +102 -0
- data/vendor/rails/actionpack/test/controller/renderer_test.rb +136 -0
- data/vendor/rails/actionpack/test/controller/renderers_test.rb +91 -0
- data/vendor/rails/actionpack/test/controller/request/test_request_test.rb +42 -0
- data/vendor/rails/actionpack/test/controller/request_forgery_protection_test.rb +1013 -0
- data/vendor/rails/actionpack/test/controller/required_params_test.rb +100 -0
- data/vendor/rails/actionpack/test/controller/rescue_test.rb +364 -0
- data/vendor/rails/actionpack/test/controller/resources_test.rb +1369 -0
- data/vendor/rails/actionpack/test/controller/routing_test.rb +2108 -0
- data/vendor/rails/actionpack/test/controller/runner_test.rb +24 -0
- data/vendor/rails/actionpack/test/controller/send_file_test.rb +259 -0
- data/vendor/rails/actionpack/test/controller/show_exceptions_test.rb +114 -0
- data/vendor/rails/actionpack/test/controller/streaming_test.rb +28 -0
- data/vendor/rails/actionpack/test/controller/test_case_test.rb +1157 -0
- data/vendor/rails/actionpack/test/controller/url_for_integration_test.rb +192 -0
- data/vendor/rails/actionpack/test/controller/url_for_test.rb +519 -0
- data/vendor/rails/actionpack/test/controller/url_rewriter_test.rb +92 -0
- data/vendor/rails/actionpack/test/controller/webservice_test.rb +135 -0
- data/vendor/rails/actionpack/test/dispatch/callbacks_test.rb +47 -0
- data/vendor/rails/actionpack/test/dispatch/content_security_policy_test.rb +525 -0
- data/vendor/rails/actionpack/test/dispatch/cookies_test.rb +1345 -0
- data/vendor/rails/actionpack/test/dispatch/debug_exceptions_test.rb +502 -0
- data/vendor/rails/actionpack/test/dispatch/debug_locks_test.rb +38 -0
- data/vendor/rails/actionpack/test/dispatch/exception_wrapper_test.rb +120 -0
- data/vendor/rails/actionpack/test/dispatch/executor_test.rb +136 -0
- data/vendor/rails/actionpack/test/dispatch/header_test.rb +169 -0
- data/vendor/rails/actionpack/test/dispatch/live_response_test.rb +98 -0
- data/vendor/rails/actionpack/test/dispatch/mapper_test.rb +210 -0
- data/vendor/rails/actionpack/test/dispatch/middleware_stack_test.rb +115 -0
- data/vendor/rails/actionpack/test/dispatch/mime_type_test.rb +187 -0
- data/vendor/rails/actionpack/test/dispatch/mount_test.rb +95 -0
- data/vendor/rails/actionpack/test/dispatch/prefix_generation_test.rb +463 -0
- data/vendor/rails/actionpack/test/dispatch/rack_cache_test.rb +23 -0
- data/vendor/rails/actionpack/test/dispatch/reloader_test.rb +167 -0
- data/vendor/rails/actionpack/test/dispatch/request/json_params_parsing_test.rb +207 -0
- data/vendor/rails/actionpack/test/dispatch/request/multipart_params_parsing_test.rb +202 -0
- data/vendor/rails/actionpack/test/dispatch/request/query_string_parsing_test.rb +176 -0
- data/vendor/rails/actionpack/test/dispatch/request/session_test.rb +165 -0
- data/vendor/rails/actionpack/test/dispatch/request/url_encoded_params_parsing_test.rb +181 -0
- data/vendor/rails/actionpack/test/dispatch/request_id_test.rb +75 -0
- data/vendor/rails/actionpack/test/dispatch/request_test.rb +1307 -0
- data/vendor/rails/actionpack/test/dispatch/response_test.rb +542 -0
- data/vendor/rails/actionpack/test/dispatch/routing/concerns_test.rb +124 -0
- data/vendor/rails/actionpack/test/dispatch/routing/custom_url_helpers_test.rb +333 -0
- data/vendor/rails/actionpack/test/dispatch/routing/inspector_test.rb +425 -0
- data/vendor/rails/actionpack/test/dispatch/routing/ipv6_redirect_test.rb +46 -0
- data/vendor/rails/actionpack/test/dispatch/routing/route_set_test.rb +166 -0
- data/vendor/rails/actionpack/test/dispatch/routing_assertions_test.rb +209 -0
- data/vendor/rails/actionpack/test/dispatch/routing_test.rb +5112 -0
- data/vendor/rails/actionpack/test/dispatch/runner_test.rb +19 -0
- data/vendor/rails/actionpack/test/dispatch/session/abstract_store_test.rb +58 -0
- data/vendor/rails/actionpack/test/dispatch/session/cache_store_test.rb +183 -0
- data/vendor/rails/actionpack/test/dispatch/session/cookie_store_test.rb +417 -0
- data/vendor/rails/actionpack/test/dispatch/session/mem_cache_store_test.rb +205 -0
- data/vendor/rails/actionpack/test/dispatch/session/test_session_test.rb +65 -0
- data/vendor/rails/actionpack/test/dispatch/show_exceptions_test.rb +138 -0
- data/vendor/rails/actionpack/test/dispatch/ssl_test.rb +228 -0
- data/vendor/rails/actionpack/test/dispatch/static_test.rb +318 -0
- data/vendor/rails/actionpack/test/dispatch/system_testing/driver_test.rb +54 -0
- data/vendor/rails/actionpack/test/dispatch/system_testing/screenshot_helper_test.rb +81 -0
- data/vendor/rails/actionpack/test/dispatch/system_testing/server_test.rb +32 -0
- data/vendor/rails/actionpack/test/dispatch/system_testing/system_test_case_test.rb +84 -0
- data/vendor/rails/actionpack/test/dispatch/test_request_test.rb +131 -0
- data/vendor/rails/actionpack/test/dispatch/test_response_test.rb +37 -0
- data/vendor/rails/actionpack/test/dispatch/uploaded_file_test.rb +113 -0
- data/vendor/rails/actionpack/test/dispatch/url_generation_test.rb +141 -0
- data/vendor/rails/actionpack/test/fixtures/_top_level_partial_only.erb +1 -0
- data/vendor/rails/actionpack/test/fixtures/alternate_helpers/foo_helper.rb +5 -0
- data/vendor/rails/actionpack/test/fixtures/bad_customers/_bad_customer.html.erb +1 -0
- data/vendor/rails/actionpack/test/fixtures/collection_cache/index.html.erb +1 -0
- data/vendor/rails/actionpack/test/fixtures/company.rb +11 -0
- data/vendor/rails/actionpack/test/fixtures/customers/_commented_customer.html.erb +5 -0
- data/vendor/rails/actionpack/test/fixtures/customers/_customer.html.erb +4 -0
- data/vendor/rails/actionpack/test/fixtures/filter_test/implicit_actions/edit.html.erb +1 -0
- data/vendor/rails/actionpack/test/fixtures/filter_test/implicit_actions/show.html.erb +1 -0
- data/vendor/rails/actionpack/test/fixtures/functional_caching/_formatted_partial.html.erb +1 -0
- data/vendor/rails/actionpack/test/fixtures/functional_caching/_partial.erb +3 -0
- data/vendor/rails/actionpack/test/fixtures/functional_caching/formatted_fragment_cached.html.erb +3 -0
- data/vendor/rails/actionpack/test/fixtures/functional_caching/formatted_fragment_cached.xml.builder +5 -0
- data/vendor/rails/actionpack/test/fixtures/functional_caching/formatted_fragment_cached_with_variant.html+phone.erb +3 -0
- data/vendor/rails/actionpack/test/fixtures/functional_caching/fragment_cached.html.erb +3 -0
- data/vendor/rails/actionpack/test/fixtures/functional_caching/fragment_cached_with_options.html.erb +3 -0
- data/vendor/rails/actionpack/test/fixtures/functional_caching/fragment_cached_without_digest.html.erb +3 -0
- data/vendor/rails/actionpack/test/fixtures/functional_caching/html_fragment_cached_with_partial.html.erb +1 -0
- data/vendor/rails/actionpack/test/fixtures/functional_caching/inline_fragment_cached.html.erb +2 -0
- data/vendor/rails/actionpack/test/fixtures/functional_caching/xml_fragment_cached_with_html_partial.xml.builder +5 -0
- data/vendor/rails/actionpack/test/fixtures/helpers/abc_helper.rb +5 -0
- data/vendor/rails/actionpack/test/fixtures/helpers/fun/games_helper.rb +7 -0
- data/vendor/rails/actionpack/test/fixtures/helpers/fun/pdf_helper.rb +7 -0
- data/vendor/rails/actionpack/test/fixtures/helpers/just_me_helper.rb +5 -0
- data/vendor/rails/actionpack/test/fixtures/helpers/me_too_helper.rb +5 -0
- data/vendor/rails/actionpack/test/fixtures/helpers1_pack/pack1_helper.rb +7 -0
- data/vendor/rails/actionpack/test/fixtures/helpers2_pack/pack2_helper.rb +7 -0
- data/vendor/rails/actionpack/test/fixtures/helpers_typo/admin/users_helper.rb +6 -0
- data/vendor/rails/actionpack/test/fixtures/implicit_render_test/empty_action_with_mobile_variant.html+mobile.erb +1 -0
- data/vendor/rails/actionpack/test/fixtures/implicit_render_test/empty_action_with_template.html.erb +1 -0
- data/vendor/rails/actionpack/test/fixtures/layouts/_customers.erb +1 -0
- data/vendor/rails/actionpack/test/fixtures/layouts/block_with_layout.erb +3 -0
- data/vendor/rails/actionpack/test/fixtures/layouts/builder.builder +3 -0
- data/vendor/rails/actionpack/test/fixtures/layouts/partial_with_layout.erb +3 -0
- data/vendor/rails/actionpack/test/fixtures/layouts/standard.html.erb +1 -0
- data/vendor/rails/actionpack/test/fixtures/layouts/talk_from_action.erb +2 -0
- data/vendor/rails/actionpack/test/fixtures/layouts/with_html_partial.html.erb +1 -0
- data/vendor/rails/actionpack/test/fixtures/layouts/xhr.html.erb +2 -0
- data/vendor/rails/actionpack/test/fixtures/layouts/yield.erb +2 -0
- data/vendor/rails/actionpack/test/fixtures/load_me.rb +4 -0
- data/vendor/rails/actionpack/test/fixtures/localized/hello_world.de.html +1 -0
- data/vendor/rails/actionpack/test/fixtures/localized/hello_world.en.html +1 -0
- data/vendor/rails/actionpack/test/fixtures/localized/hello_world.it.erb +1 -0
- data/vendor/rails/actionpack/test/fixtures/multipart/binary_file +0 -0
- data/vendor/rails/actionpack/test/fixtures/multipart/boundary_problem_file +10 -0
- data/vendor/rails/actionpack/test/fixtures/multipart/bracketed_param +5 -0
- data/vendor/rails/actionpack/test/fixtures/multipart/bracketed_utf8_param +5 -0
- data/vendor/rails/actionpack/test/fixtures/multipart/empty +10 -0
- data/vendor/rails/actionpack/test/fixtures/multipart/hello.txt +1 -0
- data/vendor/rails/actionpack/test/fixtures/multipart/large_text_file +10 -0
- data/vendor/rails/actionpack/test/fixtures/multipart/mixed_files +0 -0
- data/vendor/rails/actionpack/test/fixtures/multipart/none +9 -0
- data/vendor/rails/actionpack/test/fixtures/multipart/ruby_on_rails.jpg +0 -0
- data/vendor/rails/actionpack/test/fixtures/multipart/single_parameter +5 -0
- data/vendor/rails/actionpack/test/fixtures/multipart/single_utf8_param +5 -0
- data/vendor/rails/actionpack/test/fixtures/multipart/text_file +10 -0
- data/vendor/rails/actionpack/test/fixtures/multipart/utf8_filename +10 -0
- data/vendor/rails/actionpack/test/fixtures/namespaced/implicit_render_test/hello_world.erb +1 -0
- data/vendor/rails/actionpack/test/fixtures/old_content_type/render_default_content_types_for_respond_to.xml.erb +1 -0
- data/vendor/rails/actionpack/test/fixtures/old_content_type/render_default_for_builder.builder +1 -0
- data/vendor/rails/actionpack/test/fixtures/old_content_type/render_default_for_erb.erb +1 -0
- data/vendor/rails/actionpack/test/fixtures/post_test/layouts/post.html.erb +1 -0
- data/vendor/rails/actionpack/test/fixtures/post_test/layouts/super_post.iphone.erb +1 -0
- data/vendor/rails/actionpack/test/fixtures/post_test/post/index.html.erb +1 -0
- data/vendor/rails/actionpack/test/fixtures/post_test/post/index.iphone.erb +1 -0
- data/vendor/rails/actionpack/test/fixtures/post_test/super_post/index.html.erb +1 -0
- data/vendor/rails/actionpack/test/fixtures/post_test/super_post/index.iphone.erb +1 -0
- data/vendor/rails/actionpack/test/fixtures/public/400.html +1 -0
- data/vendor/rails/actionpack/test/fixtures/public/404.html +1 -0
- data/vendor/rails/actionpack/test/fixtures/public/500.da.html +1 -0
- data/vendor/rails/actionpack/test/fixtures/public/500.html +1 -0
- data/vendor/rails/actionpack/test/fixtures/public/bar.html +1 -0
- data/vendor/rails/actionpack/test/fixtures/public/bar/index.html +1 -0
- data/vendor/rails/actionpack/test/fixtures/public/foo/bar.html +1 -0
- data/vendor/rails/actionpack/test/fixtures/public/foo/baz.css +3 -0
- data/vendor/rails/actionpack/test/fixtures/public/foo/index.html +1 -0
- data/vendor/rails/actionpack/test/fixtures/public/foo/other-index.html +1 -0
- data/vendor/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/vendor/rails/actionpack/test/fixtures/public/foo//343/201/225/343/202/210/343/201/206/343/201/252/343/202/211.html +1 -0
- data/vendor/rails/actionpack/test/fixtures/public/foo//343/201/225/343/202/210/343/201/206/343/201/252/343/202/211.html.gz +0 -0
- data/vendor/rails/actionpack/test/fixtures/public/gzip/application-a71b3024f80aea3181c09774ca17e712.js +4 -0
- data/vendor/rails/actionpack/test/fixtures/public/gzip/application-a71b3024f80aea3181c09774ca17e712.js.gz +0 -0
- data/vendor/rails/actionpack/test/fixtures/public/gzip/foo.zoo +4 -0
- data/vendor/rails/actionpack/test/fixtures/public/gzip/foo.zoo.gz +0 -0
- data/vendor/rails/actionpack/test/fixtures/public/index.html +1 -0
- data/vendor/rails/actionpack/test/fixtures/public/other-index.html +1 -0
- data/vendor/rails/actionpack/test/fixtures/respond_to/all_types_with_layout.html.erb +1 -0
- data/vendor/rails/actionpack/test/fixtures/respond_to/custom_constant_handling_without_block.mobile.erb +1 -0
- data/vendor/rails/actionpack/test/fixtures/respond_to/iphone_with_html_response_type.html.erb +1 -0
- data/vendor/rails/actionpack/test/fixtures/respond_to/iphone_with_html_response_type.iphone.erb +1 -0
- data/vendor/rails/actionpack/test/fixtures/respond_to/layouts/missing.html.erb +1 -0
- data/vendor/rails/actionpack/test/fixtures/respond_to/layouts/standard.html.erb +1 -0
- data/vendor/rails/actionpack/test/fixtures/respond_to/layouts/standard.iphone.erb +1 -0
- data/vendor/rails/actionpack/test/fixtures/respond_to/using_defaults.html.erb +1 -0
- data/vendor/rails/actionpack/test/fixtures/respond_to/using_defaults.xml.builder +1 -0
- data/vendor/rails/actionpack/test/fixtures/respond_to/using_defaults_with_all.html.erb +1 -0
- data/vendor/rails/actionpack/test/fixtures/respond_to/using_defaults_with_type_list.html.erb +1 -0
- data/vendor/rails/actionpack/test/fixtures/respond_to/using_defaults_with_type_list.xml.builder +1 -0
- data/vendor/rails/actionpack/test/fixtures/respond_to/variant_any_implicit_render.html+phablet.erb +1 -0
- data/vendor/rails/actionpack/test/fixtures/respond_to/variant_any_implicit_render.html+tablet.erb +1 -0
- data/vendor/rails/actionpack/test/fixtures/respond_to/variant_inline_syntax_without_block.html+phone.erb +1 -0
- data/vendor/rails/actionpack/test/fixtures/respond_to/variant_plus_none_for_format.html.erb +1 -0
- data/vendor/rails/actionpack/test/fixtures/respond_to/variant_with_implicit_template_rendering.html+mobile.erb +1 -0
- data/vendor/rails/actionpack/test/fixtures/ruby_template.ruby +2 -0
- data/vendor/rails/actionpack/test/fixtures/session_autoload_test/session_autoload_test/foo.rb +12 -0
- data/vendor/rails/actionpack/test/fixtures/shared.html.erb +1 -0
- data/vendor/rails/actionpack/test/fixtures/star_star_mime/index.js.erb +1 -0
- data/vendor/rails/actionpack/test/fixtures/test/_partial.erb +1 -0
- data/vendor/rails/actionpack/test/fixtures/test/_partial.html.erb +1 -0
- data/vendor/rails/actionpack/test/fixtures/test/_partial.js.erb +1 -0
- data/vendor/rails/actionpack/test/fixtures/test/dot.directory/render_file_with_ivar.erb +1 -0
- data/vendor/rails/actionpack/test/fixtures/test/formatted_xml_erb.builder +1 -0
- data/vendor/rails/actionpack/test/fixtures/test/formatted_xml_erb.html.erb +1 -0
- data/vendor/rails/actionpack/test/fixtures/test/formatted_xml_erb.xml.erb +1 -0
- data/vendor/rails/actionpack/test/fixtures/test/hello/hello.erb +1 -0
- data/vendor/rails/actionpack/test/fixtures/test/hello_world.erb +1 -0
- data/vendor/rails/actionpack/test/fixtures/test/hello_world_with_partial.html.erb +2 -0
- data/vendor/rails/actionpack/test/fixtures/test/hello_xml_world.builder +11 -0
- data/vendor/rails/actionpack/test/fixtures/test/implicit_content_type.atom.builder +2 -0
- data/vendor/rails/actionpack/test/fixtures/test/render_file_with_ivar.erb +1 -0
- data/vendor/rails/actionpack/test/fixtures/test/render_file_with_locals.erb +1 -0
- data/vendor/rails/actionpack/test/fixtures/test/with_implicit_template.erb +1 -0
- data/vendor/rails/actionpack/test/fixtures//345/205/254/345/205/261/bar.html +1 -0
- data/vendor/rails/actionpack/test/fixtures//345/205/254/345/205/261/bar/index.html +1 -0
- data/vendor/rails/actionpack/test/fixtures//345/205/254/345/205/261/foo/bar.html +1 -0
- data/vendor/rails/actionpack/test/fixtures//345/205/254/345/205/261/foo/baz.css +3 -0
- data/vendor/rails/actionpack/test/fixtures//345/205/254/345/205/261/foo/index.html +1 -0
- data/vendor/rails/actionpack/test/fixtures//345/205/254/345/205/261/foo/other-index.html +1 -0
- data/vendor/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/vendor/rails/actionpack/test/fixtures//345/205/254/345/205/261/foo//343/201/225/343/202/210/343/201/206/343/201/252/343/202/211.html +1 -0
- data/vendor/rails/actionpack/test/fixtures//345/205/254/345/205/261/foo//343/201/225/343/202/210/343/201/206/343/201/252/343/202/211.html.gz +0 -0
- data/vendor/rails/actionpack/test/fixtures//345/205/254/345/205/261/gzip/application-a71b3024f80aea3181c09774ca17e712.js +4 -0
- data/vendor/rails/actionpack/test/fixtures//345/205/254/345/205/261/gzip/application-a71b3024f80aea3181c09774ca17e712.js.gz +0 -0
- data/vendor/rails/actionpack/test/fixtures//345/205/254/345/205/261/gzip/foo.zoo +4 -0
- data/vendor/rails/actionpack/test/fixtures//345/205/254/345/205/261/gzip/foo.zoo.gz +0 -0
- data/vendor/rails/actionpack/test/fixtures//345/205/254/345/205/261/index.html +1 -0
- data/vendor/rails/actionpack/test/fixtures//345/205/254/345/205/261/other-index.html +1 -0
- data/vendor/rails/actionpack/test/journey/gtg/builder_test.rb +81 -0
- data/vendor/rails/actionpack/test/journey/gtg/transition_table_test.rb +125 -0
- data/vendor/rails/actionpack/test/journey/nfa/simulator_test.rb +100 -0
- data/vendor/rails/actionpack/test/journey/nfa/transition_table_test.rb +74 -0
- data/vendor/rails/actionpack/test/journey/nodes/symbol_test.rb +19 -0
- data/vendor/rails/actionpack/test/journey/path/pattern_test.rb +286 -0
- data/vendor/rails/actionpack/test/journey/route/definition/parser_test.rb +112 -0
- data/vendor/rails/actionpack/test/journey/route/definition/scanner_test.rb +71 -0
- data/vendor/rails/actionpack/test/journey/route_test.rb +113 -0
- data/vendor/rails/actionpack/test/journey/router/utils_test.rb +48 -0
- data/vendor/rails/actionpack/test/journey/router_test.rb +544 -0
- data/vendor/rails/actionpack/test/journey/routes_test.rb +62 -0
- data/vendor/rails/actionpack/test/lib/controller/fake_controllers.rb +37 -0
- data/vendor/rails/actionpack/test/lib/controller/fake_models.rb +79 -0
- data/vendor/rails/actionpack/test/routing/helper_test.rb +33 -0
- data/vendor/rails/actionview/CHANGELOG.md +122 -0
- data/vendor/rails/actionview/MIT-LICENSE +21 -0
- data/vendor/rails/actionview/README.rdoc +38 -0
- data/vendor/rails/actionview/RUNNING_UJS_TESTS.rdoc +8 -0
- data/vendor/rails/actionview/RUNNING_UNIT_TESTS.rdoc +26 -0
- data/vendor/rails/actionview/Rakefile +136 -0
- data/vendor/rails/actionview/actionview.gemspec +38 -0
- data/vendor/rails/actionview/app/assets/javascripts/MIT-LICENSE +20 -0
- data/vendor/rails/actionview/app/assets/javascripts/README.md +55 -0
- data/vendor/rails/actionview/app/assets/javascripts/rails-ujs.coffee +39 -0
- data/vendor/rails/actionview/app/assets/javascripts/rails-ujs/BANNER.js +5 -0
- data/vendor/rails/actionview/app/assets/javascripts/rails-ujs/features/confirm.coffee +26 -0
- data/vendor/rails/actionview/app/assets/javascripts/rails-ujs/features/disable.coffee +82 -0
- data/vendor/rails/actionview/app/assets/javascripts/rails-ujs/features/method.coffee +34 -0
- data/vendor/rails/actionview/app/assets/javascripts/rails-ujs/features/remote.coffee +90 -0
- data/vendor/rails/actionview/app/assets/javascripts/rails-ujs/start.coffee +71 -0
- data/vendor/rails/actionview/app/assets/javascripts/rails-ujs/utils/ajax.coffee +97 -0
- data/vendor/rails/actionview/app/assets/javascripts/rails-ujs/utils/csp.coffee +4 -0
- data/vendor/rails/actionview/app/assets/javascripts/rails-ujs/utils/csrf.coffee +25 -0
- data/vendor/rails/actionview/app/assets/javascripts/rails-ujs/utils/dom.coffee +35 -0
- data/vendor/rails/actionview/app/assets/javascripts/rails-ujs/utils/event.coffee +68 -0
- data/vendor/rails/actionview/app/assets/javascripts/rails-ujs/utils/form.coffee +36 -0
- data/vendor/rails/actionview/bin/test +5 -0
- data/vendor/rails/actionview/blade.yml +11 -0
- data/vendor/rails/actionview/coffeelint.json +135 -0
- data/vendor/rails/actionview/lib/action_view.rb +97 -0
- data/vendor/rails/actionview/lib/action_view/base.rb +215 -0
- data/vendor/rails/actionview/lib/action_view/buffers.rb +52 -0
- data/vendor/rails/actionview/lib/action_view/context.rb +36 -0
- data/vendor/rails/actionview/lib/action_view/dependency_tracker.rb +175 -0
- data/vendor/rails/actionview/lib/action_view/digestor.rb +136 -0
- data/vendor/rails/actionview/lib/action_view/flows.rb +76 -0
- data/vendor/rails/actionview/lib/action_view/gem_version.rb +17 -0
- data/vendor/rails/actionview/lib/action_view/helpers.rb +68 -0
- data/vendor/rails/actionview/lib/action_view/helpers/active_model_helper.rb +55 -0
- data/vendor/rails/actionview/lib/action_view/helpers/asset_tag_helper.rb +511 -0
- data/vendor/rails/actionview/lib/action_view/helpers/asset_url_helper.rb +469 -0
- data/vendor/rails/actionview/lib/action_view/helpers/atom_feed_helper.rb +205 -0
- data/vendor/rails/actionview/lib/action_view/helpers/cache_helper.rb +263 -0
- data/vendor/rails/actionview/lib/action_view/helpers/capture_helper.rb +212 -0
- data/vendor/rails/actionview/lib/action_view/helpers/controller_helper.rb +36 -0
- data/vendor/rails/actionview/lib/action_view/helpers/csp_helper.rb +24 -0
- data/vendor/rails/actionview/lib/action_view/helpers/csrf_helper.rb +35 -0
- data/vendor/rails/actionview/lib/action_view/helpers/date_helper.rb +1156 -0
- data/vendor/rails/actionview/lib/action_view/helpers/debug_helper.rb +36 -0
- data/vendor/rails/actionview/lib/action_view/helpers/form_helper.rb +2337 -0
- data/vendor/rails/actionview/lib/action_view/helpers/form_options_helper.rb +887 -0
- data/vendor/rails/actionview/lib/action_view/helpers/form_tag_helper.rb +917 -0
- data/vendor/rails/actionview/lib/action_view/helpers/javascript_helper.rb +94 -0
- data/vendor/rails/actionview/lib/action_view/helpers/number_helper.rb +451 -0
- data/vendor/rails/actionview/lib/action_view/helpers/output_safety_helper.rb +70 -0
- data/vendor/rails/actionview/lib/action_view/helpers/record_tag_helper.rb +23 -0
- data/vendor/rails/actionview/lib/action_view/helpers/rendering_helper.rb +99 -0
- data/vendor/rails/actionview/lib/action_view/helpers/sanitize_helper.rb +177 -0
- data/vendor/rails/actionview/lib/action_view/helpers/tag_helper.rb +313 -0
- data/vendor/rails/actionview/lib/action_view/helpers/tags.rb +44 -0
- data/vendor/rails/actionview/lib/action_view/helpers/tags/base.rb +192 -0
- data/vendor/rails/actionview/lib/action_view/helpers/tags/check_box.rb +66 -0
- data/vendor/rails/actionview/lib/action_view/helpers/tags/checkable.rb +18 -0
- data/vendor/rails/actionview/lib/action_view/helpers/tags/collection_check_boxes.rb +36 -0
- data/vendor/rails/actionview/lib/action_view/helpers/tags/collection_helpers.rb +119 -0
- data/vendor/rails/actionview/lib/action_view/helpers/tags/collection_radio_buttons.rb +31 -0
- data/vendor/rails/actionview/lib/action_view/helpers/tags/collection_select.rb +30 -0
- data/vendor/rails/actionview/lib/action_view/helpers/tags/color_field.rb +27 -0
- data/vendor/rails/actionview/lib/action_view/helpers/tags/date_field.rb +15 -0
- data/vendor/rails/actionview/lib/action_view/helpers/tags/date_select.rb +74 -0
- data/vendor/rails/actionview/lib/action_view/helpers/tags/datetime_field.rb +32 -0
- data/vendor/rails/actionview/lib/action_view/helpers/tags/datetime_local_field.rb +21 -0
- data/vendor/rails/actionview/lib/action_view/helpers/tags/datetime_select.rb +10 -0
- data/vendor/rails/actionview/lib/action_view/helpers/tags/email_field.rb +10 -0
- data/vendor/rails/actionview/lib/action_view/helpers/tags/file_field.rb +10 -0
- data/vendor/rails/actionview/lib/action_view/helpers/tags/grouped_collection_select.rb +31 -0
- data/vendor/rails/actionview/lib/action_view/helpers/tags/hidden_field.rb +10 -0
- data/vendor/rails/actionview/lib/action_view/helpers/tags/label.rb +81 -0
- data/vendor/rails/actionview/lib/action_view/helpers/tags/month_field.rb +15 -0
- data/vendor/rails/actionview/lib/action_view/helpers/tags/number_field.rb +20 -0
- data/vendor/rails/actionview/lib/action_view/helpers/tags/password_field.rb +14 -0
- data/vendor/rails/actionview/lib/action_view/helpers/tags/placeholderable.rb +24 -0
- data/vendor/rails/actionview/lib/action_view/helpers/tags/radio_button.rb +33 -0
- data/vendor/rails/actionview/lib/action_view/helpers/tags/range_field.rb +10 -0
- data/vendor/rails/actionview/lib/action_view/helpers/tags/search_field.rb +27 -0
- data/vendor/rails/actionview/lib/action_view/helpers/tags/select.rb +43 -0
- data/vendor/rails/actionview/lib/action_view/helpers/tags/tel_field.rb +10 -0
- data/vendor/rails/actionview/lib/action_view/helpers/tags/text_area.rb +24 -0
- data/vendor/rails/actionview/lib/action_view/helpers/tags/text_field.rb +34 -0
- data/vendor/rails/actionview/lib/action_view/helpers/tags/time_field.rb +15 -0
- data/vendor/rails/actionview/lib/action_view/helpers/tags/time_select.rb +10 -0
- data/vendor/rails/actionview/lib/action_view/helpers/tags/time_zone_select.rb +22 -0
- data/vendor/rails/actionview/lib/action_view/helpers/tags/translator.rb +44 -0
- data/vendor/rails/actionview/lib/action_view/helpers/tags/url_field.rb +10 -0
- data/vendor/rails/actionview/lib/action_view/helpers/tags/week_field.rb +15 -0
- data/vendor/rails/actionview/lib/action_view/helpers/text_helper.rb +486 -0
- data/vendor/rails/actionview/lib/action_view/helpers/translation_helper.rb +141 -0
- data/vendor/rails/actionview/lib/action_view/helpers/url_helper.rb +676 -0
- data/vendor/rails/actionview/lib/action_view/layouts.rb +433 -0
- data/vendor/rails/actionview/lib/action_view/locale/en.yml +56 -0
- data/vendor/rails/actionview/lib/action_view/log_subscriber.rb +96 -0
- data/vendor/rails/actionview/lib/action_view/lookup_context.rb +274 -0
- data/vendor/rails/actionview/lib/action_view/model_naming.rb +14 -0
- data/vendor/rails/actionview/lib/action_view/path_set.rb +100 -0
- data/vendor/rails/actionview/lib/action_view/railtie.rb +82 -0
- data/vendor/rails/actionview/lib/action_view/record_identifier.rb +112 -0
- data/vendor/rails/actionview/lib/action_view/renderer/abstract_renderer.rb +55 -0
- data/vendor/rails/actionview/lib/action_view/renderer/partial_renderer.rb +552 -0
- data/vendor/rails/actionview/lib/action_view/renderer/partial_renderer/collection_caching.rb +57 -0
- data/vendor/rails/actionview/lib/action_view/renderer/renderer.rb +56 -0
- data/vendor/rails/actionview/lib/action_view/renderer/streaming_template_renderer.rb +105 -0
- data/vendor/rails/actionview/lib/action_view/renderer/template_renderer.rb +102 -0
- data/vendor/rails/actionview/lib/action_view/rendering.rb +151 -0
- data/vendor/rails/actionview/lib/action_view/routing_url_for.rb +145 -0
- data/vendor/rails/actionview/lib/action_view/tasks/cache_digests.rake +25 -0
- data/vendor/rails/actionview/lib/action_view/template.rb +361 -0
- data/vendor/rails/actionview/lib/action_view/template/error.rb +141 -0
- data/vendor/rails/actionview/lib/action_view/template/handlers.rb +66 -0
- data/vendor/rails/actionview/lib/action_view/template/handlers/builder.rb +25 -0
- data/vendor/rails/actionview/lib/action_view/template/handlers/erb.rb +74 -0
- data/vendor/rails/actionview/lib/action_view/template/handlers/erb/erubi.rb +83 -0
- data/vendor/rails/actionview/lib/action_view/template/handlers/html.rb +11 -0
- data/vendor/rails/actionview/lib/action_view/template/handlers/raw.rb +11 -0
- data/vendor/rails/actionview/lib/action_view/template/html.rb +34 -0
- data/vendor/rails/actionview/lib/action_view/template/resolver.rb +391 -0
- data/vendor/rails/actionview/lib/action_view/template/text.rb +33 -0
- data/vendor/rails/actionview/lib/action_view/template/types.rb +57 -0
- data/vendor/rails/actionview/lib/action_view/test_case.rb +300 -0
- data/vendor/rails/actionview/lib/action_view/testing/resolvers.rb +54 -0
- data/vendor/rails/actionview/lib/action_view/version.rb +10 -0
- data/vendor/rails/actionview/lib/action_view/view_paths.rb +105 -0
- data/vendor/rails/actionview/package.json +36 -0
- data/vendor/rails/actionview/test/abstract_unit.rb +236 -0
- data/vendor/rails/actionview/test/actionpack/abstract/abstract_controller_test.rb +292 -0
- data/vendor/rails/actionview/test/actionpack/abstract/helper_test.rb +128 -0
- data/vendor/rails/actionview/test/actionpack/abstract/layouts_test.rb +568 -0
- data/vendor/rails/actionview/test/actionpack/abstract/render_test.rb +103 -0
- data/vendor/rails/actionview/test/actionpack/abstract/views/abstract_controller/testing/me3/formatted.html.erb +1 -0
- data/vendor/rails/actionview/test/actionpack/abstract/views/abstract_controller/testing/me3/index.erb +1 -0
- data/vendor/rails/actionview/test/actionpack/abstract/views/abstract_controller/testing/me4/index.erb +1 -0
- data/vendor/rails/actionview/test/actionpack/abstract/views/action_with_ivars.erb +1 -0
- data/vendor/rails/actionview/test/actionpack/abstract/views/helper_test.erb +1 -0
- data/vendor/rails/actionview/test/actionpack/abstract/views/index.erb +1 -0
- data/vendor/rails/actionview/test/actionpack/abstract/views/layouts/abstract_controller/testing/me4.erb +1 -0
- data/vendor/rails/actionview/test/actionpack/abstract/views/layouts/application.erb +1 -0
- data/vendor/rails/actionview/test/actionpack/abstract/views/naked_render.erb +1 -0
- data/vendor/rails/actionview/test/actionpack/controller/capture_test.rb +83 -0
- data/vendor/rails/actionview/test/actionpack/controller/layout_test.rb +270 -0
- data/vendor/rails/actionview/test/actionpack/controller/render_test.rb +1294 -0
- data/vendor/rails/actionview/test/actionpack/controller/view_paths_test.rb +174 -0
- data/vendor/rails/actionview/test/active_record_unit.rb +92 -0
- data/vendor/rails/actionview/test/activerecord/controller_runtime_test.rb +95 -0
- data/vendor/rails/actionview/test/activerecord/debug_helper_test.rb +19 -0
- data/vendor/rails/actionview/test/activerecord/form_helper_activerecord_test.rb +90 -0
- data/vendor/rails/actionview/test/activerecord/polymorphic_routes_test.rb +780 -0
- data/vendor/rails/actionview/test/activerecord/relation_cache_test.rb +23 -0
- data/vendor/rails/actionview/test/activerecord/render_partial_with_record_identification_test.rb +188 -0
- data/vendor/rails/actionview/test/fixtures/_top_level_partial.html.erb +1 -0
- data/vendor/rails/actionview/test/fixtures/_top_level_partial_only.erb +1 -0
- data/vendor/rails/actionview/test/fixtures/actionpack/bad_customers/_bad_customer.html.erb +1 -0
- data/vendor/rails/actionview/test/fixtures/actionpack/customers/_customer.html.erb +1 -0
- data/vendor/rails/actionview/test/fixtures/actionpack/fun/games/_form.erb +1 -0
- data/vendor/rails/actionview/test/fixtures/actionpack/fun/games/hello_world.erb +1 -0
- data/vendor/rails/actionview/test/fixtures/actionpack/good_customers/_good_customer.html.erb +1 -0
- data/vendor/rails/actionview/test/fixtures/actionpack/hello.html +1 -0
- data/vendor/rails/actionview/test/fixtures/actionpack/layout_tests/alt/layouts/alt.erb +1 -0
- data/vendor/rails/actionview/test/fixtures/actionpack/layout_tests/layouts/controller_name_space/nested.erb +1 -0
- data/vendor/rails/actionview/test/fixtures/actionpack/layout_tests/layouts/item.erb +1 -0
- data/vendor/rails/actionview/test/fixtures/actionpack/layout_tests/layouts/layout_test.erb +1 -0
- data/vendor/rails/actionview/test/fixtures/actionpack/layout_tests/layouts/multiple_extensions.html.erb +1 -0
- data/vendor/rails/actionview/test/fixtures/actionpack/layout_tests/layouts/symlinked/symlinked_layout.erb +5 -0
- data/vendor/rails/actionview/test/fixtures/actionpack/layout_tests/layouts/third_party_template_library.mab +1 -0
- data/vendor/rails/actionview/test/fixtures/actionpack/layout_tests/views/goodbye.erb +1 -0
- data/vendor/rails/actionview/test/fixtures/actionpack/layout_tests/views/hello.erb +1 -0
- data/vendor/rails/actionview/test/fixtures/actionpack/layouts/_column.html.erb +2 -0
- data/vendor/rails/actionview/test/fixtures/actionpack/layouts/_customers.erb +1 -0
- data/vendor/rails/actionview/test/fixtures/actionpack/layouts/_partial_and_yield.erb +2 -0
- data/vendor/rails/actionview/test/fixtures/actionpack/layouts/_yield_only.erb +1 -0
- data/vendor/rails/actionview/test/fixtures/actionpack/layouts/_yield_with_params.erb +1 -0
- data/vendor/rails/actionview/test/fixtures/actionpack/layouts/block_with_layout.erb +3 -0
- data/vendor/rails/actionview/test/fixtures/actionpack/layouts/builder.builder +3 -0
- data/vendor/rails/actionview/test/fixtures/actionpack/layouts/partial_with_layout.erb +3 -0
- data/vendor/rails/actionview/test/fixtures/actionpack/layouts/standard.html.erb +1 -0
- data/vendor/rails/actionview/test/fixtures/actionpack/layouts/standard.text.erb +1 -0
- data/vendor/rails/actionview/test/fixtures/actionpack/layouts/streaming.erb +4 -0
- data/vendor/rails/actionview/test/fixtures/actionpack/layouts/talk_from_action.erb +2 -0
- data/vendor/rails/actionview/test/fixtures/actionpack/layouts/with_html_partial.html.erb +1 -0
- data/vendor/rails/actionview/test/fixtures/actionpack/layouts/xhr.html.erb +2 -0
- data/vendor/rails/actionview/test/fixtures/actionpack/layouts/yield.erb +2 -0
- data/vendor/rails/actionview/test/fixtures/actionpack/layouts/yield_with_render_inline_inside.erb +2 -0
- data/vendor/rails/actionview/test/fixtures/actionpack/layouts/yield_with_render_partial_inside.erb +2 -0
- data/vendor/rails/actionview/test/fixtures/actionpack/quiz/questions/_question.html.erb +1 -0
- data/vendor/rails/actionview/test/fixtures/actionpack/shared.html.erb +1 -0
- data/vendor/rails/actionview/test/fixtures/actionpack/test/_changing_priority.html.erb +1 -0
- data/vendor/rails/actionview/test/fixtures/actionpack/test/_changing_priority.json.erb +1 -0
- data/vendor/rails/actionview/test/fixtures/actionpack/test/_counter.html.erb +1 -0
- data/vendor/rails/actionview/test/fixtures/actionpack/test/_customer.erb +1 -0
- data/vendor/rails/actionview/test/fixtures/actionpack/test/_customer_counter.erb +1 -0
- data/vendor/rails/actionview/test/fixtures/actionpack/test/_customer_counter_with_as.erb +1 -0
- data/vendor/rails/actionview/test/fixtures/actionpack/test/_customer_greeting.erb +1 -0
- data/vendor/rails/actionview/test/fixtures/actionpack/test/_customer_iteration.erb +1 -0
- data/vendor/rails/actionview/test/fixtures/actionpack/test/_customer_iteration_with_as.erb +1 -0
- data/vendor/rails/actionview/test/fixtures/actionpack/test/_customer_with_var.erb +1 -0
- data/vendor/rails/actionview/test/fixtures/actionpack/test/_directory/_partial_with_locales.html.erb +1 -0
- data/vendor/rails/actionview/test/fixtures/actionpack/test/_first_json_partial.json.erb +1 -0
- data/vendor/rails/actionview/test/fixtures/actionpack/test/_form.erb +1 -0
- data/vendor/rails/actionview/test/fixtures/actionpack/test/_hash_greeting.erb +1 -0
- data/vendor/rails/actionview/test/fixtures/actionpack/test/_hash_object.erb +2 -0
- data/vendor/rails/actionview/test/fixtures/actionpack/test/_hello.builder +1 -0
- data/vendor/rails/actionview/test/fixtures/actionpack/test/_json_change_priority.json.erb +0 -0
- data/vendor/rails/actionview/test/fixtures/actionpack/test/_labelling_form.erb +1 -0
- data/vendor/rails/actionview/test/fixtures/actionpack/test/_layout_for_partial.html.erb +3 -0
- data/vendor/rails/actionview/test/fixtures/actionpack/test/_partial.erb +1 -0
- data/vendor/rails/actionview/test/fixtures/actionpack/test/_partial.html.erb +1 -0
- data/vendor/rails/actionview/test/fixtures/actionpack/test/_partial.js.erb +1 -0
- data/vendor/rails/actionview/test/fixtures/actionpack/test/_partial_for_use_in_layout.html.erb +1 -0
- data/vendor/rails/actionview/test/fixtures/actionpack/test/_partial_html_erb.html.erb +1 -0
- data/vendor/rails/actionview/test/fixtures/actionpack/test/_partial_name_local_variable.erb +1 -0
- data/vendor/rails/actionview/test/fixtures/actionpack/test/_partial_only.erb +1 -0
- data/vendor/rails/actionview/test/fixtures/actionpack/test/_partial_only_html.html +1 -0
- data/vendor/rails/actionview/test/fixtures/actionpack/test/_partial_with_partial.erb +2 -0
- data/vendor/rails/actionview/test/fixtures/actionpack/test/_person.erb +2 -0
- data/vendor/rails/actionview/test/fixtures/actionpack/test/_raise_indentation.html.erb +13 -0
- data/vendor/rails/actionview/test/fixtures/actionpack/test/_second_json_partial.json.erb +1 -0
- data/vendor/rails/actionview/test/fixtures/actionpack/test/action_talk_to_layout.erb +2 -0
- data/vendor/rails/actionview/test/fixtures/actionpack/test/calling_partial_with_layout.html.erb +1 -0
- data/vendor/rails/actionview/test/fixtures/actionpack/test/capturing.erb +4 -0
- data/vendor/rails/actionview/test/fixtures/actionpack/test/change_priority.html.erb +2 -0
- data/vendor/rails/actionview/test/fixtures/actionpack/test/content_for.erb +1 -0
- data/vendor/rails/actionview/test/fixtures/actionpack/test/content_for_concatenated.erb +3 -0
- data/vendor/rails/actionview/test/fixtures/actionpack/test/content_for_with_parameter.erb +2 -0
- data/vendor/rails/actionview/test/fixtures/actionpack/test/dot.directory/render_file_with_ivar.erb +1 -0
- data/vendor/rails/actionview/test/fixtures/actionpack/test/formatted_html_erb.html.erb +1 -0
- data/vendor/rails/actionview/test/fixtures/actionpack/test/formatted_xml_erb.builder +1 -0
- data/vendor/rails/actionview/test/fixtures/actionpack/test/formatted_xml_erb.html.erb +1 -0
- data/vendor/rails/actionview/test/fixtures/actionpack/test/formatted_xml_erb.xml.erb +1 -0
- data/vendor/rails/actionview/test/fixtures/actionpack/test/greeting.html.erb +1 -0
- data/vendor/rails/actionview/test/fixtures/actionpack/test/greeting.xml.erb +1 -0
- data/vendor/rails/actionview/test/fixtures/actionpack/test/hello,world.erb +1 -0
- data/vendor/rails/actionview/test/fixtures/actionpack/test/hello.builder +4 -0
- data/vendor/rails/actionview/test/fixtures/actionpack/test/hello/hello.erb +1 -0
- data/vendor/rails/actionview/test/fixtures/actionpack/test/hello_world.erb +1 -0
- data/vendor/rails/actionview/test/fixtures/actionpack/test/hello_world_container.builder +3 -0
- data/vendor/rails/actionview/test/fixtures/actionpack/test/hello_world_from_rxml.builder +3 -0
- data/vendor/rails/actionview/test/fixtures/actionpack/test/hello_world_with_layout_false.erb +1 -0
- data/vendor/rails/actionview/test/fixtures/actionpack/test/hello_world_with_partial.html.erb +2 -0
- data/vendor/rails/actionview/test/fixtures/actionpack/test/hello_xml_world.builder +11 -0
- data/vendor/rails/actionview/test/fixtures/actionpack/test/html_template.html.erb +1 -0
- data/vendor/rails/actionview/test/fixtures/actionpack/test/hyphen-ated.erb +1 -0
- data/vendor/rails/actionview/test/fixtures/actionpack/test/implicit_content_type.atom.builder +2 -0
- data/vendor/rails/actionview/test/fixtures/actionpack/test/list.erb +1 -0
- data/vendor/rails/actionview/test/fixtures/actionpack/test/non_erb_block_content_for.builder +4 -0
- data/vendor/rails/actionview/test/fixtures/actionpack/test/potential_conflicts.erb +4 -0
- data/vendor/rails/actionview/test/fixtures/actionpack/test/proper_block_detection.erb +1 -0
- data/vendor/rails/actionview/test/fixtures/actionpack/test/render_file_from_template.html.erb +1 -0
- data/vendor/rails/actionview/test/fixtures/actionpack/test/render_file_with_ivar.erb +1 -0
- data/vendor/rails/actionview/test/fixtures/actionpack/test/render_file_with_locals.erb +1 -0
- data/vendor/rails/actionview/test/fixtures/actionpack/test/render_file_with_locals_and_default.erb +1 -0
- data/vendor/rails/actionview/test/fixtures/actionpack/test/render_implicit_html_template_from_xhr_request.da.html.erb +1 -0
- data/vendor/rails/actionview/test/fixtures/actionpack/test/render_implicit_html_template_from_xhr_request.html.erb +1 -0
- data/vendor/rails/actionview/test/fixtures/actionpack/test/render_implicit_js_template_without_layout.js.erb +1 -0
- data/vendor/rails/actionview/test/fixtures/actionpack/test/render_partial_inside_directory.html.erb +1 -0
- data/vendor/rails/actionview/test/fixtures/actionpack/test/render_to_string_test.erb +1 -0
- data/vendor/rails/actionview/test/fixtures/actionpack/test/render_two_partials.html.erb +2 -0
- data/vendor/rails/actionview/test/fixtures/actionpack/test/using_layout_around_block.html.erb +1 -0
- data/vendor/rails/actionview/test/fixtures/actionpack/test/with_html_partial.html.erb +1 -0
- data/vendor/rails/actionview/test/fixtures/actionpack/test/with_partial.html.erb +1 -0
- data/vendor/rails/actionview/test/fixtures/actionpack/test/with_partial.text.erb +1 -0
- data/vendor/rails/actionview/test/fixtures/actionpack/test/with_xml_template.html.erb +1 -0
- data/vendor/rails/actionview/test/fixtures/comments/empty.de.html.erb +1 -0
- data/vendor/rails/actionview/test/fixtures/comments/empty.html+grid.erb +1 -0
- data/vendor/rails/actionview/test/fixtures/comments/empty.html.builder +1 -0
- data/vendor/rails/actionview/test/fixtures/comments/empty.html.erb +1 -0
- data/vendor/rails/actionview/test/fixtures/comments/empty.xml.erb +1 -0
- data/vendor/rails/actionview/test/fixtures/companies.yml +24 -0
- data/vendor/rails/actionview/test/fixtures/company.rb +11 -0
- data/vendor/rails/actionview/test/fixtures/custom_pattern/another.html.erb +1 -0
- data/vendor/rails/actionview/test/fixtures/custom_pattern/html/another.erb +1 -0
- data/vendor/rails/actionview/test/fixtures/custom_pattern/html/path.erb +1 -0
- data/vendor/rails/actionview/test/fixtures/customers/_customer.html.erb +1 -0
- data/vendor/rails/actionview/test/fixtures/customers/_customer.xml.erb +1 -0
- data/vendor/rails/actionview/test/fixtures/db_definitions/sqlite.sql +49 -0
- data/vendor/rails/actionview/test/fixtures/developer.rb +8 -0
- data/vendor/rails/actionview/test/fixtures/developers.yml +21 -0
- data/vendor/rails/actionview/test/fixtures/developers/_developer.erb +1 -0
- data/vendor/rails/actionview/test/fixtures/developers_projects.yml +13 -0
- data/vendor/rails/actionview/test/fixtures/digestor/api/comments/_comment.json.erb +1 -0
- data/vendor/rails/actionview/test/fixtures/digestor/api/comments/_comments.json.erb +1 -0
- data/vendor/rails/actionview/test/fixtures/digestor/comments/_comment.html.erb +1 -0
- data/vendor/rails/actionview/test/fixtures/digestor/comments/_comments.html.erb +1 -0
- data/vendor/rails/actionview/test/fixtures/digestor/comments/show.js.erb +1 -0
- data/vendor/rails/actionview/test/fixtures/digestor/events/_completed.html.erb +0 -0
- data/vendor/rails/actionview/test/fixtures/digestor/events/_event.html.erb +0 -0
- data/vendor/rails/actionview/test/fixtures/digestor/events/index.html.erb +1 -0
- data/vendor/rails/actionview/test/fixtures/digestor/level/_recursion.html.erb +1 -0
- data/vendor/rails/actionview/test/fixtures/digestor/level/below/_header.html.erb +0 -0
- data/vendor/rails/actionview/test/fixtures/digestor/level/below/index.html.erb +1 -0
- data/vendor/rails/actionview/test/fixtures/digestor/level/recursion.html.erb +1 -0
- data/vendor/rails/actionview/test/fixtures/digestor/messages/_form.html.erb +0 -0
- data/vendor/rails/actionview/test/fixtures/digestor/messages/_header.html.erb +0 -0
- data/vendor/rails/actionview/test/fixtures/digestor/messages/_message.html.erb +1 -0
- data/vendor/rails/actionview/test/fixtures/digestor/messages/actions/_move.html.erb +0 -0
- data/vendor/rails/actionview/test/fixtures/digestor/messages/edit.html.erb +5 -0
- data/vendor/rails/actionview/test/fixtures/digestor/messages/index.html.erb +2 -0
- data/vendor/rails/actionview/test/fixtures/digestor/messages/new.html+iphone.erb +15 -0
- data/vendor/rails/actionview/test/fixtures/digestor/messages/peek.html.erb +2 -0
- data/vendor/rails/actionview/test/fixtures/digestor/messages/show.html.erb +14 -0
- data/vendor/rails/actionview/test/fixtures/digestor/messages/thread.json.erb +1 -0
- data/vendor/rails/actionview/test/fixtures/fun/games/_game.erb +1 -0
- data/vendor/rails/actionview/test/fixtures/fun/games/hello_world.erb +1 -0
- data/vendor/rails/actionview/test/fixtures/fun/serious/games/_game.erb +1 -0
- data/vendor/rails/actionview/test/fixtures/games/_game.erb +1 -0
- data/vendor/rails/actionview/test/fixtures/good_customers/_good_customer.html.erb +1 -0
- data/vendor/rails/actionview/test/fixtures/helpers/abc_helper.rb +5 -0
- data/vendor/rails/actionview/test/fixtures/helpers/helpery_test_helper.rb +7 -0
- data/vendor/rails/actionview/test/fixtures/helpers_missing/invalid_require_helper.rb +6 -0
- data/vendor/rails/actionview/test/fixtures/layout_tests/alt/hello.erb +1 -0
- data/vendor/rails/actionview/test/fixtures/layouts/_column.html.erb +2 -0
- data/vendor/rails/actionview/test/fixtures/layouts/_customers.erb +1 -0
- data/vendor/rails/actionview/test/fixtures/layouts/_partial_and_yield.erb +2 -0
- data/vendor/rails/actionview/test/fixtures/layouts/_yield_only.erb +1 -0
- data/vendor/rails/actionview/test/fixtures/layouts/_yield_with_params.erb +1 -0
- data/vendor/rails/actionview/test/fixtures/layouts/render_partial_html.erb +2 -0
- data/vendor/rails/actionview/test/fixtures/layouts/streaming.erb +4 -0
- data/vendor/rails/actionview/test/fixtures/layouts/streaming_with_capture.erb +6 -0
- data/vendor/rails/actionview/test/fixtures/layouts/streaming_with_locale.erb +2 -0
- data/vendor/rails/actionview/test/fixtures/layouts/yield.erb +2 -0
- data/vendor/rails/actionview/test/fixtures/layouts/yield_with_render_inline_inside.erb +2 -0
- data/vendor/rails/actionview/test/fixtures/layouts/yield_with_render_partial_inside.erb +2 -0
- data/vendor/rails/actionview/test/fixtures/mascot.rb +5 -0
- data/vendor/rails/actionview/test/fixtures/mascots.yml +4 -0
- data/vendor/rails/actionview/test/fixtures/mascots/_mascot.html.erb +1 -0
- data/vendor/rails/actionview/test/fixtures/override/test/hello_world.erb +1 -0
- data/vendor/rails/actionview/test/fixtures/override2/layouts/test/sub.erb +1 -0
- data/vendor/rails/actionview/test/fixtures/plain_text.raw +1 -0
- data/vendor/rails/actionview/test/fixtures/plain_text_with_characters.raw +1 -0
- data/vendor/rails/actionview/test/fixtures/project.rb +9 -0
- data/vendor/rails/actionview/test/fixtures/projects.yml +7 -0
- data/vendor/rails/actionview/test/fixtures/projects/_project.erb +1 -0
- data/vendor/rails/actionview/test/fixtures/public/elsewhere/cools.js +1 -0
- data/vendor/rails/actionview/test/fixtures/public/elsewhere/file.css +1 -0
- data/vendor/rails/actionview/test/fixtures/public/foo/baz.css +3 -0
- data/vendor/rails/actionview/test/fixtures/public/javascripts/application.js +1 -0
- data/vendor/rails/actionview/test/fixtures/public/javascripts/bank.js +1 -0
- data/vendor/rails/actionview/test/fixtures/public/javascripts/common.javascript +1 -0
- data/vendor/rails/actionview/test/fixtures/public/javascripts/controls.js +1 -0
- data/vendor/rails/actionview/test/fixtures/public/javascripts/dragdrop.js +1 -0
- data/vendor/rails/actionview/test/fixtures/public/javascripts/effects.js +1 -0
- data/vendor/rails/actionview/test/fixtures/public/javascripts/prototype.js +1 -0
- data/vendor/rails/actionview/test/fixtures/public/javascripts/robber.js +1 -0
- data/vendor/rails/actionview/test/fixtures/public/javascripts/subdir/subdir.js +1 -0
- data/vendor/rails/actionview/test/fixtures/public/javascripts/version.1.0.js +1 -0
- data/vendor/rails/actionview/test/fixtures/public/stylesheets/bank.css +1 -0
- data/vendor/rails/actionview/test/fixtures/public/stylesheets/random.styles +1 -0
- data/vendor/rails/actionview/test/fixtures/public/stylesheets/robber.css +1 -0
- data/vendor/rails/actionview/test/fixtures/public/stylesheets/subdir/subdir.css +1 -0
- data/vendor/rails/actionview/test/fixtures/public/stylesheets/version.1.0.css +1 -0
- data/vendor/rails/actionview/test/fixtures/replies.yml +15 -0
- data/vendor/rails/actionview/test/fixtures/replies/_reply.erb +1 -0
- data/vendor/rails/actionview/test/fixtures/reply.rb +9 -0
- data/vendor/rails/actionview/test/fixtures/respond_to/using_defaults_with_all.html.erb +1 -0
- data/vendor/rails/actionview/test/fixtures/ruby_template.ruby +2 -0
- data/vendor/rails/actionview/test/fixtures/shared.html.erb +1 -0
- data/vendor/rails/actionview/test/fixtures/test/_200.html.erb +1 -0
- data/vendor/rails/actionview/test/fixtures/test/_FooBar.html.erb +1 -0
- data/vendor/rails/actionview/test/fixtures/test/_a-in.html.erb +0 -0
- data/vendor/rails/actionview/test/fixtures/test/_b_layout_for_partial.html.erb +1 -0
- data/vendor/rails/actionview/test/fixtures/test/_b_layout_for_partial_with_object.html.erb +1 -0
- data/vendor/rails/actionview/test/fixtures/test/_b_layout_for_partial_with_object_counter.html.erb +1 -0
- data/vendor/rails/actionview/test/fixtures/test/_builder_tag_nested_in_content_tag.erb +3 -0
- data/vendor/rails/actionview/test/fixtures/test/_cached_customer.erb +3 -0
- data/vendor/rails/actionview/test/fixtures/test/_cached_customer_as.erb +3 -0
- data/vendor/rails/actionview/test/fixtures/test/_cached_nested_cached_customer.erb +3 -0
- data/vendor/rails/actionview/test/fixtures/test/_changing_priority.html.erb +1 -0
- data/vendor/rails/actionview/test/fixtures/test/_changing_priority.json.erb +1 -0
- data/vendor/rails/actionview/test/fixtures/test/_content_tag_nested_in_content_tag.erb +3 -0
- data/vendor/rails/actionview/test/fixtures/test/_counter.html.erb +1 -0
- data/vendor/rails/actionview/test/fixtures/test/_customer.erb +1 -0
- data/vendor/rails/actionview/test/fixtures/test/_customer.mobile.erb +1 -0
- data/vendor/rails/actionview/test/fixtures/test/_customer_greeting.erb +1 -0
- data/vendor/rails/actionview/test/fixtures/test/_customer_with_var.erb +1 -0
- data/vendor/rails/actionview/test/fixtures/test/_directory/_partial_with_locales.html.erb +1 -0
- data/vendor/rails/actionview/test/fixtures/test/_first_json_partial.json.erb +1 -0
- data/vendor/rails/actionview/test/fixtures/test/_from_helper.erb +1 -0
- data/vendor/rails/actionview/test/fixtures/test/_json_change_priority.json.erb +0 -0
- data/vendor/rails/actionview/test/fixtures/test/_klass.erb +1 -0
- data/vendor/rails/actionview/test/fixtures/test/_label_with_block.erb +4 -0
- data/vendor/rails/actionview/test/fixtures/test/_layout_for_block_with_args.html.erb +3 -0
- data/vendor/rails/actionview/test/fixtures/test/_layout_for_partial.html.erb +3 -0
- data/vendor/rails/actionview/test/fixtures/test/_layout_with_partial_and_yield.html.erb +4 -0
- data/vendor/rails/actionview/test/fixtures/test/_local_inspector.html.erb +1 -0
- data/vendor/rails/actionview/test/fixtures/test/_nested_cached_customer.erb +1 -0
- data/vendor/rails/actionview/test/fixtures/test/_object_inspector.erb +1 -0
- data/vendor/rails/actionview/test/fixtures/test/_one.html.erb +1 -0
- data/vendor/rails/actionview/test/fixtures/test/_partial.erb +1 -0
- data/vendor/rails/actionview/test/fixtures/test/_partial.html.erb +1 -0
- data/vendor/rails/actionview/test/fixtures/test/_partial.js.erb +1 -0
- data/vendor/rails/actionview/test/fixtures/test/_partial_for_use_in_layout.html.erb +1 -0
- data/vendor/rails/actionview/test/fixtures/test/_partial_iteration_1.erb +1 -0
- data/vendor/rails/actionview/test/fixtures/test/_partial_iteration_2.erb +1 -0
- data/vendor/rails/actionview/test/fixtures/test/_partial_name_in_local_assigns.erb +1 -0
- data/vendor/rails/actionview/test/fixtures/test/_partial_name_local_variable.erb +1 -0
- data/vendor/rails/actionview/test/fixtures/test/_partial_only.erb +1 -0
- data/vendor/rails/actionview/test/fixtures/test/_partial_shortcut_with_block_content.html.erb +3 -0
- data/vendor/rails/actionview/test/fixtures/test/_partial_with_layout.erb +2 -0
- data/vendor/rails/actionview/test/fixtures/test/_partial_with_layout_block_content.erb +4 -0
- data/vendor/rails/actionview/test/fixtures/test/_partial_with_layout_block_partial.erb +4 -0
- data/vendor/rails/actionview/test/fixtures/test/_partial_with_only_html_version.html.erb +1 -0
- data/vendor/rails/actionview/test/fixtures/test/_partial_with_partial.erb +2 -0
- data/vendor/rails/actionview/test/fixtures/test/_partial_with_variants.html+grid.erb +1 -0
- data/vendor/rails/actionview/test/fixtures/test/_partialhtml.html +1 -0
- data/vendor/rails/actionview/test/fixtures/test/_raise.html.erb +1 -0
- data/vendor/rails/actionview/test/fixtures/test/_raise_indentation.html.erb +13 -0
- data/vendor/rails/actionview/test/fixtures/test/_second_json_partial.json.erb +1 -0
- data/vendor/rails/actionview/test/fixtures/test/_two.html.erb +1 -0
- data/vendor/rails/actionview/test/fixtures/test/_utf8_partial.html.erb +1 -0
- data/vendor/rails/actionview/test/fixtures/test/_utf8_partial_magic.html.erb +2 -0
- data/vendor/rails/actionview/test/fixtures/test/_/360/237/215/243.erb +1 -0
- data/vendor/rails/actionview/test/fixtures/test/basic.html.erb +1 -0
- data/vendor/rails/actionview/test/fixtures/test/calling_partial_with_layout.html.erb +1 -0
- data/vendor/rails/actionview/test/fixtures/test/change_priority.html.erb +2 -0
- data/vendor/rails/actionview/test/fixtures/test/dont_pick_me +1 -0
- data/vendor/rails/actionview/test/fixtures/test/dot.directory/render_file_with_ivar.erb +1 -0
- data/vendor/rails/actionview/test/fixtures/test/greeting.xml.erb +1 -0
- data/vendor/rails/actionview/test/fixtures/test/hello.builder +4 -0
- data/vendor/rails/actionview/test/fixtures/test/hello/hello.erb +1 -0
- data/vendor/rails/actionview/test/fixtures/test/hello_world.da.html.erb +1 -0
- data/vendor/rails/actionview/test/fixtures/test/hello_world.erb +1 -0
- data/vendor/rails/actionview/test/fixtures/test/hello_world.erb~ +1 -0
- data/vendor/rails/actionview/test/fixtures/test/hello_world.html+phone.erb +1 -0
- data/vendor/rails/actionview/test/fixtures/test/hello_world.pt-BR.html.erb +1 -0
- data/vendor/rails/actionview/test/fixtures/test/hello_world.text+phone.erb +1 -0
- data/vendor/rails/actionview/test/fixtures/test/hello_world_with_partial.html.erb +2 -0
- data/vendor/rails/actionview/test/fixtures/test/html_template.html.erb +1 -0
- data/vendor/rails/actionview/test/fixtures/test/layout_render_file.erb +2 -0
- data/vendor/rails/actionview/test/fixtures/test/layout_render_object.erb +1 -0
- data/vendor/rails/actionview/test/fixtures/test/list.erb +1 -0
- data/vendor/rails/actionview/test/fixtures/test/malformed/malformed.en.html.erb~ +1 -0
- data/vendor/rails/actionview/test/fixtures/test/malformed/malformed.erb~ +1 -0
- data/vendor/rails/actionview/test/fixtures/test/malformed/malformed.html.erb~ +1 -0
- data/vendor/rails/actionview/test/fixtures/test/malformed/malformed~ +1 -0
- data/vendor/rails/actionview/test/fixtures/test/nested_layout.erb +3 -0
- data/vendor/rails/actionview/test/fixtures/test/nested_streaming.erb +3 -0
- data/vendor/rails/actionview/test/fixtures/test/nil_return.erb +1 -0
- data/vendor/rails/actionview/test/fixtures/test/one.html.erb +1 -0
- data/vendor/rails/actionview/test/fixtures/test/render_file_inspect_local_assigns.erb +1 -0
- data/vendor/rails/actionview/test/fixtures/test/render_file_instance_variable.erb +1 -0
- data/vendor/rails/actionview/test/fixtures/test/render_file_unicode_local.erb +1 -0
- data/vendor/rails/actionview/test/fixtures/test/render_file_with_ivar.erb +1 -0
- data/vendor/rails/actionview/test/fixtures/test/render_file_with_locals.erb +1 -0
- data/vendor/rails/actionview/test/fixtures/test/render_file_with_locals_and_default.erb +1 -0
- data/vendor/rails/actionview/test/fixtures/test/render_file_with_ruby_keyword_locals.erb +1 -0
- data/vendor/rails/actionview/test/fixtures/test/render_partial_inside_directory.html.erb +1 -0
- data/vendor/rails/actionview/test/fixtures/test/render_two_partials.html.erb +2 -0
- data/vendor/rails/actionview/test/fixtures/test/streaming.erb +3 -0
- data/vendor/rails/actionview/test/fixtures/test/streaming_buster.erb +3 -0
- data/vendor/rails/actionview/test/fixtures/test/streaming_with_locale.erb +1 -0
- data/vendor/rails/actionview/test/fixtures/test/sub_template_raise.html.erb +1 -0
- data/vendor/rails/actionview/test/fixtures/test/template.erb +1 -0
- data/vendor/rails/actionview/test/fixtures/test/test_template_with_delegation_reserved_keywords.erb +1 -0
- data/vendor/rails/actionview/test/fixtures/test/update_element_with_capture.erb +9 -0
- data/vendor/rails/actionview/test/fixtures/test/utf8.html.erb +4 -0
- data/vendor/rails/actionview/test/fixtures/test/utf8_magic.html.erb +5 -0
- data/vendor/rails/actionview/test/fixtures/test/utf8_magic_with_bare_partial.html.erb +5 -0
- data/vendor/rails/actionview/test/fixtures/topic.rb +5 -0
- data/vendor/rails/actionview/test/fixtures/topics.yml +22 -0
- data/vendor/rails/actionview/test/fixtures/topics/_topic.html.erb +1 -0
- data/vendor/rails/actionview/test/fixtures/translations/templates/array.erb +1 -0
- data/vendor/rails/actionview/test/fixtures/translations/templates/default.erb +1 -0
- data/vendor/rails/actionview/test/fixtures/translations/templates/found.erb +1 -0
- data/vendor/rails/actionview/test/fixtures/translations/templates/missing.erb +1 -0
- data/vendor/rails/actionview/test/fixtures/with_format.json.erb +1 -0
- data/vendor/rails/actionview/test/lib/controller/fake_models.rb +204 -0
- data/vendor/rails/actionview/test/template/active_model_helper_test.rb +172 -0
- data/vendor/rails/actionview/test/template/asset_tag_helper_test.rb +913 -0
- data/vendor/rails/actionview/test/template/atom_feed_helper_test.rb +375 -0
- data/vendor/rails/actionview/test/template/capture_helper_test.rb +228 -0
- data/vendor/rails/actionview/test/template/compiled_templates_test.rb +94 -0
- data/vendor/rails/actionview/test/template/controller_helper_test.rb +34 -0
- data/vendor/rails/actionview/test/template/date_helper_i18n_test.rb +166 -0
- data/vendor/rails/actionview/test/template/date_helper_test.rb +3642 -0
- data/vendor/rails/actionview/test/template/dependency_tracker_test.rb +195 -0
- data/vendor/rails/actionview/test/template/digestor_test.rb +389 -0
- data/vendor/rails/actionview/test/template/erb/form_for_test.rb +13 -0
- data/vendor/rails/actionview/test/template/erb/helper.rb +26 -0
- data/vendor/rails/actionview/test/template/erb/tag_helper_test.rb +32 -0
- data/vendor/rails/actionview/test/template/erb_util_test.rb +114 -0
- data/vendor/rails/actionview/test/template/form_collections_helper_test.rb +527 -0
- data/vendor/rails/actionview/test/template/form_helper/form_with_test.rb +2293 -0
- data/vendor/rails/actionview/test/template/form_helper_test.rb +3554 -0
- data/vendor/rails/actionview/test/template/form_options_helper_i18n_test.rb +30 -0
- data/vendor/rails/actionview/test/template/form_options_helper_test.rb +1452 -0
- data/vendor/rails/actionview/test/template/form_tag_helper_test.rb +785 -0
- data/vendor/rails/actionview/test/template/html_test.rb +19 -0
- data/vendor/rails/actionview/test/template/javascript_helper_test.rb +68 -0
- data/vendor/rails/actionview/test/template/log_subscriber_test.rb +224 -0
- data/vendor/rails/actionview/test/template/lookup_context_test.rb +289 -0
- data/vendor/rails/actionview/test/template/number_helper_test.rb +204 -0
- data/vendor/rails/actionview/test/template/output_safety_helper_test.rb +119 -0
- data/vendor/rails/actionview/test/template/partial_iteration_test.rb +35 -0
- data/vendor/rails/actionview/test/template/record_identifier_test.rb +93 -0
- data/vendor/rails/actionview/test/template/record_tag_helper_test.rb +33 -0
- data/vendor/rails/actionview/test/template/render_test.rb +725 -0
- data/vendor/rails/actionview/test/template/resolver_cache_test.rb +9 -0
- data/vendor/rails/actionview/test/template/resolver_patterns_test.rb +44 -0
- data/vendor/rails/actionview/test/template/sanitize_helper_test.rb +43 -0
- data/vendor/rails/actionview/test/template/streaming_render_test.rb +132 -0
- data/vendor/rails/actionview/test/template/tag_helper_test.rb +357 -0
- data/vendor/rails/actionview/test/template/template_error_test.rb +37 -0
- data/vendor/rails/actionview/test/template/template_test.rb +207 -0
- data/vendor/rails/actionview/test/template/test_case_test.rb +335 -0
- data/vendor/rails/actionview/test/template/test_test.rb +94 -0
- data/vendor/rails/actionview/test/template/testing/fixture_resolver_test.rb +20 -0
- data/vendor/rails/actionview/test/template/testing/null_resolver_test.rb +14 -0
- data/vendor/rails/actionview/test/template/text_helper_test.rb +535 -0
- data/vendor/rails/actionview/test/template/text_test.rb +25 -0
- data/vendor/rails/actionview/test/template/translation_helper_test.rb +238 -0
- data/vendor/rails/actionview/test/template/url_helper_test.rb +976 -0
- data/vendor/rails/actionview/test/ujs/config.ru +6 -0
- data/vendor/rails/actionview/test/ujs/public/test/call-ajax.js +26 -0
- data/vendor/rails/actionview/test/ujs/public/test/call-remote-callbacks.js +239 -0
- data/vendor/rails/actionview/test/ujs/public/test/call-remote.js +275 -0
- data/vendor/rails/actionview/test/ujs/public/test/csrf-refresh.js +24 -0
- data/vendor/rails/actionview/test/ujs/public/test/csrf-token.js +27 -0
- data/vendor/rails/actionview/test/ujs/public/test/data-confirm.js +316 -0
- data/vendor/rails/actionview/test/ujs/public/test/data-disable-with.js +394 -0
- data/vendor/rails/actionview/test/ujs/public/test/data-disable.js +322 -0
- data/vendor/rails/actionview/test/ujs/public/test/data-method.js +85 -0
- data/vendor/rails/actionview/test/ujs/public/test/data-remote.js +441 -0
- data/vendor/rails/actionview/test/ujs/public/test/override.js +56 -0
- data/vendor/rails/actionview/test/ujs/public/test/settings.js +118 -0
- data/vendor/rails/actionview/test/ujs/public/vendor/jquery-2.2.0.js +9831 -0
- data/vendor/rails/actionview/test/ujs/public/vendor/jquery.metadata.js +122 -0
- data/vendor/rails/actionview/test/ujs/public/vendor/qunit.css +237 -0
- data/vendor/rails/actionview/test/ujs/public/vendor/qunit.js +2288 -0
- data/vendor/rails/actionview/test/ujs/server.rb +86 -0
- data/vendor/rails/actionview/test/ujs/views/layouts/application.html.erb +26 -0
- data/vendor/rails/actionview/test/ujs/views/tests/index.html.erb +11 -0
- data/vendor/rails/ci/qunit-selenium-runner.rb +16 -0
- data/vendor/rails/ci/travis.rb +187 -0
- data/vendor/rails/rails.gemspec +36 -0
- data/vendor/rails/version.rb +17 -0
- metadata +1030 -30
@@ -0,0 +1,28 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module ActionController #:nodoc:
|
4
|
+
# This module is responsible for providing +rescue_from+ helpers
|
5
|
+
# to controllers and configuring when detailed exceptions must be
|
6
|
+
# shown.
|
7
|
+
module Rescue
|
8
|
+
extend ActiveSupport::Concern
|
9
|
+
include ActiveSupport::Rescuable
|
10
|
+
|
11
|
+
# Override this method if you want to customize when detailed
|
12
|
+
# exceptions must be shown. This method is only called when
|
13
|
+
# +consider_all_requests_local+ is +false+. By default, it returns
|
14
|
+
# +false+, but someone may set it to <tt>request.local?</tt> so local
|
15
|
+
# requests in production still show the detailed exception pages.
|
16
|
+
def show_detailed_exceptions?
|
17
|
+
false
|
18
|
+
end
|
19
|
+
|
20
|
+
private
|
21
|
+
def process_action(*args)
|
22
|
+
super
|
23
|
+
rescue Exception => exception
|
24
|
+
request.env["action_dispatch.show_detailed_exceptions"] ||= show_detailed_exceptions?
|
25
|
+
rescue_with_handler(exception) || raise
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,223 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "rack/chunked"
|
4
|
+
|
5
|
+
module ActionController #:nodoc:
|
6
|
+
# Allows views to be streamed back to the client as they are rendered.
|
7
|
+
#
|
8
|
+
# By default, Rails renders views by first rendering the template
|
9
|
+
# and then the layout. The response is sent to the client after the whole
|
10
|
+
# template is rendered, all queries are made, and the layout is processed.
|
11
|
+
#
|
12
|
+
# Streaming inverts the rendering flow by rendering the layout first and
|
13
|
+
# streaming each part of the layout as they are processed. This allows the
|
14
|
+
# header of the HTML (which is usually in the layout) to be streamed back
|
15
|
+
# to client very quickly, allowing JavaScripts and stylesheets to be loaded
|
16
|
+
# earlier than usual.
|
17
|
+
#
|
18
|
+
# This approach was introduced in Rails 3.1 and is still improving. Several
|
19
|
+
# Rack middlewares may not work and you need to be careful when streaming.
|
20
|
+
# Those points are going to be addressed soon.
|
21
|
+
#
|
22
|
+
# In order to use streaming, you will need to use a Ruby version that
|
23
|
+
# supports fibers (fibers are supported since version 1.9.2 of the main
|
24
|
+
# Ruby implementation).
|
25
|
+
#
|
26
|
+
# Streaming can be added to a given template easily, all you need to do is
|
27
|
+
# to pass the :stream option.
|
28
|
+
#
|
29
|
+
# class PostsController
|
30
|
+
# def index
|
31
|
+
# @posts = Post.all
|
32
|
+
# render stream: true
|
33
|
+
# end
|
34
|
+
# end
|
35
|
+
#
|
36
|
+
# == When to use streaming
|
37
|
+
#
|
38
|
+
# Streaming may be considered to be overkill for lightweight actions like
|
39
|
+
# +new+ or +edit+. The real benefit of streaming is on expensive actions
|
40
|
+
# that, for example, do a lot of queries on the database.
|
41
|
+
#
|
42
|
+
# In such actions, you want to delay queries execution as much as you can.
|
43
|
+
# For example, imagine the following +dashboard+ action:
|
44
|
+
#
|
45
|
+
# def dashboard
|
46
|
+
# @posts = Post.all
|
47
|
+
# @pages = Page.all
|
48
|
+
# @articles = Article.all
|
49
|
+
# end
|
50
|
+
#
|
51
|
+
# Most of the queries here are happening in the controller. In order to benefit
|
52
|
+
# from streaming you would want to rewrite it as:
|
53
|
+
#
|
54
|
+
# def dashboard
|
55
|
+
# # Allow lazy execution of the queries
|
56
|
+
# @posts = Post.all
|
57
|
+
# @pages = Page.all
|
58
|
+
# @articles = Article.all
|
59
|
+
# render stream: true
|
60
|
+
# end
|
61
|
+
#
|
62
|
+
# Notice that :stream only works with templates. Rendering :json
|
63
|
+
# or :xml with :stream won't work.
|
64
|
+
#
|
65
|
+
# == Communication between layout and template
|
66
|
+
#
|
67
|
+
# When streaming, rendering happens top-down instead of inside-out.
|
68
|
+
# Rails starts with the layout, and the template is rendered later,
|
69
|
+
# when its +yield+ is reached.
|
70
|
+
#
|
71
|
+
# This means that, if your application currently relies on instance
|
72
|
+
# variables set in the template to be used in the layout, they won't
|
73
|
+
# work once you move to streaming. The proper way to communicate
|
74
|
+
# between layout and template, regardless of whether you use streaming
|
75
|
+
# or not, is by using +content_for+, +provide+ and +yield+.
|
76
|
+
#
|
77
|
+
# Take a simple example where the layout expects the template to tell
|
78
|
+
# which title to use:
|
79
|
+
#
|
80
|
+
# <html>
|
81
|
+
# <head><title><%= yield :title %></title></head>
|
82
|
+
# <body><%= yield %></body>
|
83
|
+
# </html>
|
84
|
+
#
|
85
|
+
# You would use +content_for+ in your template to specify the title:
|
86
|
+
#
|
87
|
+
# <%= content_for :title, "Main" %>
|
88
|
+
# Hello
|
89
|
+
#
|
90
|
+
# And the final result would be:
|
91
|
+
#
|
92
|
+
# <html>
|
93
|
+
# <head><title>Main</title></head>
|
94
|
+
# <body>Hello</body>
|
95
|
+
# </html>
|
96
|
+
#
|
97
|
+
# However, if +content_for+ is called several times, the final result
|
98
|
+
# would have all calls concatenated. For instance, if we have the following
|
99
|
+
# template:
|
100
|
+
#
|
101
|
+
# <%= content_for :title, "Main" %>
|
102
|
+
# Hello
|
103
|
+
# <%= content_for :title, " page" %>
|
104
|
+
#
|
105
|
+
# The final result would be:
|
106
|
+
#
|
107
|
+
# <html>
|
108
|
+
# <head><title>Main page</title></head>
|
109
|
+
# <body>Hello</body>
|
110
|
+
# </html>
|
111
|
+
#
|
112
|
+
# This means that, if you have <code>yield :title</code> in your layout
|
113
|
+
# and you want to use streaming, you would have to render the whole template
|
114
|
+
# (and eventually trigger all queries) before streaming the title and all
|
115
|
+
# assets, which kills the purpose of streaming. For this purpose, you can use
|
116
|
+
# a helper called +provide+ that does the same as +content_for+ but tells the
|
117
|
+
# layout to stop searching for other entries and continue rendering.
|
118
|
+
#
|
119
|
+
# For instance, the template above using +provide+ would be:
|
120
|
+
#
|
121
|
+
# <%= provide :title, "Main" %>
|
122
|
+
# Hello
|
123
|
+
# <%= content_for :title, " page" %>
|
124
|
+
#
|
125
|
+
# Giving:
|
126
|
+
#
|
127
|
+
# <html>
|
128
|
+
# <head><title>Main</title></head>
|
129
|
+
# <body>Hello</body>
|
130
|
+
# </html>
|
131
|
+
#
|
132
|
+
# That said, when streaming, you need to properly check your templates
|
133
|
+
# and choose when to use +provide+ and +content_for+.
|
134
|
+
#
|
135
|
+
# == Headers, cookies, session and flash
|
136
|
+
#
|
137
|
+
# When streaming, the HTTP headers are sent to the client right before
|
138
|
+
# it renders the first line. This means that, modifying headers, cookies,
|
139
|
+
# session or flash after the template starts rendering will not propagate
|
140
|
+
# to the client.
|
141
|
+
#
|
142
|
+
# == Middlewares
|
143
|
+
#
|
144
|
+
# Middlewares that need to manipulate the body won't work with streaming.
|
145
|
+
# You should disable those middlewares whenever streaming in development
|
146
|
+
# or production. For instance, <tt>Rack::Bug</tt> won't work when streaming as it
|
147
|
+
# needs to inject contents in the HTML body.
|
148
|
+
#
|
149
|
+
# Also <tt>Rack::Cache</tt> won't work with streaming as it does not support
|
150
|
+
# streaming bodies yet. Whenever streaming Cache-Control is automatically
|
151
|
+
# set to "no-cache".
|
152
|
+
#
|
153
|
+
# == Errors
|
154
|
+
#
|
155
|
+
# When it comes to streaming, exceptions get a bit more complicated. This
|
156
|
+
# happens because part of the template was already rendered and streamed to
|
157
|
+
# the client, making it impossible to render a whole exception page.
|
158
|
+
#
|
159
|
+
# Currently, when an exception happens in development or production, Rails
|
160
|
+
# will automatically stream to the client:
|
161
|
+
#
|
162
|
+
# "><script>window.location = "/500.html"</script></html>
|
163
|
+
#
|
164
|
+
# The first two characters (">) are required in case the exception happens
|
165
|
+
# while rendering attributes for a given tag. You can check the real cause
|
166
|
+
# for the exception in your logger.
|
167
|
+
#
|
168
|
+
# == Web server support
|
169
|
+
#
|
170
|
+
# Not all web servers support streaming out-of-the-box. You need to check
|
171
|
+
# the instructions for each of them.
|
172
|
+
#
|
173
|
+
# ==== Unicorn
|
174
|
+
#
|
175
|
+
# Unicorn supports streaming but it needs to be configured. For this, you
|
176
|
+
# need to create a config file as follow:
|
177
|
+
#
|
178
|
+
# # unicorn.config.rb
|
179
|
+
# listen 3000, tcp_nopush: false
|
180
|
+
#
|
181
|
+
# And use it on initialization:
|
182
|
+
#
|
183
|
+
# unicorn_rails --config-file unicorn.config.rb
|
184
|
+
#
|
185
|
+
# You may also want to configure other parameters like <tt>:tcp_nodelay</tt>.
|
186
|
+
# Please check its documentation for more information: https://bogomips.org/unicorn/Unicorn/Configurator.html#method-i-listen
|
187
|
+
#
|
188
|
+
# If you are using Unicorn with NGINX, you may need to tweak NGINX.
|
189
|
+
# Streaming should work out of the box on Rainbows.
|
190
|
+
#
|
191
|
+
# ==== Passenger
|
192
|
+
#
|
193
|
+
# To be described.
|
194
|
+
#
|
195
|
+
module Streaming
|
196
|
+
extend ActiveSupport::Concern
|
197
|
+
|
198
|
+
private
|
199
|
+
|
200
|
+
# Set proper cache control and transfer encoding when streaming
|
201
|
+
def _process_options(options)
|
202
|
+
super
|
203
|
+
if options[:stream]
|
204
|
+
if request.version == "HTTP/1.0"
|
205
|
+
options.delete(:stream)
|
206
|
+
else
|
207
|
+
headers["Cache-Control"] ||= "no-cache"
|
208
|
+
headers["Transfer-Encoding"] = "chunked"
|
209
|
+
headers.delete("Content-Length")
|
210
|
+
end
|
211
|
+
end
|
212
|
+
end
|
213
|
+
|
214
|
+
# Call render_body if we are streaming instead of usual +render+.
|
215
|
+
def _render_template(options)
|
216
|
+
if options.delete(:stream)
|
217
|
+
Rack::Chunked::Body.new view_renderer.render_body(view_context, options)
|
218
|
+
else
|
219
|
+
super
|
220
|
+
end
|
221
|
+
end
|
222
|
+
end
|
223
|
+
end
|
@@ -0,0 +1,1086 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "active_support/core_ext/hash/indifferent_access"
|
4
|
+
require "active_support/core_ext/hash/transform_values"
|
5
|
+
require "active_support/core_ext/array/wrap"
|
6
|
+
require "active_support/core_ext/string/filters"
|
7
|
+
require "active_support/core_ext/object/to_query"
|
8
|
+
require "active_support/rescuable"
|
9
|
+
require "action_dispatch/http/upload"
|
10
|
+
require "rack/test"
|
11
|
+
require "stringio"
|
12
|
+
require "set"
|
13
|
+
require "yaml"
|
14
|
+
|
15
|
+
module ActionController
|
16
|
+
# Raised when a required parameter is missing.
|
17
|
+
#
|
18
|
+
# params = ActionController::Parameters.new(a: {})
|
19
|
+
# params.fetch(:b)
|
20
|
+
# # => ActionController::ParameterMissing: param is missing or the value is empty: b
|
21
|
+
# params.require(:a)
|
22
|
+
# # => ActionController::ParameterMissing: param is missing or the value is empty: a
|
23
|
+
class ParameterMissing < KeyError
|
24
|
+
attr_reader :param # :nodoc:
|
25
|
+
|
26
|
+
def initialize(param) # :nodoc:
|
27
|
+
@param = param
|
28
|
+
super("param is missing or the value is empty: #{param}")
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
# Raised when a supplied parameter is not expected and
|
33
|
+
# ActionController::Parameters.action_on_unpermitted_parameters
|
34
|
+
# is set to <tt>:raise</tt>.
|
35
|
+
#
|
36
|
+
# params = ActionController::Parameters.new(a: "123", b: "456")
|
37
|
+
# params.permit(:c)
|
38
|
+
# # => ActionController::UnpermittedParameters: found unpermitted parameters: :a, :b
|
39
|
+
class UnpermittedParameters < IndexError
|
40
|
+
attr_reader :params # :nodoc:
|
41
|
+
|
42
|
+
def initialize(params) # :nodoc:
|
43
|
+
@params = params
|
44
|
+
super("found unpermitted parameter#{'s' if params.size > 1 }: #{params.map { |e| ":#{e}" }.join(", ")}")
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
# Raised when a Parameters instance is not marked as permitted and
|
49
|
+
# an operation to transform it to hash is called.
|
50
|
+
#
|
51
|
+
# params = ActionController::Parameters.new(a: "123", b: "456")
|
52
|
+
# params.to_h
|
53
|
+
# # => ActionController::UnfilteredParameters: unable to convert unpermitted parameters to hash
|
54
|
+
class UnfilteredParameters < ArgumentError
|
55
|
+
def initialize # :nodoc:
|
56
|
+
super("unable to convert unpermitted parameters to hash")
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
# == Action Controller \Parameters
|
61
|
+
#
|
62
|
+
# Allows you to choose which attributes should be whitelisted for mass updating
|
63
|
+
# and thus prevent accidentally exposing that which shouldn't be exposed.
|
64
|
+
# Provides two methods for this purpose: #require and #permit. The former is
|
65
|
+
# used to mark parameters as required. The latter is used to set the parameter
|
66
|
+
# as permitted and limit which attributes should be allowed for mass updating.
|
67
|
+
#
|
68
|
+
# params = ActionController::Parameters.new({
|
69
|
+
# person: {
|
70
|
+
# name: "Francesco",
|
71
|
+
# age: 22,
|
72
|
+
# role: "admin"
|
73
|
+
# }
|
74
|
+
# })
|
75
|
+
#
|
76
|
+
# permitted = params.require(:person).permit(:name, :age)
|
77
|
+
# permitted # => <ActionController::Parameters {"name"=>"Francesco", "age"=>22} permitted: true>
|
78
|
+
# permitted.permitted? # => true
|
79
|
+
#
|
80
|
+
# Person.first.update!(permitted)
|
81
|
+
# # => #<Person id: 1, name: "Francesco", age: 22, role: "user">
|
82
|
+
#
|
83
|
+
# It provides two options that controls the top-level behavior of new instances:
|
84
|
+
#
|
85
|
+
# * +permit_all_parameters+ - If it's +true+, all the parameters will be
|
86
|
+
# permitted by default. The default is +false+.
|
87
|
+
# * +action_on_unpermitted_parameters+ - Allow to control the behavior when parameters
|
88
|
+
# that are not explicitly permitted are found. The values can be +false+ to just filter them
|
89
|
+
# out, <tt>:log</tt> to additionally write a message on the logger, or <tt>:raise</tt> to raise
|
90
|
+
# ActionController::UnpermittedParameters exception. The default value is <tt>:log</tt>
|
91
|
+
# in test and development environments, +false+ otherwise.
|
92
|
+
#
|
93
|
+
# Examples:
|
94
|
+
#
|
95
|
+
# params = ActionController::Parameters.new
|
96
|
+
# params.permitted? # => false
|
97
|
+
#
|
98
|
+
# ActionController::Parameters.permit_all_parameters = true
|
99
|
+
#
|
100
|
+
# params = ActionController::Parameters.new
|
101
|
+
# params.permitted? # => true
|
102
|
+
#
|
103
|
+
# params = ActionController::Parameters.new(a: "123", b: "456")
|
104
|
+
# params.permit(:c)
|
105
|
+
# # => <ActionController::Parameters {} permitted: true>
|
106
|
+
#
|
107
|
+
# ActionController::Parameters.action_on_unpermitted_parameters = :raise
|
108
|
+
#
|
109
|
+
# params = ActionController::Parameters.new(a: "123", b: "456")
|
110
|
+
# params.permit(:c)
|
111
|
+
# # => ActionController::UnpermittedParameters: found unpermitted keys: a, b
|
112
|
+
#
|
113
|
+
# Please note that these options *are not thread-safe*. In a multi-threaded
|
114
|
+
# environment they should only be set once at boot-time and never mutated at
|
115
|
+
# runtime.
|
116
|
+
#
|
117
|
+
# You can fetch values of <tt>ActionController::Parameters</tt> using either
|
118
|
+
# <tt>:key</tt> or <tt>"key"</tt>.
|
119
|
+
#
|
120
|
+
# params = ActionController::Parameters.new(key: "value")
|
121
|
+
# params[:key] # => "value"
|
122
|
+
# params["key"] # => "value"
|
123
|
+
class Parameters
|
124
|
+
cattr_accessor :permit_all_parameters, instance_accessor: false, default: false
|
125
|
+
|
126
|
+
cattr_accessor :action_on_unpermitted_parameters, instance_accessor: false
|
127
|
+
|
128
|
+
##
|
129
|
+
# :method: as_json
|
130
|
+
#
|
131
|
+
# :call-seq:
|
132
|
+
# as_json(options=nil)
|
133
|
+
#
|
134
|
+
# Returns a hash that can be used as the JSON representation for the parameters.
|
135
|
+
|
136
|
+
##
|
137
|
+
# :method: empty?
|
138
|
+
#
|
139
|
+
# :call-seq:
|
140
|
+
# empty?()
|
141
|
+
#
|
142
|
+
# Returns true if the parameters have no key/value pairs.
|
143
|
+
|
144
|
+
##
|
145
|
+
# :method: has_key?
|
146
|
+
#
|
147
|
+
# :call-seq:
|
148
|
+
# has_key?(key)
|
149
|
+
#
|
150
|
+
# Returns true if the given key is present in the parameters.
|
151
|
+
|
152
|
+
##
|
153
|
+
# :method: has_value?
|
154
|
+
#
|
155
|
+
# :call-seq:
|
156
|
+
# has_value?(value)
|
157
|
+
#
|
158
|
+
# Returns true if the given value is present for some key in the parameters.
|
159
|
+
|
160
|
+
##
|
161
|
+
# :method: include?
|
162
|
+
#
|
163
|
+
# :call-seq:
|
164
|
+
# include?(key)
|
165
|
+
#
|
166
|
+
# Returns true if the given key is present in the parameters.
|
167
|
+
|
168
|
+
##
|
169
|
+
# :method: key?
|
170
|
+
#
|
171
|
+
# :call-seq:
|
172
|
+
# key?(key)
|
173
|
+
#
|
174
|
+
# Returns true if the given key is present in the parameters.
|
175
|
+
|
176
|
+
##
|
177
|
+
# :method: keys
|
178
|
+
#
|
179
|
+
# :call-seq:
|
180
|
+
# keys()
|
181
|
+
#
|
182
|
+
# Returns a new array of the keys of the parameters.
|
183
|
+
|
184
|
+
##
|
185
|
+
# :method: to_s
|
186
|
+
#
|
187
|
+
# :call-seq:
|
188
|
+
# to_s()
|
189
|
+
#
|
190
|
+
# Returns the content of the parameters as a string.
|
191
|
+
|
192
|
+
##
|
193
|
+
# :method: value?
|
194
|
+
#
|
195
|
+
# :call-seq:
|
196
|
+
# value?(value)
|
197
|
+
#
|
198
|
+
# Returns true if the given value is present for some key in the parameters.
|
199
|
+
|
200
|
+
##
|
201
|
+
# :method: values
|
202
|
+
#
|
203
|
+
# :call-seq:
|
204
|
+
# values()
|
205
|
+
#
|
206
|
+
# Returns a new array of the values of the parameters.
|
207
|
+
delegate :keys, :key?, :has_key?, :values, :has_value?, :value?, :empty?, :include?,
|
208
|
+
:as_json, :to_s, to: :@parameters
|
209
|
+
|
210
|
+
# By default, never raise an UnpermittedParameters exception if these
|
211
|
+
# params are present. The default includes both 'controller' and 'action'
|
212
|
+
# because they are added by Rails and should be of no concern. One way
|
213
|
+
# to change these is to specify `always_permitted_parameters` in your
|
214
|
+
# config. For instance:
|
215
|
+
#
|
216
|
+
# config.always_permitted_parameters = %w( controller action format )
|
217
|
+
cattr_accessor :always_permitted_parameters, default: %w( controller action )
|
218
|
+
|
219
|
+
# Returns a new instance of <tt>ActionController::Parameters</tt>.
|
220
|
+
# Also, sets the +permitted+ attribute to the default value of
|
221
|
+
# <tt>ActionController::Parameters.permit_all_parameters</tt>.
|
222
|
+
#
|
223
|
+
# class Person < ActiveRecord::Base
|
224
|
+
# end
|
225
|
+
#
|
226
|
+
# params = ActionController::Parameters.new(name: "Francesco")
|
227
|
+
# params.permitted? # => false
|
228
|
+
# Person.new(params) # => ActiveModel::ForbiddenAttributesError
|
229
|
+
#
|
230
|
+
# ActionController::Parameters.permit_all_parameters = true
|
231
|
+
#
|
232
|
+
# params = ActionController::Parameters.new(name: "Francesco")
|
233
|
+
# params.permitted? # => true
|
234
|
+
# Person.new(params) # => #<Person id: nil, name: "Francesco">
|
235
|
+
def initialize(parameters = {})
|
236
|
+
@parameters = parameters.with_indifferent_access
|
237
|
+
@permitted = self.class.permit_all_parameters
|
238
|
+
end
|
239
|
+
|
240
|
+
# Returns true if another +Parameters+ object contains the same content and
|
241
|
+
# permitted flag.
|
242
|
+
def ==(other)
|
243
|
+
if other.respond_to?(:permitted?)
|
244
|
+
permitted? == other.permitted? && parameters == other.parameters
|
245
|
+
else
|
246
|
+
@parameters == other
|
247
|
+
end
|
248
|
+
end
|
249
|
+
|
250
|
+
# Returns a safe <tt>ActiveSupport::HashWithIndifferentAccess</tt>
|
251
|
+
# representation of the parameters with all unpermitted keys removed.
|
252
|
+
#
|
253
|
+
# params = ActionController::Parameters.new({
|
254
|
+
# name: "Senjougahara Hitagi",
|
255
|
+
# oddity: "Heavy stone crab"
|
256
|
+
# })
|
257
|
+
# params.to_h
|
258
|
+
# # => ActionController::UnfilteredParameters: unable to convert unpermitted parameters to hash
|
259
|
+
#
|
260
|
+
# safe_params = params.permit(:name)
|
261
|
+
# safe_params.to_h # => {"name"=>"Senjougahara Hitagi"}
|
262
|
+
def to_h
|
263
|
+
if permitted?
|
264
|
+
convert_parameters_to_hashes(@parameters, :to_h)
|
265
|
+
else
|
266
|
+
raise UnfilteredParameters
|
267
|
+
end
|
268
|
+
end
|
269
|
+
|
270
|
+
# Returns a safe <tt>Hash</tt> representation of the parameters
|
271
|
+
# with all unpermitted keys removed.
|
272
|
+
#
|
273
|
+
# params = ActionController::Parameters.new({
|
274
|
+
# name: "Senjougahara Hitagi",
|
275
|
+
# oddity: "Heavy stone crab"
|
276
|
+
# })
|
277
|
+
# params.to_hash
|
278
|
+
# # => ActionController::UnfilteredParameters: unable to convert unpermitted parameters to hash
|
279
|
+
#
|
280
|
+
# safe_params = params.permit(:name)
|
281
|
+
# safe_params.to_hash # => {"name"=>"Senjougahara Hitagi"}
|
282
|
+
def to_hash
|
283
|
+
to_h.to_hash
|
284
|
+
end
|
285
|
+
|
286
|
+
# Returns a string representation of the receiver suitable for use as a URL
|
287
|
+
# query string:
|
288
|
+
#
|
289
|
+
# params = ActionController::Parameters.new({
|
290
|
+
# name: "David",
|
291
|
+
# nationality: "Danish"
|
292
|
+
# })
|
293
|
+
# params.to_query
|
294
|
+
# # => ActionController::UnfilteredParameters: unable to convert unpermitted parameters to hash
|
295
|
+
#
|
296
|
+
# safe_params = params.permit(:name, :nationality)
|
297
|
+
# safe_params.to_query
|
298
|
+
# # => "name=David&nationality=Danish"
|
299
|
+
#
|
300
|
+
# An optional namespace can be passed to enclose key names:
|
301
|
+
#
|
302
|
+
# params = ActionController::Parameters.new({
|
303
|
+
# name: "David",
|
304
|
+
# nationality: "Danish"
|
305
|
+
# })
|
306
|
+
# safe_params = params.permit(:name, :nationality)
|
307
|
+
# safe_params.to_query("user")
|
308
|
+
# # => "user%5Bname%5D=David&user%5Bnationality%5D=Danish"
|
309
|
+
#
|
310
|
+
# The string pairs "key=value" that conform the query string
|
311
|
+
# are sorted lexicographically in ascending order.
|
312
|
+
#
|
313
|
+
# This method is also aliased as +to_param+.
|
314
|
+
def to_query(*args)
|
315
|
+
to_h.to_query(*args)
|
316
|
+
end
|
317
|
+
alias_method :to_param, :to_query
|
318
|
+
|
319
|
+
# Returns an unsafe, unfiltered
|
320
|
+
# <tt>ActiveSupport::HashWithIndifferentAccess</tt> representation of the
|
321
|
+
# parameters.
|
322
|
+
#
|
323
|
+
# params = ActionController::Parameters.new({
|
324
|
+
# name: "Senjougahara Hitagi",
|
325
|
+
# oddity: "Heavy stone crab"
|
326
|
+
# })
|
327
|
+
# params.to_unsafe_h
|
328
|
+
# # => {"name"=>"Senjougahara Hitagi", "oddity" => "Heavy stone crab"}
|
329
|
+
def to_unsafe_h
|
330
|
+
convert_parameters_to_hashes(@parameters, :to_unsafe_h)
|
331
|
+
end
|
332
|
+
alias_method :to_unsafe_hash, :to_unsafe_h
|
333
|
+
|
334
|
+
# Convert all hashes in values into parameters, then yield each pair in
|
335
|
+
# the same way as <tt>Hash#each_pair</tt>.
|
336
|
+
def each_pair(&block)
|
337
|
+
@parameters.each_pair do |key, value|
|
338
|
+
yield [key, convert_hashes_to_parameters(key, value)]
|
339
|
+
end
|
340
|
+
end
|
341
|
+
alias_method :each, :each_pair
|
342
|
+
|
343
|
+
# Attribute that keeps track of converted arrays, if any, to avoid double
|
344
|
+
# looping in the common use case permit + mass-assignment. Defined in a
|
345
|
+
# method to instantiate it only if needed.
|
346
|
+
#
|
347
|
+
# Testing membership still loops, but it's going to be faster than our own
|
348
|
+
# loop that converts values. Also, we are not going to build a new array
|
349
|
+
# object per fetch.
|
350
|
+
def converted_arrays
|
351
|
+
@converted_arrays ||= Set.new
|
352
|
+
end
|
353
|
+
|
354
|
+
# Returns +true+ if the parameter is permitted, +false+ otherwise.
|
355
|
+
#
|
356
|
+
# params = ActionController::Parameters.new
|
357
|
+
# params.permitted? # => false
|
358
|
+
# params.permit!
|
359
|
+
# params.permitted? # => true
|
360
|
+
def permitted?
|
361
|
+
@permitted
|
362
|
+
end
|
363
|
+
|
364
|
+
# Sets the +permitted+ attribute to +true+. This can be used to pass
|
365
|
+
# mass assignment. Returns +self+.
|
366
|
+
#
|
367
|
+
# class Person < ActiveRecord::Base
|
368
|
+
# end
|
369
|
+
#
|
370
|
+
# params = ActionController::Parameters.new(name: "Francesco")
|
371
|
+
# params.permitted? # => false
|
372
|
+
# Person.new(params) # => ActiveModel::ForbiddenAttributesError
|
373
|
+
# params.permit!
|
374
|
+
# params.permitted? # => true
|
375
|
+
# Person.new(params) # => #<Person id: nil, name: "Francesco">
|
376
|
+
def permit!
|
377
|
+
each_pair do |key, value|
|
378
|
+
Array.wrap(value).flatten.each do |v|
|
379
|
+
v.permit! if v.respond_to? :permit!
|
380
|
+
end
|
381
|
+
end
|
382
|
+
|
383
|
+
@permitted = true
|
384
|
+
self
|
385
|
+
end
|
386
|
+
|
387
|
+
# This method accepts both a single key and an array of keys.
|
388
|
+
#
|
389
|
+
# When passed a single key, if it exists and its associated value is
|
390
|
+
# either present or the singleton +false+, returns said value:
|
391
|
+
#
|
392
|
+
# ActionController::Parameters.new(person: { name: "Francesco" }).require(:person)
|
393
|
+
# # => <ActionController::Parameters {"name"=>"Francesco"} permitted: false>
|
394
|
+
#
|
395
|
+
# Otherwise raises <tt>ActionController::ParameterMissing</tt>:
|
396
|
+
#
|
397
|
+
# ActionController::Parameters.new.require(:person)
|
398
|
+
# # ActionController::ParameterMissing: param is missing or the value is empty: person
|
399
|
+
#
|
400
|
+
# ActionController::Parameters.new(person: nil).require(:person)
|
401
|
+
# # ActionController::ParameterMissing: param is missing or the value is empty: person
|
402
|
+
#
|
403
|
+
# ActionController::Parameters.new(person: "\t").require(:person)
|
404
|
+
# # ActionController::ParameterMissing: param is missing or the value is empty: person
|
405
|
+
#
|
406
|
+
# ActionController::Parameters.new(person: {}).require(:person)
|
407
|
+
# # ActionController::ParameterMissing: param is missing or the value is empty: person
|
408
|
+
#
|
409
|
+
# When given an array of keys, the method tries to require each one of them
|
410
|
+
# in order. If it succeeds, an array with the respective return values is
|
411
|
+
# returned:
|
412
|
+
#
|
413
|
+
# params = ActionController::Parameters.new(user: { ... }, profile: { ... })
|
414
|
+
# user_params, profile_params = params.require([:user, :profile])
|
415
|
+
#
|
416
|
+
# Otherwise, the method re-raises the first exception found:
|
417
|
+
#
|
418
|
+
# params = ActionController::Parameters.new(user: {}, profile: {})
|
419
|
+
# user_params, profile_params = params.require([:user, :profile])
|
420
|
+
# # ActionController::ParameterMissing: param is missing or the value is empty: user
|
421
|
+
#
|
422
|
+
# Technically this method can be used to fetch terminal values:
|
423
|
+
#
|
424
|
+
# # CAREFUL
|
425
|
+
# params = ActionController::Parameters.new(person: { name: "Finn" })
|
426
|
+
# name = params.require(:person).require(:name) # CAREFUL
|
427
|
+
#
|
428
|
+
# but take into account that at some point those ones have to be permitted:
|
429
|
+
#
|
430
|
+
# def person_params
|
431
|
+
# params.require(:person).permit(:name).tap do |person_params|
|
432
|
+
# person_params.require(:name) # SAFER
|
433
|
+
# end
|
434
|
+
# end
|
435
|
+
#
|
436
|
+
# for example.
|
437
|
+
def require(key)
|
438
|
+
return key.map { |k| require(k) } if key.is_a?(Array)
|
439
|
+
value = self[key]
|
440
|
+
if value.present? || value == false
|
441
|
+
value
|
442
|
+
else
|
443
|
+
raise ParameterMissing.new(key)
|
444
|
+
end
|
445
|
+
end
|
446
|
+
|
447
|
+
# Alias of #require.
|
448
|
+
alias :required :require
|
449
|
+
|
450
|
+
# Returns a new <tt>ActionController::Parameters</tt> instance that
|
451
|
+
# includes only the given +filters+ and sets the +permitted+ attribute
|
452
|
+
# for the object to +true+. This is useful for limiting which attributes
|
453
|
+
# should be allowed for mass updating.
|
454
|
+
#
|
455
|
+
# params = ActionController::Parameters.new(user: { name: "Francesco", age: 22, role: "admin" })
|
456
|
+
# permitted = params.require(:user).permit(:name, :age)
|
457
|
+
# permitted.permitted? # => true
|
458
|
+
# permitted.has_key?(:name) # => true
|
459
|
+
# permitted.has_key?(:age) # => true
|
460
|
+
# permitted.has_key?(:role) # => false
|
461
|
+
#
|
462
|
+
# Only permitted scalars pass the filter. For example, given
|
463
|
+
#
|
464
|
+
# params.permit(:name)
|
465
|
+
#
|
466
|
+
# +:name+ passes if it is a key of +params+ whose associated value is of type
|
467
|
+
# +String+, +Symbol+, +NilClass+, +Numeric+, +TrueClass+, +FalseClass+,
|
468
|
+
# +Date+, +Time+, +DateTime+, +StringIO+, +IO+,
|
469
|
+
# +ActionDispatch::Http::UploadedFile+ or +Rack::Test::UploadedFile+.
|
470
|
+
# Otherwise, the key +:name+ is filtered out.
|
471
|
+
#
|
472
|
+
# You may declare that the parameter should be an array of permitted scalars
|
473
|
+
# by mapping it to an empty array:
|
474
|
+
#
|
475
|
+
# params = ActionController::Parameters.new(tags: ["rails", "parameters"])
|
476
|
+
# params.permit(tags: [])
|
477
|
+
#
|
478
|
+
# Sometimes it is not possible or convenient to declare the valid keys of
|
479
|
+
# a hash parameter or its internal structure. Just map to an empty hash:
|
480
|
+
#
|
481
|
+
# params.permit(preferences: {})
|
482
|
+
#
|
483
|
+
# Be careful because this opens the door to arbitrary input. In this
|
484
|
+
# case, +permit+ ensures values in the returned structure are permitted
|
485
|
+
# scalars and filters out anything else.
|
486
|
+
#
|
487
|
+
# You can also use +permit+ on nested parameters, like:
|
488
|
+
#
|
489
|
+
# params = ActionController::Parameters.new({
|
490
|
+
# person: {
|
491
|
+
# name: "Francesco",
|
492
|
+
# age: 22,
|
493
|
+
# pets: [{
|
494
|
+
# name: "Purplish",
|
495
|
+
# category: "dogs"
|
496
|
+
# }]
|
497
|
+
# }
|
498
|
+
# })
|
499
|
+
#
|
500
|
+
# permitted = params.permit(person: [ :name, { pets: :name } ])
|
501
|
+
# permitted.permitted? # => true
|
502
|
+
# permitted[:person][:name] # => "Francesco"
|
503
|
+
# permitted[:person][:age] # => nil
|
504
|
+
# permitted[:person][:pets][0][:name] # => "Purplish"
|
505
|
+
# permitted[:person][:pets][0][:category] # => nil
|
506
|
+
#
|
507
|
+
# Note that if you use +permit+ in a key that points to a hash,
|
508
|
+
# it won't allow all the hash. You also need to specify which
|
509
|
+
# attributes inside the hash should be whitelisted.
|
510
|
+
#
|
511
|
+
# params = ActionController::Parameters.new({
|
512
|
+
# person: {
|
513
|
+
# contact: {
|
514
|
+
# email: "none@test.com",
|
515
|
+
# phone: "555-1234"
|
516
|
+
# }
|
517
|
+
# }
|
518
|
+
# })
|
519
|
+
#
|
520
|
+
# params.require(:person).permit(:contact)
|
521
|
+
# # => <ActionController::Parameters {} permitted: true>
|
522
|
+
#
|
523
|
+
# params.require(:person).permit(contact: :phone)
|
524
|
+
# # => <ActionController::Parameters {"contact"=><ActionController::Parameters {"phone"=>"555-1234"} permitted: true>} permitted: true>
|
525
|
+
#
|
526
|
+
# params.require(:person).permit(contact: [ :email, :phone ])
|
527
|
+
# # => <ActionController::Parameters {"contact"=><ActionController::Parameters {"email"=>"none@test.com", "phone"=>"555-1234"} permitted: true>} permitted: true>
|
528
|
+
def permit(*filters)
|
529
|
+
params = self.class.new
|
530
|
+
|
531
|
+
filters.flatten.each do |filter|
|
532
|
+
case filter
|
533
|
+
when Symbol, String
|
534
|
+
permitted_scalar_filter(params, filter)
|
535
|
+
when Hash
|
536
|
+
hash_filter(params, filter)
|
537
|
+
end
|
538
|
+
end
|
539
|
+
|
540
|
+
unpermitted_parameters!(params) if self.class.action_on_unpermitted_parameters
|
541
|
+
|
542
|
+
params.permit!
|
543
|
+
end
|
544
|
+
|
545
|
+
# Returns a parameter for the given +key+. If not found,
|
546
|
+
# returns +nil+.
|
547
|
+
#
|
548
|
+
# params = ActionController::Parameters.new(person: { name: "Francesco" })
|
549
|
+
# params[:person] # => <ActionController::Parameters {"name"=>"Francesco"} permitted: false>
|
550
|
+
# params[:none] # => nil
|
551
|
+
def [](key)
|
552
|
+
convert_hashes_to_parameters(key, @parameters[key])
|
553
|
+
end
|
554
|
+
|
555
|
+
# Assigns a value to a given +key+. The given key may still get filtered out
|
556
|
+
# when +permit+ is called.
|
557
|
+
def []=(key, value)
|
558
|
+
@parameters[key] = value
|
559
|
+
end
|
560
|
+
|
561
|
+
# Returns a parameter for the given +key+. If the +key+
|
562
|
+
# can't be found, there are several options: With no other arguments,
|
563
|
+
# it will raise an <tt>ActionController::ParameterMissing</tt> error;
|
564
|
+
# if a second argument is given, then that is returned (converted to an
|
565
|
+
# instance of ActionController::Parameters if possible); if a block
|
566
|
+
# is given, then that will be run and its result returned.
|
567
|
+
#
|
568
|
+
# params = ActionController::Parameters.new(person: { name: "Francesco" })
|
569
|
+
# params.fetch(:person) # => <ActionController::Parameters {"name"=>"Francesco"} permitted: false>
|
570
|
+
# params.fetch(:none) # => ActionController::ParameterMissing: param is missing or the value is empty: none
|
571
|
+
# params.fetch(:none, {}) # => <ActionController::Parameters {} permitted: false>
|
572
|
+
# params.fetch(:none, "Francesco") # => "Francesco"
|
573
|
+
# params.fetch(:none) { "Francesco" } # => "Francesco"
|
574
|
+
def fetch(key, *args)
|
575
|
+
convert_value_to_parameters(
|
576
|
+
@parameters.fetch(key) {
|
577
|
+
if block_given?
|
578
|
+
yield
|
579
|
+
else
|
580
|
+
args.fetch(0) { raise ActionController::ParameterMissing.new(key) }
|
581
|
+
end
|
582
|
+
}
|
583
|
+
)
|
584
|
+
end
|
585
|
+
|
586
|
+
if Hash.method_defined?(:dig)
|
587
|
+
# Extracts the nested parameter from the given +keys+ by calling +dig+
|
588
|
+
# at each step. Returns +nil+ if any intermediate step is +nil+.
|
589
|
+
#
|
590
|
+
# params = ActionController::Parameters.new(foo: { bar: { baz: 1 } })
|
591
|
+
# params.dig(:foo, :bar, :baz) # => 1
|
592
|
+
# params.dig(:foo, :zot, :xyz) # => nil
|
593
|
+
#
|
594
|
+
# params2 = ActionController::Parameters.new(foo: [10, 11, 12])
|
595
|
+
# params2.dig(:foo, 1) # => 11
|
596
|
+
def dig(*keys)
|
597
|
+
convert_hashes_to_parameters(keys.first, @parameters[keys.first])
|
598
|
+
@parameters.dig(*keys)
|
599
|
+
end
|
600
|
+
end
|
601
|
+
|
602
|
+
# Returns a new <tt>ActionController::Parameters</tt> instance that
|
603
|
+
# includes only the given +keys+. If the given +keys+
|
604
|
+
# don't exist, returns an empty hash.
|
605
|
+
#
|
606
|
+
# params = ActionController::Parameters.new(a: 1, b: 2, c: 3)
|
607
|
+
# params.slice(:a, :b) # => <ActionController::Parameters {"a"=>1, "b"=>2} permitted: false>
|
608
|
+
# params.slice(:d) # => <ActionController::Parameters {} permitted: false>
|
609
|
+
def slice(*keys)
|
610
|
+
new_instance_with_inherited_permitted_status(@parameters.slice(*keys))
|
611
|
+
end
|
612
|
+
|
613
|
+
# Returns current <tt>ActionController::Parameters</tt> instance which
|
614
|
+
# contains only the given +keys+.
|
615
|
+
def slice!(*keys)
|
616
|
+
@parameters.slice!(*keys)
|
617
|
+
self
|
618
|
+
end
|
619
|
+
|
620
|
+
# Returns a new <tt>ActionController::Parameters</tt> instance that
|
621
|
+
# filters out the given +keys+.
|
622
|
+
#
|
623
|
+
# params = ActionController::Parameters.new(a: 1, b: 2, c: 3)
|
624
|
+
# params.except(:a, :b) # => <ActionController::Parameters {"c"=>3} permitted: false>
|
625
|
+
# params.except(:d) # => <ActionController::Parameters {"a"=>1, "b"=>2, "c"=>3} permitted: false>
|
626
|
+
def except(*keys)
|
627
|
+
new_instance_with_inherited_permitted_status(@parameters.except(*keys))
|
628
|
+
end
|
629
|
+
|
630
|
+
# Removes and returns the key/value pairs matching the given keys.
|
631
|
+
#
|
632
|
+
# params = ActionController::Parameters.new(a: 1, b: 2, c: 3)
|
633
|
+
# params.extract!(:a, :b) # => <ActionController::Parameters {"a"=>1, "b"=>2} permitted: false>
|
634
|
+
# params # => <ActionController::Parameters {"c"=>3} permitted: false>
|
635
|
+
def extract!(*keys)
|
636
|
+
new_instance_with_inherited_permitted_status(@parameters.extract!(*keys))
|
637
|
+
end
|
638
|
+
|
639
|
+
# Returns a new <tt>ActionController::Parameters</tt> with the results of
|
640
|
+
# running +block+ once for every value. The keys are unchanged.
|
641
|
+
#
|
642
|
+
# params = ActionController::Parameters.new(a: 1, b: 2, c: 3)
|
643
|
+
# params.transform_values { |x| x * 2 }
|
644
|
+
# # => <ActionController::Parameters {"a"=>2, "b"=>4, "c"=>6} permitted: false>
|
645
|
+
def transform_values
|
646
|
+
return to_enum(:transform_values) unless block_given?
|
647
|
+
new_instance_with_inherited_permitted_status(
|
648
|
+
@parameters.transform_values { |v| yield convert_value_to_parameters(v) }
|
649
|
+
)
|
650
|
+
end
|
651
|
+
|
652
|
+
# Performs values transformation and returns the altered
|
653
|
+
# <tt>ActionController::Parameters</tt> instance.
|
654
|
+
def transform_values!
|
655
|
+
return to_enum(:transform_values!) unless block_given?
|
656
|
+
@parameters.transform_values! { |v| yield convert_value_to_parameters(v) }
|
657
|
+
self
|
658
|
+
end
|
659
|
+
|
660
|
+
# Returns a new <tt>ActionController::Parameters</tt> instance with the
|
661
|
+
# results of running +block+ once for every key. The values are unchanged.
|
662
|
+
def transform_keys(&block)
|
663
|
+
if block
|
664
|
+
new_instance_with_inherited_permitted_status(
|
665
|
+
@parameters.transform_keys(&block)
|
666
|
+
)
|
667
|
+
else
|
668
|
+
@parameters.transform_keys
|
669
|
+
end
|
670
|
+
end
|
671
|
+
|
672
|
+
# Performs keys transformation and returns the altered
|
673
|
+
# <tt>ActionController::Parameters</tt> instance.
|
674
|
+
def transform_keys!(&block)
|
675
|
+
@parameters.transform_keys!(&block)
|
676
|
+
self
|
677
|
+
end
|
678
|
+
|
679
|
+
# Deletes a key-value pair from +Parameters+ and returns the value. If
|
680
|
+
# +key+ is not found, returns +nil+ (or, with optional code block, yields
|
681
|
+
# +key+ and returns the result). Cf. +#extract!+, which returns the
|
682
|
+
# corresponding +ActionController::Parameters+ object.
|
683
|
+
def delete(key, &block)
|
684
|
+
convert_value_to_parameters(@parameters.delete(key, &block))
|
685
|
+
end
|
686
|
+
|
687
|
+
# Returns a new instance of <tt>ActionController::Parameters</tt> with only
|
688
|
+
# items that the block evaluates to true.
|
689
|
+
def select(&block)
|
690
|
+
new_instance_with_inherited_permitted_status(@parameters.select(&block))
|
691
|
+
end
|
692
|
+
|
693
|
+
# Equivalent to Hash#keep_if, but returns +nil+ if no changes were made.
|
694
|
+
def select!(&block)
|
695
|
+
@parameters.select!(&block)
|
696
|
+
self
|
697
|
+
end
|
698
|
+
alias_method :keep_if, :select!
|
699
|
+
|
700
|
+
# Returns a new instance of <tt>ActionController::Parameters</tt> with items
|
701
|
+
# that the block evaluates to true removed.
|
702
|
+
def reject(&block)
|
703
|
+
new_instance_with_inherited_permitted_status(@parameters.reject(&block))
|
704
|
+
end
|
705
|
+
|
706
|
+
# Removes items that the block evaluates to true and returns self.
|
707
|
+
def reject!(&block)
|
708
|
+
@parameters.reject!(&block)
|
709
|
+
self
|
710
|
+
end
|
711
|
+
alias_method :delete_if, :reject!
|
712
|
+
|
713
|
+
# Returns values that were assigned to the given +keys+. Note that all the
|
714
|
+
# +Hash+ objects will be converted to <tt>ActionController::Parameters</tt>.
|
715
|
+
def values_at(*keys)
|
716
|
+
convert_value_to_parameters(@parameters.values_at(*keys))
|
717
|
+
end
|
718
|
+
|
719
|
+
# Returns a new <tt>ActionController::Parameters</tt> with all keys from
|
720
|
+
# +other_hash+ merged into current hash.
|
721
|
+
def merge(other_hash)
|
722
|
+
new_instance_with_inherited_permitted_status(
|
723
|
+
@parameters.merge(other_hash.to_h)
|
724
|
+
)
|
725
|
+
end
|
726
|
+
|
727
|
+
# Returns current <tt>ActionController::Parameters</tt> instance with
|
728
|
+
# +other_hash+ merged into current hash.
|
729
|
+
def merge!(other_hash)
|
730
|
+
@parameters.merge!(other_hash.to_h)
|
731
|
+
self
|
732
|
+
end
|
733
|
+
|
734
|
+
# Returns a new <tt>ActionController::Parameters</tt> with all keys from
|
735
|
+
# current hash merged into +other_hash+.
|
736
|
+
def reverse_merge(other_hash)
|
737
|
+
new_instance_with_inherited_permitted_status(
|
738
|
+
other_hash.to_h.merge(@parameters)
|
739
|
+
)
|
740
|
+
end
|
741
|
+
alias_method :with_defaults, :reverse_merge
|
742
|
+
|
743
|
+
# Returns current <tt>ActionController::Parameters</tt> instance with
|
744
|
+
# current hash merged into +other_hash+.
|
745
|
+
def reverse_merge!(other_hash)
|
746
|
+
@parameters.merge!(other_hash.to_h) { |key, left, right| left }
|
747
|
+
self
|
748
|
+
end
|
749
|
+
alias_method :with_defaults!, :reverse_merge!
|
750
|
+
|
751
|
+
# This is required by ActiveModel attribute assignment, so that user can
|
752
|
+
# pass +Parameters+ to a mass assignment methods in a model. It should not
|
753
|
+
# matter as we are using +HashWithIndifferentAccess+ internally.
|
754
|
+
def stringify_keys # :nodoc:
|
755
|
+
dup
|
756
|
+
end
|
757
|
+
|
758
|
+
def inspect
|
759
|
+
"<#{self.class} #{@parameters} permitted: #{@permitted}>"
|
760
|
+
end
|
761
|
+
|
762
|
+
def self.hook_into_yaml_loading # :nodoc:
|
763
|
+
# Wire up YAML format compatibility with Rails 4.2 and Psych 2.0.8 and 2.0.9+.
|
764
|
+
# Makes the YAML parser call `init_with` when it encounters the keys below
|
765
|
+
# instead of trying its own parsing routines.
|
766
|
+
YAML.load_tags["!ruby/hash-with-ivars:ActionController::Parameters"] = name
|
767
|
+
YAML.load_tags["!ruby/hash:ActionController::Parameters"] = name
|
768
|
+
end
|
769
|
+
hook_into_yaml_loading
|
770
|
+
|
771
|
+
def init_with(coder) # :nodoc:
|
772
|
+
case coder.tag
|
773
|
+
when "!ruby/hash:ActionController::Parameters"
|
774
|
+
# YAML 2.0.8's format where hash instance variables weren't stored.
|
775
|
+
@parameters = coder.map.with_indifferent_access
|
776
|
+
@permitted = false
|
777
|
+
when "!ruby/hash-with-ivars:ActionController::Parameters"
|
778
|
+
# YAML 2.0.9's Hash subclass format where keys and values
|
779
|
+
# were stored under an elements hash and `permitted` within an ivars hash.
|
780
|
+
@parameters = coder.map["elements"].with_indifferent_access
|
781
|
+
@permitted = coder.map["ivars"][:@permitted]
|
782
|
+
when "!ruby/object:ActionController::Parameters"
|
783
|
+
# YAML's Object format. Only needed because of the format
|
784
|
+
# backwardscompability above, otherwise equivalent to YAML's initialization.
|
785
|
+
@parameters, @permitted = coder.map["parameters"], coder.map["permitted"]
|
786
|
+
end
|
787
|
+
end
|
788
|
+
|
789
|
+
# Returns duplicate of object including all parameters.
|
790
|
+
def deep_dup
|
791
|
+
self.class.new(@parameters.deep_dup).tap do |duplicate|
|
792
|
+
duplicate.permitted = @permitted
|
793
|
+
end
|
794
|
+
end
|
795
|
+
|
796
|
+
protected
|
797
|
+
attr_reader :parameters
|
798
|
+
|
799
|
+
def permitted=(new_permitted)
|
800
|
+
@permitted = new_permitted
|
801
|
+
end
|
802
|
+
|
803
|
+
def fields_for_style?
|
804
|
+
@parameters.all? { |k, v| k =~ /\A-?\d+\z/ && (v.is_a?(Hash) || v.is_a?(Parameters)) }
|
805
|
+
end
|
806
|
+
|
807
|
+
private
|
808
|
+
def new_instance_with_inherited_permitted_status(hash)
|
809
|
+
self.class.new(hash).tap do |new_instance|
|
810
|
+
new_instance.permitted = @permitted
|
811
|
+
end
|
812
|
+
end
|
813
|
+
|
814
|
+
def convert_parameters_to_hashes(value, using)
|
815
|
+
case value
|
816
|
+
when Array
|
817
|
+
value.map { |v| convert_parameters_to_hashes(v, using) }
|
818
|
+
when Hash
|
819
|
+
value.transform_values do |v|
|
820
|
+
convert_parameters_to_hashes(v, using)
|
821
|
+
end.with_indifferent_access
|
822
|
+
when Parameters
|
823
|
+
value.send(using)
|
824
|
+
else
|
825
|
+
value
|
826
|
+
end
|
827
|
+
end
|
828
|
+
|
829
|
+
def convert_hashes_to_parameters(key, value)
|
830
|
+
converted = convert_value_to_parameters(value)
|
831
|
+
@parameters[key] = converted unless converted.equal?(value)
|
832
|
+
converted
|
833
|
+
end
|
834
|
+
|
835
|
+
def convert_value_to_parameters(value)
|
836
|
+
case value
|
837
|
+
when Array
|
838
|
+
return value if converted_arrays.member?(value)
|
839
|
+
converted = value.map { |_| convert_value_to_parameters(_) }
|
840
|
+
converted_arrays << converted
|
841
|
+
converted
|
842
|
+
when Hash
|
843
|
+
self.class.new(value)
|
844
|
+
else
|
845
|
+
value
|
846
|
+
end
|
847
|
+
end
|
848
|
+
|
849
|
+
def each_element(object)
|
850
|
+
case object
|
851
|
+
when Array
|
852
|
+
object.grep(Parameters).map { |el| yield el }.compact
|
853
|
+
when Parameters
|
854
|
+
if object.fields_for_style?
|
855
|
+
hash = object.class.new
|
856
|
+
object.each { |k, v| hash[k] = yield v }
|
857
|
+
hash
|
858
|
+
else
|
859
|
+
yield object
|
860
|
+
end
|
861
|
+
end
|
862
|
+
end
|
863
|
+
|
864
|
+
def unpermitted_parameters!(params)
|
865
|
+
unpermitted_keys = unpermitted_keys(params)
|
866
|
+
if unpermitted_keys.any?
|
867
|
+
case self.class.action_on_unpermitted_parameters
|
868
|
+
when :log
|
869
|
+
name = "unpermitted_parameters.action_controller"
|
870
|
+
ActiveSupport::Notifications.instrument(name, keys: unpermitted_keys)
|
871
|
+
when :raise
|
872
|
+
raise ActionController::UnpermittedParameters.new(unpermitted_keys)
|
873
|
+
end
|
874
|
+
end
|
875
|
+
end
|
876
|
+
|
877
|
+
def unpermitted_keys(params)
|
878
|
+
keys - params.keys - always_permitted_parameters
|
879
|
+
end
|
880
|
+
|
881
|
+
#
|
882
|
+
# --- Filtering ----------------------------------------------------------
|
883
|
+
#
|
884
|
+
|
885
|
+
# This is a white list of permitted scalar types that includes the ones
|
886
|
+
# supported in XML and JSON requests.
|
887
|
+
#
|
888
|
+
# This list is in particular used to filter ordinary requests, String goes
|
889
|
+
# as first element to quickly short-circuit the common case.
|
890
|
+
#
|
891
|
+
# If you modify this collection please update the API of +permit+ above.
|
892
|
+
PERMITTED_SCALAR_TYPES = [
|
893
|
+
String,
|
894
|
+
Symbol,
|
895
|
+
NilClass,
|
896
|
+
Numeric,
|
897
|
+
TrueClass,
|
898
|
+
FalseClass,
|
899
|
+
Date,
|
900
|
+
Time,
|
901
|
+
# DateTimes are Dates, we document the type but avoid the redundant check.
|
902
|
+
StringIO,
|
903
|
+
IO,
|
904
|
+
ActionDispatch::Http::UploadedFile,
|
905
|
+
Rack::Test::UploadedFile,
|
906
|
+
]
|
907
|
+
|
908
|
+
def permitted_scalar?(value)
|
909
|
+
PERMITTED_SCALAR_TYPES.any? { |type| value.is_a?(type) }
|
910
|
+
end
|
911
|
+
|
912
|
+
def permitted_scalar_filter(params, key)
|
913
|
+
if has_key?(key) && permitted_scalar?(self[key])
|
914
|
+
params[key] = self[key]
|
915
|
+
end
|
916
|
+
|
917
|
+
keys.grep(/\A#{Regexp.escape(key)}\(\d+[if]?\)\z/) do |k|
|
918
|
+
if permitted_scalar?(self[k])
|
919
|
+
params[k] = self[k]
|
920
|
+
end
|
921
|
+
end
|
922
|
+
end
|
923
|
+
|
924
|
+
def array_of_permitted_scalars?(value)
|
925
|
+
if value.is_a?(Array) && value.all? { |element| permitted_scalar?(element) }
|
926
|
+
yield value
|
927
|
+
end
|
928
|
+
end
|
929
|
+
|
930
|
+
def non_scalar?(value)
|
931
|
+
value.is_a?(Array) || value.is_a?(Parameters)
|
932
|
+
end
|
933
|
+
|
934
|
+
EMPTY_ARRAY = []
|
935
|
+
EMPTY_HASH = {}
|
936
|
+
def hash_filter(params, filter)
|
937
|
+
filter = filter.with_indifferent_access
|
938
|
+
|
939
|
+
# Slicing filters out non-declared keys.
|
940
|
+
slice(*filter.keys).each do |key, value|
|
941
|
+
next unless value
|
942
|
+
next unless has_key? key
|
943
|
+
|
944
|
+
if filter[key] == EMPTY_ARRAY
|
945
|
+
# Declaration { comment_ids: [] }.
|
946
|
+
array_of_permitted_scalars?(self[key]) do |val|
|
947
|
+
params[key] = val
|
948
|
+
end
|
949
|
+
elsif filter[key] == EMPTY_HASH
|
950
|
+
# Declaration { preferences: {} }.
|
951
|
+
if value.is_a?(Parameters)
|
952
|
+
params[key] = permit_any_in_parameters(value)
|
953
|
+
end
|
954
|
+
elsif non_scalar?(value)
|
955
|
+
# Declaration { user: :name } or { user: [:name, :age, { address: ... }] }.
|
956
|
+
params[key] = each_element(value) do |element|
|
957
|
+
element.permit(*Array.wrap(filter[key]))
|
958
|
+
end
|
959
|
+
end
|
960
|
+
end
|
961
|
+
end
|
962
|
+
|
963
|
+
def permit_any_in_parameters(params)
|
964
|
+
self.class.new.tap do |sanitized|
|
965
|
+
params.each do |key, value|
|
966
|
+
case value
|
967
|
+
when ->(v) { permitted_scalar?(v) }
|
968
|
+
sanitized[key] = value
|
969
|
+
when Array
|
970
|
+
sanitized[key] = permit_any_in_array(value)
|
971
|
+
when Parameters
|
972
|
+
sanitized[key] = permit_any_in_parameters(value)
|
973
|
+
else
|
974
|
+
# Filter this one out.
|
975
|
+
end
|
976
|
+
end
|
977
|
+
end
|
978
|
+
end
|
979
|
+
|
980
|
+
def permit_any_in_array(array)
|
981
|
+
[].tap do |sanitized|
|
982
|
+
array.each do |element|
|
983
|
+
case element
|
984
|
+
when ->(e) { permitted_scalar?(e) }
|
985
|
+
sanitized << element
|
986
|
+
when Parameters
|
987
|
+
sanitized << permit_any_in_parameters(element)
|
988
|
+
else
|
989
|
+
# Filter this one out.
|
990
|
+
end
|
991
|
+
end
|
992
|
+
end
|
993
|
+
end
|
994
|
+
|
995
|
+
def initialize_copy(source)
|
996
|
+
super
|
997
|
+
@parameters = @parameters.dup
|
998
|
+
end
|
999
|
+
end
|
1000
|
+
|
1001
|
+
# == Strong \Parameters
|
1002
|
+
#
|
1003
|
+
# It provides an interface for protecting attributes from end-user
|
1004
|
+
# assignment. This makes Action Controller parameters forbidden
|
1005
|
+
# to be used in Active Model mass assignment until they have been
|
1006
|
+
# whitelisted.
|
1007
|
+
#
|
1008
|
+
# In addition, parameters can be marked as required and flow through a
|
1009
|
+
# predefined raise/rescue flow to end up as a <tt>400 Bad Request</tt> with no
|
1010
|
+
# effort.
|
1011
|
+
#
|
1012
|
+
# class PeopleController < ActionController::Base
|
1013
|
+
# # Using "Person.create(params[:person])" would raise an
|
1014
|
+
# # ActiveModel::ForbiddenAttributesError exception because it'd
|
1015
|
+
# # be using mass assignment without an explicit permit step.
|
1016
|
+
# # This is the recommended form:
|
1017
|
+
# def create
|
1018
|
+
# Person.create(person_params)
|
1019
|
+
# end
|
1020
|
+
#
|
1021
|
+
# # This will pass with flying colors as long as there's a person key in the
|
1022
|
+
# # parameters, otherwise it'll raise an ActionController::ParameterMissing
|
1023
|
+
# # exception, which will get caught by ActionController::Base and turned
|
1024
|
+
# # into a 400 Bad Request reply.
|
1025
|
+
# def update
|
1026
|
+
# redirect_to current_account.people.find(params[:id]).tap { |person|
|
1027
|
+
# person.update!(person_params)
|
1028
|
+
# }
|
1029
|
+
# end
|
1030
|
+
#
|
1031
|
+
# private
|
1032
|
+
# # Using a private method to encapsulate the permissible parameters is
|
1033
|
+
# # a good pattern since you'll be able to reuse the same permit
|
1034
|
+
# # list between create and update. Also, you can specialize this method
|
1035
|
+
# # with per-user checking of permissible attributes.
|
1036
|
+
# def person_params
|
1037
|
+
# params.require(:person).permit(:name, :age)
|
1038
|
+
# end
|
1039
|
+
# end
|
1040
|
+
#
|
1041
|
+
# In order to use <tt>accepts_nested_attributes_for</tt> with Strong \Parameters, you
|
1042
|
+
# will need to specify which nested attributes should be whitelisted. You might want
|
1043
|
+
# to allow +:id+ and +:_destroy+, see ActiveRecord::NestedAttributes for more information.
|
1044
|
+
#
|
1045
|
+
# class Person
|
1046
|
+
# has_many :pets
|
1047
|
+
# accepts_nested_attributes_for :pets
|
1048
|
+
# end
|
1049
|
+
#
|
1050
|
+
# class PeopleController < ActionController::Base
|
1051
|
+
# def create
|
1052
|
+
# Person.create(person_params)
|
1053
|
+
# end
|
1054
|
+
#
|
1055
|
+
# ...
|
1056
|
+
#
|
1057
|
+
# private
|
1058
|
+
#
|
1059
|
+
# def person_params
|
1060
|
+
# # It's mandatory to specify the nested attributes that should be whitelisted.
|
1061
|
+
# # If you use `permit` with just the key that points to the nested attributes hash,
|
1062
|
+
# # it will return an empty hash.
|
1063
|
+
# params.require(:person).permit(:name, :age, pets_attributes: [ :id, :name, :category ])
|
1064
|
+
# end
|
1065
|
+
# end
|
1066
|
+
#
|
1067
|
+
# See ActionController::Parameters.require and ActionController::Parameters.permit
|
1068
|
+
# for more information.
|
1069
|
+
module StrongParameters
|
1070
|
+
extend ActiveSupport::Concern
|
1071
|
+
include ActiveSupport::Rescuable
|
1072
|
+
|
1073
|
+
# Returns a new ActionController::Parameters object that
|
1074
|
+
# has been instantiated with the <tt>request.parameters</tt>.
|
1075
|
+
def params
|
1076
|
+
@_params ||= Parameters.new(request.parameters)
|
1077
|
+
end
|
1078
|
+
|
1079
|
+
# Assigns the given +value+ to the +params+ hash. If +value+
|
1080
|
+
# is a Hash, this will create an ActionController::Parameters
|
1081
|
+
# object that has been instantiated with the given +value+ hash.
|
1082
|
+
def params=(value)
|
1083
|
+
@_params = value.is_a?(Hash) ? Parameters.new(value) : value
|
1084
|
+
end
|
1085
|
+
end
|
1086
|
+
end
|