radiant 0.6.4 → 0.6.5
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of radiant might be problematic. Click here for more details.
- data/CHANGELOG +188 -35
- data/CONTRIBUTORS +25 -2
- data/INSTALL +1 -1
- data/app/controllers/admin/abstract_model_controller.rb +13 -13
- data/app/controllers/admin/export_controller.rb +1 -2
- data/app/controllers/admin/extension_controller.rb +0 -5
- data/app/controllers/admin/page_controller.rb +2 -0
- data/app/controllers/application.rb +1 -1
- data/app/controllers/site_controller.rb +8 -1
- data/app/helpers/admin/node_helper.rb +21 -18
- data/app/helpers/application_helper.rb +4 -13
- data/app/models/layout.rb +2 -2
- data/app/models/page.rb +25 -21
- data/app/models/page_context.rb +3 -5
- data/app/models/response_cache.rb +19 -27
- data/app/models/snippet.rb +2 -2
- data/app/models/standard_tags.rb +148 -26
- data/app/models/user.rb +2 -2
- data/app/views/admin/extension/index.html.erb +40 -0
- data/app/views/admin/layout/edit.html.erb +39 -0
- data/app/views/admin/layout/{index.rhtml → index.html.erb} +0 -0
- data/app/views/admin/layout/{remove.rhtml → remove.html.erb} +0 -0
- data/app/views/admin/page/_meta_row.html.erb +4 -0
- data/app/views/admin/page/{_node.rhtml → _node.html.erb} +0 -0
- data/app/views/admin/page/{_part.rhtml → _part.html.erb} +0 -0
- data/app/views/admin/page/_tag_reference.html.erb +4 -0
- data/app/views/admin/page/{children.rhtml → children.html.erb} +0 -0
- data/app/views/admin/page/edit.html.erb +140 -0
- data/app/views/admin/page/index.html.erb +31 -0
- data/app/views/admin/page/{remove.rhtml → remove.html.erb} +0 -0
- data/app/views/admin/snippet/{edit.rhtml → edit.html.erb} +0 -0
- data/app/views/admin/snippet/{index.rhtml → index.html.erb} +0 -0
- data/app/views/admin/snippet/{remove.rhtml → remove.html.erb} +0 -0
- data/app/views/admin/user/edit.html.erb +54 -0
- data/app/views/admin/user/{index.rhtml → index.html.erb} +0 -0
- data/app/views/admin/user/preferences.html.erb +29 -0
- data/app/views/admin/user/{remove.rhtml → remove.html.erb} +0 -0
- data/app/views/admin/welcome/{login.rhtml → login.html.erb} +0 -0
- data/app/views/layouts/{application.rhtml → application.html.erb} +0 -0
- data/app/views/site/{not_found.rhtml → not_found.html.erb} +0 -0
- data/bin/radiant +0 -0
- data/config/boot.rb +136 -26
- data/config/environment.rb +61 -53
- data/config/environments/development.rb +2 -3
- data/config/environments/test.rb +14 -7
- data/db/migrate/015_add_optimistic_locking.rb +6 -6
- data/db/migrate/017_rename_created_by_updated_by_columns.rb +15 -0
- data/db/migrate/018_add_description_and_keywords_to_pages.rb +11 -0
- data/db/schema.rb +66 -59
- data/db/templates/styled-blog.yml +3 -3
- data/lib/annotatable.rb +16 -0
- data/lib/autotest/discover.rb +3 -0
- data/lib/autotest/radiant_rails_rspec.rb +111 -0
- data/lib/generators/extension/USAGE +16 -14
- data/lib/generators/extension/extension_generator.rb +29 -7
- data/lib/generators/extension/templates/RSpecRakefile +120 -0
- data/lib/generators/extension/templates/Rakefile +0 -0
- data/lib/generators/extension/templates/spec.opts +6 -0
- data/lib/generators/extension/templates/spec_helper.rb +37 -0
- data/lib/generators/extension/templates/test_helper.rb +9 -2
- data/lib/generators/extension_controller/USAGE +4 -2
- data/lib/generators/extension_controller/extension_controller_generator.rb +50 -0
- data/lib/generators/extension_controller/templates/controller_spec.rb +23 -0
- data/lib/generators/extension_controller/templates/helper_spec.rb +11 -0
- data/lib/generators/extension_controller/templates/view_spec.rb +12 -0
- data/lib/generators/extension_model/USAGE +3 -2
- data/lib/generators/extension_model/extension_model_generator.rb +34 -0
- data/lib/generators/extension_model/templates/model_spec.rb +11 -0
- data/lib/generators/instance/templates/instance_boot.rb +136 -33
- data/lib/generators/instance/templates/instance_environment.rb +85 -4
- data/lib/login_system.rb +16 -0
- data/lib/plugins/dependencies_fix/init.rb +5 -5
- data/lib/plugins/extension_patches/init.rb +0 -1
- data/lib/plugins/extension_patches/lib/fixture_loading_extension.rb +76 -75
- data/lib/plugins/extension_patches/lib/mailer_view_paths_extension.rb +19 -14
- data/lib/plugins/string_extensions/lib/string_extensions.rb +4 -0
- data/lib/plugins/symbol_extensions/init.rb +1 -0
- data/lib/plugins/symbol_extensions/lib/symbol_extensions.rb +7 -0
- data/lib/radiant.rb +2 -8
- data/lib/radiant/extension.rb +11 -43
- data/lib/radiant/extension_loader.rb +144 -135
- data/lib/radiant/initializer.rb +126 -33
- data/lib/radiant/setup.rb +1 -0
- data/lib/tasks/database.rake +44 -3
- data/lib/tasks/extensions.rake +29 -11
- data/lib/tasks/framework.rake +20 -6
- data/lib/tasks/instance.rake +5 -2
- data/lib/tasks/release.rake +1 -0
- data/public/dispatch.cgi +0 -0
- data/public/dispatch.fcgi +0 -0
- data/public/dispatch.rb +0 -0
- data/public/images/admin/brown-bottom-line.gif +0 -0
- data/public/images/admin/view-site.gif +0 -0
- data/public/javascripts/admin/admin.js +142 -0
- data/public/javascripts/{ruledtable.js → admin/ruledtable.js} +0 -0
- data/public/javascripts/admin/sitemap.js +131 -0
- data/public/javascripts/admin/tabcontrol.js +127 -0
- data/public/javascripts/pngfix.js +1 -1
- data/public/stylesheets/admin/main.css +11 -6
- data/script/about +0 -0
- data/script/breakpointer +0 -0
- data/script/console +0 -0
- data/script/destroy +0 -0
- data/script/generate +0 -0
- data/script/performance/benchmarker +0 -0
- data/script/performance/profiler +0 -0
- data/script/plugin +0 -0
- data/script/process/inspector +0 -0
- data/script/process/reaper +0 -0
- data/script/process/spawner +0 -0
- data/script/process/spinner +0 -0
- data/script/runner +0 -0
- data/script/server +0 -0
- data/script/spec +12 -0
- data/script/spec_server +99 -0
- data/script/version +0 -0
- data/spec/controllers/admin/abstract_model_controller_spec.rb +263 -0
- data/spec/controllers/admin/export_controller_spec.rb +16 -0
- data/spec/controllers/admin/extension_controller_spec.rb +21 -0
- data/spec/controllers/admin/layout_controller_spec.rb +42 -0
- data/spec/controllers/admin/page_controller_spec.rb +312 -0
- data/spec/controllers/admin/snippet_controller_spec.rb +27 -0
- data/spec/controllers/admin/user_controller_spec.rb +72 -0
- data/spec/controllers/admin/welcome_controller_spec.rb +37 -0
- data/spec/controllers/application_controller_spec.rb +41 -0
- data/spec/controllers/site_controller_spec.rb +109 -0
- data/spec/fixtures/sample.txt +1 -0
- data/spec/helpers/admin/abstract_model_helper_spec.rb +4 -0
- data/spec/helpers/admin/export_helper_spec.rb +4 -0
- data/spec/helpers/admin/extension_helper_spec.rb +4 -0
- data/spec/helpers/admin/layout_helper_spec.rb +4 -0
- data/spec/helpers/admin/node_helper_spec.rb +97 -0
- data/spec/helpers/admin/page_helper_spec.rb +41 -0
- data/spec/helpers/admin/snippet_helper_spec.rb +4 -0
- data/spec/helpers/admin/user_helper_spec.rb +4 -0
- data/spec/helpers/admin/welcome_helper_spec.rb +4 -0
- data/spec/helpers/application_helper_spec.rb +166 -0
- data/spec/helpers/site_helper_spec.rb +4 -0
- data/spec/lib/annotatable_spec.rb +86 -0
- data/spec/lib/autotest_spec.rb +81 -0
- data/spec/lib/inheritable_class_attributes_spec.rb +90 -0
- data/spec/lib/local_time_spec.rb +40 -0
- data/spec/lib/login_system_spec.rb +142 -0
- data/spec/lib/method_observer_spec.rb +48 -0
- data/spec/lib/radiant/admin_ui_spec.rb +133 -0
- data/spec/lib/radiant/extension_loader_spec.rb +179 -0
- data/spec/lib/radiant/extension_migrator_spec.rb +17 -0
- data/spec/lib/radiant/extension_spec.rb +69 -0
- data/spec/lib/radiant/initializer_spec.rb +80 -0
- data/spec/lib/radiant/taggable_spec.rb +150 -0
- data/spec/lib/radiant_spec.rb +26 -0
- data/spec/lib/simpleton_spec.rb +45 -0
- data/spec/matchers/login_system_matcher.rb +79 -0
- data/spec/matchers/render_matcher.rb +115 -0
- data/spec/models/env_dump_page_spec.rb +18 -0
- data/spec/models/file_not_found_page_spec.rb +31 -0
- data/spec/models/layout_spec.rb +29 -0
- data/spec/models/page_context_spec.rb +68 -0
- data/spec/models/page_part_spec.rb +47 -0
- data/spec/models/page_spec.rb +500 -0
- data/spec/models/radiant/config_spec.rb +57 -0
- data/spec/models/radiant/exporter_spec.rb +25 -0
- data/spec/models/response_cache_spec.rb +259 -0
- data/spec/models/snippet_spec.rb +41 -0
- data/spec/models/standard_tags_spec.rb +774 -0
- data/spec/models/status_spec.rb +53 -0
- data/spec/models/text_filter_spec.rb +40 -0
- data/spec/models/user_action_observer_spec.rb +34 -0
- data/spec/models/user_spec.rb +135 -0
- data/spec/rcov.opts +2 -0
- data/spec/scenarios/file_not_found_scenario.rb +13 -0
- data/spec/scenarios/home_page_scenario.rb +64 -0
- data/spec/scenarios/layouts_scenario.rb +58 -0
- data/spec/scenarios/markup_pages_scenario.rb +13 -0
- data/spec/scenarios/pages_scenario.rb +50 -0
- data/spec/scenarios/pages_with_layouts_scenario.rb +10 -0
- data/spec/scenarios/snippets_scenario.rb +34 -0
- data/spec/scenarios/users_and_pages_scenario.rb +9 -0
- data/spec/scenarios/users_scenario.rb +43 -0
- data/spec/spec.opts +3 -0
- data/spec/spec_helper.rb +64 -0
- data/stories/all.rb +4 -0
- data/stories/helper.rb +3 -0
- data/test/fixtures/extensions/01_basic/app/views/basic_extension/{index.rhtml → index.html.erb} +0 -0
- data/test/fixtures/extensions/01_basic/app/views/basic_extension/{override.rhtml → override.html.erb} +0 -0
- data/test/fixtures/extensions/01_basic/app/views/basic_extension_mailer/{message.rhtml → message.text.html.erb} +0 -0
- data/test/fixtures/extensions/02_overriding/app/views/basic_extension/{override.rhtml → override.html.erb} +0 -0
- data/test/fixtures/page_parts.yml +6 -1
- data/test/fixtures/pages.yml +33 -19
- data/test/helpers/caching_test_helper.rb +39 -38
- data/test/helpers/extension_fixture_test_helper.rb +39 -39
- data/test/helpers/extension_tag_test_helper.rb +16 -16
- data/test/helpers/logging_test_helper.rb +10 -0
- data/test/helpers/render_test_helper.rb +3 -3
- data/test/helpers/validation_test_helper.rb +42 -42
- data/test/test_helper.rb +6 -4
- data/vendor/extensions/archive/Rakefile +105 -10
- data/vendor/extensions/archive/app/models/archive_day_index_page.rb +0 -0
- data/vendor/extensions/archive/app/models/archive_month_index_page.rb +0 -0
- data/vendor/extensions/archive/app/models/archive_page.rb +0 -0
- data/vendor/extensions/archive/app/models/archive_year_index_page.rb +0 -0
- data/vendor/extensions/archive/lib/archive_index_tags_and_methods.rb +0 -0
- data/vendor/extensions/archive/spec/models/archive_day_index_page_spec.rb +20 -0
- data/vendor/extensions/archive/spec/models/archive_month_index_page_spec.rb +20 -0
- data/vendor/extensions/archive/spec/models/archive_page_spec.rb +33 -0
- data/vendor/extensions/archive/spec/models/archive_year_index_page_spec.rb +20 -0
- data/vendor/extensions/archive/spec/scenarios/archive_scenario.rb +51 -0
- data/vendor/extensions/archive/spec/spec.opts +6 -0
- data/vendor/extensions/archive/spec/spec_helper.rb +37 -0
- data/vendor/extensions/archive/test/functional/archive_extension_test.rb +1 -1
- data/vendor/extensions/archive/test/helpers/archive_index_test_helper.rb +0 -0
- data/vendor/extensions/archive/test/test_helper.rb +11 -4
- data/vendor/extensions/archive/test/unit/archive_day_index_page_test.rb +0 -0
- data/vendor/extensions/archive/test/unit/archive_month_index_page_test.rb +0 -0
- data/vendor/extensions/archive/test/unit/archive_page_test.rb +0 -0
- data/vendor/extensions/archive/test/unit/archive_year_index_page_test.rb +0 -0
- data/vendor/extensions/markdown_filter/Rakefile +105 -10
- data/vendor/extensions/markdown_filter/lib/tasks/markdown_filter_extension_tasks.rake +28 -0
- data/vendor/extensions/markdown_filter/spec/models/markdown_filter_spec.rb +15 -0
- data/vendor/extensions/markdown_filter/spec/models/smarty_pants_filter_spec.rb +12 -0
- data/vendor/extensions/markdown_filter/spec/spec.opts +6 -0
- data/vendor/extensions/markdown_filter/spec/spec_helper.rb +37 -0
- data/vendor/extensions/markdown_filter/test/test_helper.rb +11 -2
- data/vendor/extensions/textile_filter/Rakefile +105 -10
- data/vendor/extensions/textile_filter/spec/models/textile_filter_spec.rb +11 -0
- data/vendor/extensions/textile_filter/spec/spec.opts +6 -0
- data/vendor/extensions/textile_filter/spec/spec_helper.rb +37 -0
- data/vendor/extensions/textile_filter/test/test_helper.rb +11 -2
- data/vendor/plugins/acts_as_tree/README +26 -0
- data/vendor/plugins/acts_as_tree/Rakefile +22 -0
- data/vendor/plugins/acts_as_tree/init.rb +1 -0
- data/vendor/plugins/acts_as_tree/lib/active_record/acts/tree.rb +96 -0
- data/vendor/plugins/acts_as_tree/test/abstract_unit.rb +0 -0
- data/vendor/plugins/acts_as_tree/test/acts_as_tree_test.rb +219 -0
- data/vendor/plugins/acts_as_tree/test/database.yml +0 -0
- data/vendor/plugins/acts_as_tree/test/fixtures/mixin.rb +0 -0
- data/vendor/plugins/acts_as_tree/test/fixtures/mixins.yml +0 -0
- data/vendor/plugins/acts_as_tree/test/schema.rb +0 -0
- data/vendor/plugins/rspec/CHANGES +1079 -0
- data/vendor/plugins/rspec/MIT-LICENSE +20 -0
- data/vendor/plugins/rspec/README +71 -0
- data/vendor/plugins/rspec/Rakefile +279 -0
- data/vendor/plugins/rspec/TODO +2 -0
- data/vendor/plugins/rspec/UPGRADE +31 -0
- data/vendor/plugins/rspec/bin/spec +4 -0
- data/vendor/plugins/rspec/bin/spec_translator +8 -0
- data/vendor/plugins/rspec/examples/pure/autogenerated_docstrings_example.rb +19 -0
- data/vendor/plugins/rspec/examples/pure/before_and_after_example.rb +40 -0
- data/vendor/plugins/rspec/examples/pure/behave_as_example.rb +45 -0
- data/vendor/plugins/rspec/examples/pure/custom_expectation_matchers.rb +54 -0
- data/vendor/plugins/rspec/examples/pure/custom_formatter.rb +12 -0
- data/vendor/plugins/rspec/examples/pure/dynamic_spec.rb +9 -0
- data/vendor/plugins/rspec/examples/pure/file_accessor.rb +19 -0
- data/vendor/plugins/rspec/examples/pure/file_accessor_spec.rb +38 -0
- data/vendor/plugins/rspec/examples/pure/greeter_spec.rb +31 -0
- data/vendor/plugins/rspec/examples/pure/helper_method_example.rb +14 -0
- data/vendor/plugins/rspec/examples/pure/io_processor.rb +8 -0
- data/vendor/plugins/rspec/examples/pure/io_processor_spec.rb +21 -0
- data/vendor/plugins/rspec/examples/pure/legacy_spec.rb +11 -0
- data/vendor/plugins/rspec/examples/pure/mocking_example.rb +27 -0
- data/vendor/plugins/rspec/examples/pure/multi_threaded_behaviour_runner.rb +28 -0
- data/vendor/plugins/rspec/examples/pure/nested_classes_example.rb +36 -0
- data/vendor/plugins/rspec/examples/pure/partial_mock_example.rb +28 -0
- data/vendor/plugins/rspec/examples/pure/pending_example.rb +20 -0
- data/vendor/plugins/rspec/examples/pure/predicate_example.rb +27 -0
- data/vendor/plugins/rspec/examples/pure/priority.txt +1 -0
- data/vendor/plugins/rspec/examples/pure/shared_example_group_example.rb +81 -0
- data/vendor/plugins/rspec/examples/pure/shared_stack_examples.rb +38 -0
- data/vendor/plugins/rspec/examples/pure/spec_helper.rb +3 -0
- data/vendor/plugins/rspec/examples/pure/stack.rb +36 -0
- data/vendor/plugins/rspec/examples/pure/stack_spec.rb +63 -0
- data/vendor/plugins/rspec/examples/pure/stack_spec_with_nested_example_groups.rb +67 -0
- data/vendor/plugins/rspec/examples/pure/stubbing_example.rb +69 -0
- data/vendor/plugins/rspec/examples/stories/adder.rb +13 -0
- data/vendor/plugins/rspec/examples/stories/addition +34 -0
- data/vendor/plugins/rspec/examples/stories/addition.rb +9 -0
- data/vendor/plugins/rspec/examples/stories/calculator.rb +65 -0
- data/vendor/plugins/rspec/examples/stories/game-of-life/README.txt +21 -0
- data/vendor/plugins/rspec/examples/stories/game-of-life/behaviour/everything.rb +6 -0
- data/vendor/plugins/rspec/examples/stories/game-of-life/behaviour/examples/examples.rb +3 -0
- data/vendor/plugins/rspec/examples/stories/game-of-life/behaviour/examples/game_behaviour.rb +35 -0
- data/vendor/plugins/rspec/examples/stories/game-of-life/behaviour/examples/grid_behaviour.rb +66 -0
- data/vendor/plugins/rspec/examples/stories/game-of-life/behaviour/stories/CellsWithLessThanTwoNeighboursDie.story +21 -0
- data/vendor/plugins/rspec/examples/stories/game-of-life/behaviour/stories/CellsWithMoreThanThreeNeighboursDie.story +21 -0
- data/vendor/plugins/rspec/examples/stories/game-of-life/behaviour/stories/EmptySpacesWithThreeNeighboursCreateACell.story +42 -0
- data/vendor/plugins/rspec/examples/stories/game-of-life/behaviour/stories/ICanCreateACell.story +42 -0
- data/vendor/plugins/rspec/examples/stories/game-of-life/behaviour/stories/ICanKillACell.story +17 -0
- data/vendor/plugins/rspec/examples/stories/game-of-life/behaviour/stories/TheGridWraps.story +53 -0
- data/vendor/plugins/rspec/examples/stories/game-of-life/behaviour/stories/create_a_cell.rb +52 -0
- data/vendor/plugins/rspec/examples/stories/game-of-life/behaviour/stories/helper.rb +6 -0
- data/vendor/plugins/rspec/examples/stories/game-of-life/behaviour/stories/kill_a_cell.rb +26 -0
- data/vendor/plugins/rspec/examples/stories/game-of-life/behaviour/stories/steps.rb +5 -0
- data/vendor/plugins/rspec/examples/stories/game-of-life/behaviour/stories/stories.rb +3 -0
- data/vendor/plugins/rspec/examples/stories/game-of-life/behaviour/stories/stories.txt +22 -0
- data/vendor/plugins/rspec/examples/stories/game-of-life/life.rb +3 -0
- data/vendor/plugins/rspec/examples/stories/game-of-life/life/game.rb +23 -0
- data/vendor/plugins/rspec/examples/stories/game-of-life/life/grid.rb +43 -0
- data/vendor/plugins/rspec/examples/stories/helper.rb +9 -0
- data/vendor/plugins/rspec/examples/stories/steps/addition_steps.rb +18 -0
- data/vendor/plugins/rspec/failing_examples/README.txt +7 -0
- data/vendor/plugins/rspec/failing_examples/diffing_spec.rb +36 -0
- data/vendor/plugins/rspec/failing_examples/failing_autogenerated_docstrings_example.rb +19 -0
- data/vendor/plugins/rspec/failing_examples/failure_in_setup.rb +10 -0
- data/vendor/plugins/rspec/failing_examples/failure_in_teardown.rb +10 -0
- data/vendor/plugins/rspec/failing_examples/mocking_example.rb +40 -0
- data/vendor/plugins/rspec/failing_examples/mocking_with_flexmock.rb +26 -0
- data/vendor/plugins/rspec/failing_examples/mocking_with_mocha.rb +25 -0
- data/vendor/plugins/rspec/failing_examples/mocking_with_rr.rb +27 -0
- data/vendor/plugins/rspec/failing_examples/partial_mock_example.rb +20 -0
- data/vendor/plugins/rspec/failing_examples/predicate_example.rb +29 -0
- data/vendor/plugins/rspec/failing_examples/raising_example.rb +47 -0
- data/vendor/plugins/rspec/failing_examples/spec_helper.rb +3 -0
- data/vendor/plugins/rspec/failing_examples/syntax_error_example.rb +7 -0
- data/vendor/plugins/rspec/failing_examples/team_spec.rb +44 -0
- data/vendor/plugins/rspec/failing_examples/timeout_behaviour.rb +7 -0
- data/vendor/plugins/rspec/init.rb +9 -0
- data/vendor/plugins/rspec/lib/autotest/discover.rb +3 -0
- data/vendor/plugins/rspec/lib/autotest/rspec.rb +72 -0
- data/vendor/plugins/rspec/lib/spec.rb +30 -0
- data/vendor/plugins/rspec/lib/spec/example.rb +12 -0
- data/vendor/plugins/rspec/lib/spec/example/configuration.rb +144 -0
- data/vendor/plugins/rspec/lib/spec/example/errors.rb +9 -0
- data/vendor/plugins/rspec/lib/spec/example/example_group.rb +16 -0
- data/vendor/plugins/rspec/lib/spec/example/example_group_factory.rb +58 -0
- data/vendor/plugins/rspec/lib/spec/example/example_group_methods.rb +433 -0
- data/vendor/plugins/rspec/lib/spec/example/example_matcher.rb +42 -0
- data/vendor/plugins/rspec/lib/spec/example/example_methods.rb +110 -0
- data/vendor/plugins/rspec/lib/spec/example/module_reopening_fix.rb +21 -0
- data/vendor/plugins/rspec/lib/spec/example/pending.rb +18 -0
- data/vendor/plugins/rspec/lib/spec/example/shared_example_group.rb +58 -0
- data/vendor/plugins/rspec/lib/spec/expectations.rb +56 -0
- data/vendor/plugins/rspec/lib/spec/expectations/differs/default.rb +66 -0
- data/vendor/plugins/rspec/lib/spec/expectations/errors.rb +12 -0
- data/vendor/plugins/rspec/lib/spec/expectations/extensions.rb +2 -0
- data/vendor/plugins/rspec/lib/spec/expectations/extensions/object.rb +71 -0
- data/vendor/plugins/rspec/lib/spec/expectations/extensions/string_and_symbol.rb +17 -0
- data/vendor/plugins/rspec/lib/spec/expectations/handler.rb +52 -0
- data/vendor/plugins/rspec/lib/spec/extensions.rb +4 -0
- data/vendor/plugins/rspec/lib/spec/extensions/class.rb +24 -0
- data/vendor/plugins/rspec/lib/spec/extensions/main.rb +102 -0
- data/vendor/plugins/rspec/lib/spec/extensions/metaclass.rb +7 -0
- data/vendor/plugins/rspec/lib/spec/extensions/object.rb +6 -0
- data/vendor/plugins/rspec/lib/spec/interop/test.rb +12 -0
- data/vendor/plugins/rspec/lib/spec/interop/test/unit/autorunner.rb +6 -0
- data/vendor/plugins/rspec/lib/spec/interop/test/unit/testcase.rb +61 -0
- data/vendor/plugins/rspec/lib/spec/interop/test/unit/testresult.rb +6 -0
- data/vendor/plugins/rspec/lib/spec/interop/test/unit/testsuite_adapter.rb +34 -0
- data/vendor/plugins/rspec/lib/spec/interop/test/unit/ui/console/testrunner.rb +61 -0
- data/vendor/plugins/rspec/lib/spec/matchers.rb +156 -0
- data/vendor/plugins/rspec/lib/spec/matchers/be.rb +224 -0
- data/vendor/plugins/rspec/lib/spec/matchers/be_close.rb +37 -0
- data/vendor/plugins/rspec/lib/spec/matchers/change.rb +144 -0
- data/vendor/plugins/rspec/lib/spec/matchers/eql.rb +43 -0
- data/vendor/plugins/rspec/lib/spec/matchers/equal.rb +43 -0
- data/vendor/plugins/rspec/lib/spec/matchers/exist.rb +17 -0
- data/vendor/plugins/rspec/lib/spec/matchers/has.rb +34 -0
- data/vendor/plugins/rspec/lib/spec/matchers/have.rb +145 -0
- data/vendor/plugins/rspec/lib/spec/matchers/include.rb +70 -0
- data/vendor/plugins/rspec/lib/spec/matchers/match.rb +41 -0
- data/vendor/plugins/rspec/lib/spec/matchers/operator_matcher.rb +73 -0
- data/vendor/plugins/rspec/lib/spec/matchers/raise_error.rb +132 -0
- data/vendor/plugins/rspec/lib/spec/matchers/respond_to.rb +45 -0
- data/vendor/plugins/rspec/lib/spec/matchers/satisfy.rb +47 -0
- data/vendor/plugins/rspec/lib/spec/matchers/simple_matcher.rb +29 -0
- data/vendor/plugins/rspec/lib/spec/matchers/throw_symbol.rb +74 -0
- data/vendor/plugins/rspec/lib/spec/mocks.rb +211 -0
- data/vendor/plugins/rspec/lib/spec/mocks/argument_constraint_matchers.rb +31 -0
- data/vendor/plugins/rspec/lib/spec/mocks/argument_constraint_matchers.rb.orig +27 -0
- data/vendor/plugins/rspec/lib/spec/mocks/argument_expectation.rb +209 -0
- data/vendor/plugins/rspec/lib/spec/mocks/error_generator.rb +84 -0
- data/vendor/plugins/rspec/lib/spec/mocks/errors.rb +10 -0
- data/vendor/plugins/rspec/lib/spec/mocks/extensions/object.rb +3 -0
- data/vendor/plugins/rspec/lib/spec/mocks/message_expectation.rb +269 -0
- data/vendor/plugins/rspec/lib/spec/mocks/methods.rb +39 -0
- data/vendor/plugins/rspec/lib/spec/mocks/mock.rb +50 -0
- data/vendor/plugins/rspec/lib/spec/mocks/order_group.rb +29 -0
- data/vendor/plugins/rspec/lib/spec/mocks/proxy.rb +166 -0
- data/vendor/plugins/rspec/lib/spec/mocks/space.rb +28 -0
- data/vendor/plugins/rspec/lib/spec/mocks/spec_methods.rb +38 -0
- data/vendor/plugins/rspec/lib/spec/rake/spectask.rb +235 -0
- data/vendor/plugins/rspec/lib/spec/rake/verify_rcov.rb +52 -0
- data/vendor/plugins/rspec/lib/spec/runner.rb +202 -0
- data/vendor/plugins/rspec/lib/spec/runner/backtrace_tweaker.rb +57 -0
- data/vendor/plugins/rspec/lib/spec/runner/class_and_arguments_parser.rb +16 -0
- data/vendor/plugins/rspec/lib/spec/runner/command_line.rb +28 -0
- data/vendor/plugins/rspec/lib/spec/runner/drb_command_line.rb +20 -0
- data/vendor/plugins/rspec/lib/spec/runner/example_group_runner.rb +59 -0
- data/vendor/plugins/rspec/lib/spec/runner/formatter/base_formatter.rb +77 -0
- data/vendor/plugins/rspec/lib/spec/runner/formatter/base_text_formatter.rb +130 -0
- data/vendor/plugins/rspec/lib/spec/runner/formatter/failing_example_groups_formatter.rb +33 -0
- data/vendor/plugins/rspec/lib/spec/runner/formatter/failing_examples_formatter.rb +20 -0
- data/vendor/plugins/rspec/lib/spec/runner/formatter/html_formatter.rb +333 -0
- data/vendor/plugins/rspec/lib/spec/runner/formatter/profile_formatter.rb +47 -0
- data/vendor/plugins/rspec/lib/spec/runner/formatter/progress_bar_formatter.rb +30 -0
- data/vendor/plugins/rspec/lib/spec/runner/formatter/snippet_extractor.rb +52 -0
- data/vendor/plugins/rspec/lib/spec/runner/formatter/specdoc_formatter.rb +39 -0
- data/vendor/plugins/rspec/lib/spec/runner/formatter/story/html_formatter.rb +128 -0
- data/vendor/plugins/rspec/lib/spec/runner/formatter/story/plain_text_formatter.rb +131 -0
- data/vendor/plugins/rspec/lib/spec/runner/formatter/text_mate_formatter.rb +16 -0
- data/vendor/plugins/rspec/lib/spec/runner/heckle_runner.rb +72 -0
- data/vendor/plugins/rspec/lib/spec/runner/heckle_runner_unsupported.rb +10 -0
- data/vendor/plugins/rspec/lib/spec/runner/option_parser.rb +205 -0
- data/vendor/plugins/rspec/lib/spec/runner/options.rb +288 -0
- data/vendor/plugins/rspec/lib/spec/runner/reporter.rb +147 -0
- data/vendor/plugins/rspec/lib/spec/runner/spec_parser.rb +71 -0
- data/vendor/plugins/rspec/lib/spec/story.rb +10 -0
- data/vendor/plugins/rspec/lib/spec/story/extensions.rb +3 -0
- data/vendor/plugins/rspec/lib/spec/story/extensions/main.rb +86 -0
- data/vendor/plugins/rspec/lib/spec/story/extensions/regexp.rb +9 -0
- data/vendor/plugins/rspec/lib/spec/story/extensions/string.rb +9 -0
- data/vendor/plugins/rspec/lib/spec/story/given_scenario.rb +14 -0
- data/vendor/plugins/rspec/lib/spec/story/runner.rb +56 -0
- data/vendor/plugins/rspec/lib/spec/story/runner/plain_text_story_runner.rb +48 -0
- data/vendor/plugins/rspec/lib/spec/story/runner/scenario_collector.rb +18 -0
- data/vendor/plugins/rspec/lib/spec/story/runner/scenario_runner.rb +48 -0
- data/vendor/plugins/rspec/lib/spec/story/runner/story_mediator.rb +123 -0
- data/vendor/plugins/rspec/lib/spec/story/runner/story_parser.rb +227 -0
- data/vendor/plugins/rspec/lib/spec/story/runner/story_runner.rb +70 -0
- data/vendor/plugins/rspec/lib/spec/story/scenario.rb +14 -0
- data/vendor/plugins/rspec/lib/spec/story/step.rb +58 -0
- data/vendor/plugins/rspec/lib/spec/story/step_group.rb +89 -0
- data/vendor/plugins/rspec/lib/spec/story/step_mother.rb +37 -0
- data/vendor/plugins/rspec/lib/spec/story/story.rb +39 -0
- data/vendor/plugins/rspec/lib/spec/story/world.rb +124 -0
- data/vendor/plugins/rspec/lib/spec/translator.rb +114 -0
- data/vendor/plugins/rspec/lib/spec/version.rb +22 -0
- data/vendor/plugins/rspec/plugins/mock_frameworks/flexmock.rb +23 -0
- data/vendor/plugins/rspec/plugins/mock_frameworks/mocha.rb +19 -0
- data/vendor/plugins/rspec/plugins/mock_frameworks/rr.rb +21 -0
- data/vendor/plugins/rspec/plugins/mock_frameworks/rspec.rb +18 -0
- data/vendor/plugins/rspec/pre_commit/lib/pre_commit.rb +4 -0
- data/vendor/plugins/rspec/pre_commit/lib/pre_commit/core.rb +50 -0
- data/vendor/plugins/rspec/pre_commit/lib/pre_commit/pre_commit.rb +54 -0
- data/vendor/plugins/rspec/pre_commit/lib/pre_commit/rspec.rb +111 -0
- data/vendor/plugins/rspec/pre_commit/lib/pre_commit/rspec_on_rails.rb +314 -0
- data/vendor/plugins/rspec/pre_commit/spec/pre_commit/pre_commit_spec.rb +15 -0
- data/vendor/plugins/rspec/pre_commit/spec/pre_commit/rspec_on_rails_spec.rb +51 -0
- data/vendor/plugins/rspec/pre_commit/spec/spec_helper.rb +3 -0
- data/vendor/plugins/rspec/pre_commit/spec/spec_suite.rb +11 -0
- data/vendor/plugins/rspec/rake_tasks/examples.rake +7 -0
- data/vendor/plugins/rspec/rake_tasks/examples_with_rcov.rake +9 -0
- data/vendor/plugins/rspec/rake_tasks/failing_examples_with_html.rake +9 -0
- data/vendor/plugins/rspec/rake_tasks/verify_rcov.rake +7 -0
- data/vendor/plugins/rspec/spec/README.jruby +15 -0
- data/vendor/plugins/rspec/spec/autotest/discover_spec.rb +19 -0
- data/vendor/plugins/rspec/spec/autotest/rspec_spec.rb +197 -0
- data/vendor/plugins/rspec/spec/autotest_helper.rb +6 -0
- data/vendor/plugins/rspec/spec/autotest_matchers.rb +47 -0
- data/vendor/plugins/rspec/spec/rspec_suite.rb +7 -0
- data/vendor/plugins/rspec/spec/ruby_forker.rb +13 -0
- data/vendor/plugins/rspec/spec/spec.opts +6 -0
- data/vendor/plugins/rspec/spec/spec/example/configuration_spec.rb +282 -0
- data/vendor/plugins/rspec/spec/spec/example/example_group_class_definition_spec.rb +48 -0
- data/vendor/plugins/rspec/spec/spec/example/example_group_factory_spec.rb +135 -0
- data/vendor/plugins/rspec/spec/spec/example/example_group_methods_spec.rb +523 -0
- data/vendor/plugins/rspec/spec/spec/example/example_group_spec.rb +711 -0
- data/vendor/plugins/rspec/spec/spec/example/example_matcher_spec.rb +96 -0
- data/vendor/plugins/rspec/spec/spec/example/example_methods_spec.rb +115 -0
- data/vendor/plugins/rspec/spec/spec/example/example_runner_spec.rb +194 -0
- data/vendor/plugins/rspec/spec/spec/example/example_spec.rb +53 -0
- data/vendor/plugins/rspec/spec/spec/example/nested_example_group_spec.rb +71 -0
- data/vendor/plugins/rspec/spec/spec/example/pending_module_spec.rb +31 -0
- data/vendor/plugins/rspec/spec/spec/example/predicate_matcher_spec.rb +21 -0
- data/vendor/plugins/rspec/spec/spec/example/shared_example_group_spec.rb +265 -0
- data/vendor/plugins/rspec/spec/spec/example/subclassing_example_group_spec.rb +25 -0
- data/vendor/plugins/rspec/spec/spec/expectations/differs/default_spec.rb +127 -0
- data/vendor/plugins/rspec/spec/spec/expectations/extensions/object_spec.rb +107 -0
- data/vendor/plugins/rspec/spec/spec/expectations/fail_with_spec.rb +71 -0
- data/vendor/plugins/rspec/spec/spec/extensions/main_spec.rb +76 -0
- data/vendor/plugins/rspec/spec/spec/interop/test/unit/resources/spec_that_fails.rb +10 -0
- data/vendor/plugins/rspec/spec/spec/interop/test/unit/resources/spec_that_passes.rb +10 -0
- data/vendor/plugins/rspec/spec/spec/interop/test/unit/resources/spec_with_errors.rb +10 -0
- data/vendor/plugins/rspec/spec/spec/interop/test/unit/resources/test_case_that_fails.rb +10 -0
- data/vendor/plugins/rspec/spec/spec/interop/test/unit/resources/test_case_that_passes.rb +10 -0
- data/vendor/plugins/rspec/spec/spec/interop/test/unit/resources/test_case_with_errors.rb +10 -0
- data/vendor/plugins/rspec/spec/spec/interop/test/unit/resources/testsuite_adapter_spec_with_test_unit.rb +38 -0
- data/vendor/plugins/rspec/spec/spec/interop/test/unit/spec_spec.rb +45 -0
- data/vendor/plugins/rspec/spec/spec/interop/test/unit/test_unit_spec_helper.rb +14 -0
- data/vendor/plugins/rspec/spec/spec/interop/test/unit/testcase_spec.rb +45 -0
- data/vendor/plugins/rspec/spec/spec/interop/test/unit/testsuite_adapter_spec.rb +9 -0
- data/vendor/plugins/rspec/spec/spec/matchers/be_close_spec.rb +39 -0
- data/vendor/plugins/rspec/spec/spec/matchers/be_spec.rb +248 -0
- data/vendor/plugins/rspec/spec/spec/matchers/change_spec.rb +319 -0
- data/vendor/plugins/rspec/spec/spec/matchers/description_generation_spec.rb +153 -0
- data/vendor/plugins/rspec/spec/spec/matchers/eql_spec.rb +28 -0
- data/vendor/plugins/rspec/spec/spec/matchers/equal_spec.rb +28 -0
- data/vendor/plugins/rspec/spec/spec/matchers/exist_spec.rb +57 -0
- data/vendor/plugins/rspec/spec/spec/matchers/handler_spec.rb +129 -0
- data/vendor/plugins/rspec/spec/spec/matchers/has_spec.rb +53 -0
- data/vendor/plugins/rspec/spec/spec/matchers/have_spec.rb +291 -0
- data/vendor/plugins/rspec/spec/spec/matchers/include_spec.rb +45 -0
- data/vendor/plugins/rspec/spec/spec/matchers/match_spec.rb +37 -0
- data/vendor/plugins/rspec/spec/spec/matchers/matcher_methods_spec.rb +78 -0
- data/vendor/plugins/rspec/spec/spec/matchers/mock_constraint_matchers_spec.rb +24 -0
- data/vendor/plugins/rspec/spec/spec/matchers/operator_matcher_spec.rb +158 -0
- data/vendor/plugins/rspec/spec/spec/matchers/raise_error_spec.rb +315 -0
- data/vendor/plugins/rspec/spec/spec/matchers/respond_to_spec.rb +54 -0
- data/vendor/plugins/rspec/spec/spec/matchers/satisfy_spec.rb +36 -0
- data/vendor/plugins/rspec/spec/spec/matchers/simple_matcher_spec.rb +31 -0
- data/vendor/plugins/rspec/spec/spec/matchers/throw_symbol_spec.rb +54 -0
- data/vendor/plugins/rspec/spec/spec/mocks/any_number_of_times_spec.rb +29 -0
- data/vendor/plugins/rspec/spec/spec/mocks/argument_expectation_spec.rb +23 -0
- data/vendor/plugins/rspec/spec/spec/mocks/at_least_spec.rb +97 -0
- data/vendor/plugins/rspec/spec/spec/mocks/at_most_spec.rb +93 -0
- data/vendor/plugins/rspec/spec/spec/mocks/bug_report_10260_spec.rb +8 -0
- data/vendor/plugins/rspec/spec/spec/mocks/bug_report_10263_spec.rb +24 -0
- data/vendor/plugins/rspec/spec/spec/mocks/bug_report_11545_spec.rb +33 -0
- data/vendor/plugins/rspec/spec/spec/mocks/bug_report_15719_spec.rb +30 -0
- data/vendor/plugins/rspec/spec/spec/mocks/bug_report_7611_spec.rb +19 -0
- data/vendor/plugins/rspec/spec/spec/mocks/bug_report_7805_spec.rb +22 -0
- data/vendor/plugins/rspec/spec/spec/mocks/bug_report_8165_spec.rb +31 -0
- data/vendor/plugins/rspec/spec/spec/mocks/bug_report_8302_spec.rb +26 -0
- data/vendor/plugins/rspec/spec/spec/mocks/failing_mock_argument_constraints_spec.rb +123 -0
- data/vendor/plugins/rspec/spec/spec/mocks/hash_including_matcher_spec.rb +32 -0
- data/vendor/plugins/rspec/spec/spec/mocks/mock_ordering_spec.rb +84 -0
- data/vendor/plugins/rspec/spec/spec/mocks/mock_space_spec.rb +54 -0
- data/vendor/plugins/rspec/spec/spec/mocks/mock_spec.rb +481 -0
- data/vendor/plugins/rspec/spec/spec/mocks/multiple_return_value_spec.rb +113 -0
- data/vendor/plugins/rspec/spec/spec/mocks/null_object_mock_spec.rb +40 -0
- data/vendor/plugins/rspec/spec/spec/mocks/once_counts_spec.rb +53 -0
- data/vendor/plugins/rspec/spec/spec/mocks/options_hash_spec.rb +45 -0
- data/vendor/plugins/rspec/spec/spec/mocks/partial_mock_spec.rb +106 -0
- data/vendor/plugins/rspec/spec/spec/mocks/partial_mock_using_mocks_directly_spec.rb +66 -0
- data/vendor/plugins/rspec/spec/spec/mocks/passing_mock_argument_constraints_spec.rb +160 -0
- data/vendor/plugins/rspec/spec/spec/mocks/precise_counts_spec.rb +52 -0
- data/vendor/plugins/rspec/spec/spec/mocks/record_messages_spec.rb +26 -0
- data/vendor/plugins/rspec/spec/spec/mocks/stub_spec.rb +181 -0
- data/vendor/plugins/rspec/spec/spec/mocks/twice_counts_spec.rb +67 -0
- data/vendor/plugins/rspec/spec/spec/package/bin_spec_spec.rb +14 -0
- data/vendor/plugins/rspec/spec/spec/runner/class_and_argument_parser_spec.rb +23 -0
- data/vendor/plugins/rspec/spec/spec/runner/command_line_spec.rb +147 -0
- data/vendor/plugins/rspec/spec/spec/runner/drb_command_line_spec.rb +92 -0
- data/vendor/plugins/rspec/spec/spec/runner/empty_file.txt +0 -0
- data/vendor/plugins/rspec/spec/spec/runner/examples.txt +2 -0
- data/vendor/plugins/rspec/spec/spec/runner/execution_context_spec.rb +37 -0
- data/vendor/plugins/rspec/spec/spec/runner/failed.txt +3 -0
- data/vendor/plugins/rspec/spec/spec/runner/formatter/failing_example_groups_formatter_spec.rb +45 -0
- data/vendor/plugins/rspec/spec/spec/runner/formatter/failing_examples_formatter_spec.rb +33 -0
- data/vendor/plugins/rspec/spec/spec/runner/formatter/html_formatted-1.8.4.html +365 -0
- data/vendor/plugins/rspec/spec/spec/runner/formatter/html_formatted-1.8.5-jruby.html +387 -0
- data/vendor/plugins/rspec/spec/spec/runner/formatter/html_formatted-1.8.5.html +371 -0
- data/vendor/plugins/rspec/spec/spec/runner/formatter/html_formatted-1.8.6-jruby.html +381 -0
- data/vendor/plugins/rspec/spec/spec/runner/formatter/html_formatted-1.8.6.html +371 -0
- data/vendor/plugins/rspec/spec/spec/runner/formatter/html_formatter_spec.rb +66 -0
- data/vendor/plugins/rspec/spec/spec/runner/formatter/profile_formatter_spec.rb +65 -0
- data/vendor/plugins/rspec/spec/spec/runner/formatter/progress_bar_formatter_spec.rb +137 -0
- data/vendor/plugins/rspec/spec/spec/runner/formatter/snippet_extractor_spec.rb +18 -0
- data/vendor/plugins/rspec/spec/spec/runner/formatter/spec_mate_formatter_spec.rb +103 -0
- data/vendor/plugins/rspec/spec/spec/runner/formatter/specdoc_formatter_spec.rb +129 -0
- data/vendor/plugins/rspec/spec/spec/runner/formatter/story/html_formatter_spec.rb +61 -0
- data/vendor/plugins/rspec/spec/spec/runner/formatter/story/plain_text_formatter_spec.rb +335 -0
- data/vendor/plugins/rspec/spec/spec/runner/formatter/text_mate_formatted-1.8.4.html +365 -0
- data/vendor/plugins/rspec/spec/spec/runner/formatter/text_mate_formatted-1.8.6.html +371 -0
- data/vendor/plugins/rspec/spec/spec/runner/heckle_runner_spec.rb +78 -0
- data/vendor/plugins/rspec/spec/spec/runner/heckler_spec.rb +13 -0
- data/vendor/plugins/rspec/spec/spec/runner/noisy_backtrace_tweaker_spec.rb +45 -0
- data/vendor/plugins/rspec/spec/spec/runner/option_parser_spec.rb +384 -0
- data/vendor/plugins/rspec/spec/spec/runner/options_spec.rb +386 -0
- data/vendor/plugins/rspec/spec/spec/runner/output_one_time_fixture.rb +7 -0
- data/vendor/plugins/rspec/spec/spec/runner/output_one_time_fixture_runner.rb +8 -0
- data/vendor/plugins/rspec/spec/spec/runner/output_one_time_spec.rb +16 -0
- data/vendor/plugins/rspec/spec/spec/runner/quiet_backtrace_tweaker_spec.rb +56 -0
- data/vendor/plugins/rspec/spec/spec/runner/reporter_spec.rb +192 -0
- data/vendor/plugins/rspec/spec/spec/runner/resources/a_bar.rb +0 -0
- data/vendor/plugins/rspec/spec/spec/runner/resources/a_foo.rb +0 -0
- data/vendor/plugins/rspec/spec/spec/runner/resources/a_spec.rb +1 -0
- data/vendor/plugins/rspec/spec/spec/runner/spec.opts +2 -0
- data/vendor/plugins/rspec/spec/spec/runner/spec_drb.opts +1 -0
- data/vendor/plugins/rspec/spec/spec/runner/spec_parser/spec_parser_fixture.rb +70 -0
- data/vendor/plugins/rspec/spec/spec/runner/spec_parser_spec.rb +79 -0
- data/vendor/plugins/rspec/spec/spec/runner/spec_spaced.opts +2 -0
- data/vendor/plugins/rspec/spec/spec/runner_spec.rb +11 -0
- data/vendor/plugins/rspec/spec/spec/spec_classes.rb +133 -0
- data/vendor/plugins/rspec/spec/spec/story/builders.rb +46 -0
- data/vendor/plugins/rspec/spec/spec/story/extensions/main_spec.rb +161 -0
- data/vendor/plugins/rspec/spec/spec/story/extensions_spec.rb +14 -0
- data/vendor/plugins/rspec/spec/spec/story/given_scenario_spec.rb +27 -0
- data/vendor/plugins/rspec/spec/spec/story/runner/plain_text_story_runner_spec.rb +92 -0
- data/vendor/plugins/rspec/spec/spec/story/runner/scenario_collector_spec.rb +27 -0
- data/vendor/plugins/rspec/spec/spec/story/runner/scenario_runner_spec.rb +191 -0
- data/vendor/plugins/rspec/spec/spec/story/runner/story_mediator_spec.rb +133 -0
- data/vendor/plugins/rspec/spec/spec/story/runner/story_parser_spec.rb +384 -0
- data/vendor/plugins/rspec/spec/spec/story/runner/story_runner_spec.rb +294 -0
- data/vendor/plugins/rspec/spec/spec/story/runner_spec.rb +106 -0
- data/vendor/plugins/rspec/spec/spec/story/scenario_spec.rb +20 -0
- data/vendor/plugins/rspec/spec/spec/story/step_group_spec.rb +157 -0
- data/vendor/plugins/rspec/spec/spec/story/step_mother_spec.rb +72 -0
- data/vendor/plugins/rspec/spec/spec/story/step_spec.rb +200 -0
- data/vendor/plugins/rspec/spec/spec/story/story_helper.rb +2 -0
- data/vendor/plugins/rspec/spec/spec/story/story_spec.rb +86 -0
- data/vendor/plugins/rspec/spec/spec/story/world_spec.rb +423 -0
- data/vendor/plugins/rspec/spec/spec/translator_spec.rb +265 -0
- data/vendor/plugins/rspec/spec/spec_helper.rb +103 -0
- data/vendor/plugins/rspec/stories/all.rb +5 -0
- data/vendor/plugins/rspec/stories/example_groups/autogenerated_docstrings +45 -0
- data/vendor/plugins/rspec/stories/example_groups/example_group_with_should_methods +17 -0
- data/vendor/plugins/rspec/stories/example_groups/nested_groups +17 -0
- data/vendor/plugins/rspec/stories/example_groups/output +25 -0
- data/vendor/plugins/rspec/stories/example_groups/stories.rb +7 -0
- data/vendor/plugins/rspec/stories/helper.rb +6 -0
- data/vendor/plugins/rspec/stories/interop/examples_and_tests_together +30 -0
- data/vendor/plugins/rspec/stories/interop/stories.rb +7 -0
- data/vendor/plugins/rspec/stories/interop/test_case_with_should_methods +17 -0
- data/vendor/plugins/rspec/stories/pending_stories/README +3 -0
- data/vendor/plugins/rspec/stories/resources/helpers/cmdline.rb +9 -0
- data/vendor/plugins/rspec/stories/resources/helpers/story_helper.rb +16 -0
- data/vendor/plugins/rspec/stories/resources/matchers/smart_match.rb +37 -0
- data/vendor/plugins/rspec/stories/resources/spec/example_group_with_should_methods.rb +12 -0
- data/vendor/plugins/rspec/stories/resources/spec/simple_spec.rb +8 -0
- data/vendor/plugins/rspec/stories/resources/steps/running_rspec.rb +50 -0
- data/vendor/plugins/rspec/stories/resources/stories/failing_story.rb +15 -0
- data/vendor/plugins/rspec/stories/resources/test/spec_and_test_together.rb +57 -0
- data/vendor/plugins/rspec/stories/resources/test/test_case_with_should_methods.rb +30 -0
- data/vendor/plugins/rspec/story_server/prototype/javascripts/builder.js +136 -0
- data/vendor/plugins/rspec/story_server/prototype/javascripts/controls.js +972 -0
- data/vendor/plugins/rspec/story_server/prototype/javascripts/dragdrop.js +976 -0
- data/vendor/plugins/rspec/story_server/prototype/javascripts/effects.js +1117 -0
- data/vendor/plugins/rspec/story_server/prototype/javascripts/prototype.js +4140 -0
- data/vendor/plugins/rspec/story_server/prototype/javascripts/rspec.js +149 -0
- data/vendor/plugins/rspec/story_server/prototype/javascripts/scriptaculous.js +58 -0
- data/vendor/plugins/rspec/story_server/prototype/javascripts/slider.js +276 -0
- data/vendor/plugins/rspec/story_server/prototype/javascripts/sound.js +55 -0
- data/vendor/plugins/rspec/story_server/prototype/javascripts/unittest.js +568 -0
- data/vendor/plugins/rspec/story_server/prototype/lib/server.rb +24 -0
- data/vendor/plugins/rspec/story_server/prototype/stories.html +176 -0
- data/vendor/plugins/rspec/story_server/prototype/stylesheets/rspec.css +136 -0
- data/vendor/plugins/rspec/story_server/prototype/stylesheets/test.css +90 -0
- data/vendor/plugins/rspec_on_rails/MIT-LICENSE +31 -0
- data/vendor/plugins/rspec_on_rails/README +3 -0
- data/vendor/plugins/rspec_on_rails/Rakefile +9 -0
- data/vendor/plugins/rspec_on_rails/generators/rspec/CHANGES +1 -0
- data/vendor/plugins/rspec_on_rails/generators/rspec/rspec_generator.rb +35 -0
- data/vendor/plugins/rspec_on_rails/generators/rspec/templates/all_stories.rb +4 -0
- data/vendor/plugins/rspec_on_rails/generators/rspec/templates/previous_failures.txt +0 -0
- data/vendor/plugins/rspec_on_rails/generators/rspec/templates/rcov.opts +2 -0
- data/vendor/plugins/rspec_on_rails/generators/rspec/templates/script/spec +4 -0
- data/vendor/plugins/rspec_on_rails/generators/rspec/templates/script/spec_server +102 -0
- data/vendor/plugins/rspec_on_rails/generators/rspec/templates/spec.opts +4 -0
- data/vendor/plugins/rspec_on_rails/generators/rspec/templates/spec_helper.rb +39 -0
- data/vendor/plugins/rspec_on_rails/generators/rspec/templates/stories_helper.rb +3 -0
- data/vendor/plugins/rspec_on_rails/generators/rspec_controller/USAGE +33 -0
- data/vendor/plugins/rspec_on_rails/generators/rspec_controller/rspec_controller_generator.rb +49 -0
- data/vendor/plugins/rspec_on_rails/generators/rspec_controller/templates/controller_spec.rb +25 -0
- data/vendor/plugins/rspec_on_rails/generators/rspec_controller/templates/helper_spec.rb +11 -0
- data/vendor/plugins/rspec_on_rails/generators/rspec_controller/templates/view_spec.rb +12 -0
- data/vendor/plugins/rspec_on_rails/generators/rspec_model/USAGE +18 -0
- data/vendor/plugins/rspec_on_rails/generators/rspec_model/rspec_model_generator.rb +30 -0
- data/vendor/plugins/rspec_on_rails/generators/rspec_model/templates/model_spec.rb +11 -0
- data/vendor/plugins/rspec_on_rails/generators/rspec_scaffold/rspec_scaffold_generator.rb +167 -0
- data/vendor/plugins/rspec_on_rails/generators/rspec_scaffold/templates/controller_spec.rb +313 -0
- data/vendor/plugins/rspec_on_rails/generators/rspec_scaffold/templates/edit_erb_spec.rb +25 -0
- data/vendor/plugins/rspec_on_rails/generators/rspec_scaffold/templates/helper_spec.rb +11 -0
- data/vendor/plugins/rspec_on_rails/generators/rspec_scaffold/templates/index_erb_spec.rb +22 -0
- data/vendor/plugins/rspec_on_rails/generators/rspec_scaffold/templates/new_erb_spec.rb +26 -0
- data/vendor/plugins/rspec_on_rails/generators/rspec_scaffold/templates/routing_spec.rb +61 -0
- data/vendor/plugins/rspec_on_rails/generators/rspec_scaffold/templates/show_erb_spec.rb +22 -0
- data/vendor/plugins/rspec_on_rails/init.rb +9 -0
- data/vendor/plugins/rspec_on_rails/lib/autotest/discover.rb +1 -0
- data/vendor/plugins/rspec_on_rails/lib/autotest/rails_rspec.rb +81 -0
- data/vendor/plugins/rspec_on_rails/lib/spec/rails.rb +51 -0
- data/vendor/plugins/rspec_on_rails/lib/spec/rails/example.rb +46 -0
- data/vendor/plugins/rspec_on_rails/lib/spec/rails/example/assigns_hash_proxy.rb +43 -0
- data/vendor/plugins/rspec_on_rails/lib/spec/rails/example/controller_example_group.rb +269 -0
- data/vendor/plugins/rspec_on_rails/lib/spec/rails/example/functional_example_group.rb +59 -0
- data/vendor/plugins/rspec_on_rails/lib/spec/rails/example/helper_example_group.rb +130 -0
- data/vendor/plugins/rspec_on_rails/lib/spec/rails/example/model_example_group.rb +14 -0
- data/vendor/plugins/rspec_on_rails/lib/spec/rails/example/rails_example_group.rb +98 -0
- data/vendor/plugins/rspec_on_rails/lib/spec/rails/example/render_observer.rb +90 -0
- data/vendor/plugins/rspec_on_rails/lib/spec/rails/example/view_example_group.rb +178 -0
- data/vendor/plugins/rspec_on_rails/lib/spec/rails/extensions.rb +12 -0
- data/vendor/plugins/rspec_on_rails/lib/spec/rails/extensions/action_controller/base.rb +14 -0
- data/vendor/plugins/rspec_on_rails/lib/spec/rails/extensions/action_controller/rescue.rb +21 -0
- data/vendor/plugins/rspec_on_rails/lib/spec/rails/extensions/action_controller/test_response.rb +11 -0
- data/vendor/plugins/rspec_on_rails/lib/spec/rails/extensions/action_view/base.rb +27 -0
- data/vendor/plugins/rspec_on_rails/lib/spec/rails/extensions/active_record/base.rb +30 -0
- data/vendor/plugins/rspec_on_rails/lib/spec/rails/extensions/object.rb +5 -0
- data/vendor/plugins/rspec_on_rails/lib/spec/rails/extensions/spec/example/configuration.rb +66 -0
- data/vendor/plugins/rspec_on_rails/lib/spec/rails/extensions/spec/matchers/have.rb +21 -0
- data/vendor/plugins/rspec_on_rails/lib/spec/rails/matchers.rb +29 -0
- data/vendor/plugins/rspec_on_rails/lib/spec/rails/matchers/assert_select.rb +130 -0
- data/vendor/plugins/rspec_on_rails/lib/spec/rails/matchers/have_text.rb +55 -0
- data/vendor/plugins/rspec_on_rails/lib/spec/rails/matchers/redirect_to.rb +113 -0
- data/vendor/plugins/rspec_on_rails/lib/spec/rails/matchers/render_template.rb +70 -0
- data/vendor/plugins/rspec_on_rails/lib/spec/rails/story_adapter.rb +71 -0
- data/vendor/plugins/rspec_on_rails/lib/spec/rails/version.rb +23 -0
- data/vendor/plugins/rspec_on_rails/spec/rails/autotest/mappings_spec.rb +36 -0
- data/vendor/plugins/rspec_on_rails/spec/rails/autotest/rails_rspec_spec.rb +8 -0
- data/vendor/plugins/rspec_on_rails/spec/rails/example/assigns_hash_proxy_spec.rb +60 -0
- data/vendor/plugins/rspec_on_rails/spec/rails/example/configuration_spec.rb +83 -0
- data/vendor/plugins/rspec_on_rails/spec/rails/example/controller_isolation_spec.rb +43 -0
- data/vendor/plugins/rspec_on_rails/spec/rails/example/controller_spec_spec.rb +195 -0
- data/vendor/plugins/rspec_on_rails/spec/rails/example/example_group_factory_spec.rb +112 -0
- data/vendor/plugins/rspec_on_rails/spec/rails/example/helper_spec_spec.rb +133 -0
- data/vendor/plugins/rspec_on_rails/spec/rails/example/model_spec_spec.rb +18 -0
- data/vendor/plugins/rspec_on_rails/spec/rails/example/shared_behaviour_spec.rb +16 -0
- data/vendor/plugins/rspec_on_rails/spec/rails/example/test_unit_assertion_accessibility_spec.rb +33 -0
- data/vendor/plugins/rspec_on_rails/spec/rails/example/view_spec_spec.rb +264 -0
- data/vendor/plugins/rspec_on_rails/spec/rails/extensions/action_controller_rescue_action_spec.rb +54 -0
- data/vendor/plugins/rspec_on_rails/spec/rails/extensions/action_view_base_spec.rb +48 -0
- data/vendor/plugins/rspec_on_rails/spec/rails/extensions/active_record_spec.rb +14 -0
- data/vendor/plugins/rspec_on_rails/spec/rails/matchers/assert_select_spec.rb +783 -0
- data/vendor/plugins/rspec_on_rails/spec/rails/matchers/description_generation_spec.rb +37 -0
- data/vendor/plugins/rspec_on_rails/spec/rails/matchers/errors_on_spec.rb +13 -0
- data/vendor/plugins/rspec_on_rails/spec/rails/matchers/have_text_spec.rb +62 -0
- data/vendor/plugins/rspec_on_rails/spec/rails/matchers/redirect_to_spec.rb +209 -0
- data/vendor/plugins/rspec_on_rails/spec/rails/matchers/render_spec.rb +169 -0
- data/vendor/plugins/rspec_on_rails/spec/rails/mocks/ar_classes.rb +10 -0
- data/vendor/plugins/rspec_on_rails/spec/rails/mocks/mock_model_spec.rb +55 -0
- data/vendor/plugins/rspec_on_rails/spec/rails/mocks/stub_model_spec.rb +54 -0
- data/vendor/plugins/rspec_on_rails/spec/rails/sample_spec.rb +7 -0
- data/vendor/plugins/rspec_on_rails/spec/rails/spec_server_spec.rb +89 -0
- data/vendor/plugins/rspec_on_rails/spec/rails/spec_spec.rb +11 -0
- data/vendor/plugins/rspec_on_rails/spec/rails_suite.rb +7 -0
- data/vendor/plugins/rspec_on_rails/spec/spec_helper.rb +46 -0
- data/vendor/plugins/rspec_on_rails/spec_resources/controllers/action_view_base_spec_controller.rb +2 -0
- data/vendor/plugins/rspec_on_rails/spec_resources/controllers/controller_spec_controller.rb +68 -0
- data/vendor/plugins/rspec_on_rails/spec_resources/controllers/redirect_spec_controller.rb +59 -0
- data/vendor/plugins/rspec_on_rails/spec_resources/controllers/render_spec_controller.rb +26 -0
- data/vendor/plugins/rspec_on_rails/spec_resources/controllers/rjs_spec_controller.rb +58 -0
- data/vendor/plugins/rspec_on_rails/spec_resources/helpers/explicit_helper.rb +10 -0
- data/vendor/plugins/rspec_on_rails/spec_resources/helpers/more_explicit_helper.rb +5 -0
- data/vendor/plugins/rspec_on_rails/spec_resources/helpers/plugin_application_helper.rb +6 -0
- data/vendor/plugins/rspec_on_rails/spec_resources/helpers/view_spec_helper.rb +13 -0
- data/vendor/plugins/rspec_on_rails/spec_resources/views/controller_spec/_partial.rhtml +0 -0
- data/vendor/plugins/rspec_on_rails/spec_resources/views/controller_spec/action_setting_flash_after_session_reset.rhtml +1 -0
- data/vendor/plugins/rspec_on_rails/spec_resources/views/controller_spec/action_setting_flash_before_session_reset.rhtml +1 -0
- data/vendor/plugins/rspec_on_rails/spec_resources/views/controller_spec/action_setting_the_assigns_hash.rhtml +0 -0
- data/vendor/plugins/rspec_on_rails/spec_resources/views/controller_spec/action_with_errors_in_template.rhtml +1 -0
- data/vendor/plugins/rspec_on_rails/spec_resources/views/controller_spec/action_with_template.rhtml +1 -0
- data/vendor/plugins/rspec_on_rails/spec_resources/views/render_spec/_a_partial.rhtml +0 -0
- data/vendor/plugins/rspec_on_rails/spec_resources/views/render_spec/some_action.js.rjs +1 -0
- data/vendor/plugins/rspec_on_rails/spec_resources/views/render_spec/some_action.rhtml +0 -0
- data/vendor/plugins/rspec_on_rails/spec_resources/views/render_spec/some_action.rjs +1 -0
- data/vendor/plugins/rspec_on_rails/spec_resources/views/rjs_spec/_replacement_partial.rhtml +1 -0
- data/vendor/plugins/rspec_on_rails/spec_resources/views/rjs_spec/hide_div.rjs +1 -0
- data/vendor/plugins/rspec_on_rails/spec_resources/views/rjs_spec/hide_page_element.rjs +1 -0
- data/vendor/plugins/rspec_on_rails/spec_resources/views/rjs_spec/insert_html.rjs +1 -0
- data/vendor/plugins/rspec_on_rails/spec_resources/views/rjs_spec/replace.rjs +1 -0
- data/vendor/plugins/rspec_on_rails/spec_resources/views/rjs_spec/replace_html.rjs +1 -0
- data/vendor/plugins/rspec_on_rails/spec_resources/views/rjs_spec/replace_html_with_partial.rjs +1 -0
- data/vendor/plugins/rspec_on_rails/spec_resources/views/rjs_spec/visual_effect.rjs +1 -0
- data/vendor/plugins/rspec_on_rails/spec_resources/views/rjs_spec/visual_toggle_effect.rjs +1 -0
- data/vendor/plugins/rspec_on_rails/spec_resources/views/tag_spec/no_tags.rhtml +1 -0
- data/vendor/plugins/rspec_on_rails/spec_resources/views/tag_spec/single_div_with_no_attributes.rhtml +1 -0
- data/vendor/plugins/rspec_on_rails/spec_resources/views/tag_spec/single_div_with_one_attribute.rhtml +1 -0
- data/vendor/plugins/rspec_on_rails/spec_resources/views/view_spec/_partial.rhtml +2 -0
- data/vendor/plugins/rspec_on_rails/spec_resources/views/view_spec/_partial_used_twice.rhtml +0 -0
- data/vendor/plugins/rspec_on_rails/spec_resources/views/view_spec/_partial_with_local_variable.rhtml +1 -0
- data/vendor/plugins/rspec_on_rails/spec_resources/views/view_spec/_partial_with_sub_partial.rhtml +1 -0
- data/vendor/plugins/rspec_on_rails/spec_resources/views/view_spec/_spacer.rhtml +1 -0
- data/vendor/plugins/rspec_on_rails/spec_resources/views/view_spec/accessor.rhtml +3 -0
- data/vendor/plugins/rspec_on_rails/spec_resources/views/view_spec/entry_form.rhtml +2 -0
- data/vendor/plugins/rspec_on_rails/spec_resources/views/view_spec/explicit_helper.rhtml +2 -0
- data/vendor/plugins/rspec_on_rails/spec_resources/views/view_spec/foo/show.rhtml +1 -0
- data/vendor/plugins/rspec_on_rails/spec_resources/views/view_spec/implicit_helper.rhtml +2 -0
- data/vendor/plugins/rspec_on_rails/spec_resources/views/view_spec/multiple_helpers.rhtml +3 -0
- data/vendor/plugins/rspec_on_rails/spec_resources/views/view_spec/template_with_partial.rhtml +5 -0
- data/vendor/plugins/rspec_on_rails/spec_resources/views/view_spec/template_with_partial_using_collection.rhtml +3 -0
- data/vendor/plugins/rspec_on_rails/spec_resources/views/view_spec/template_with_partial_with_array.rhtml +1 -0
- data/vendor/plugins/rspec_on_rails/stories/all.rb +10 -0
- data/vendor/plugins/rspec_on_rails/stories/helper.rb +5 -0
- data/vendor/plugins/rspec_on_rails/stories/steps/people.rb +8 -0
- data/vendor/plugins/rspec_on_rails/stories/transactions_should_rollback +15 -0
- data/vendor/plugins/rspec_on_rails/stories/transactions_should_rollback.rb +25 -0
- data/vendor/plugins/rspec_on_rails/tasks/rspec.rake +137 -0
- data/vendor/plugins/scenarios/LICENSE +19 -0
- data/vendor/plugins/scenarios/README +262 -0
- data/vendor/plugins/scenarios/Rakefile +66 -0
- data/vendor/plugins/scenarios/TODO +1 -0
- data/vendor/plugins/scenarios/lib/scenarios.rb +34 -0
- data/vendor/plugins/scenarios/lib/scenarios/base.rb +73 -0
- data/vendor/plugins/scenarios/lib/scenarios/builtin/blank_scenario.rb +18 -0
- data/vendor/plugins/scenarios/lib/scenarios/configuration.rb +55 -0
- data/vendor/plugins/scenarios/lib/scenarios/extensions.rb +5 -0
- data/vendor/plugins/scenarios/lib/scenarios/extensions/active_record.rb +14 -0
- data/vendor/plugins/scenarios/lib/scenarios/extensions/delegating_attributes.rb +40 -0
- data/vendor/plugins/scenarios/lib/scenarios/extensions/object.rb +5 -0
- data/vendor/plugins/scenarios/lib/scenarios/extensions/string.rb +22 -0
- data/vendor/plugins/scenarios/lib/scenarios/extensions/symbol.rb +14 -0
- data/vendor/plugins/scenarios/lib/scenarios/extensions/test_case.rb +76 -0
- data/vendor/plugins/scenarios/lib/scenarios/loading.rb +51 -0
- data/vendor/plugins/scenarios/lib/scenarios/table_blasting.rb +20 -0
- data/vendor/plugins/scenarios/lib/scenarios/table_methods.rb +205 -0
- data/vendor/plugins/scenarios/spec/scenarios/complex_composite_scenario.rb +9 -0
- data/vendor/plugins/scenarios/spec/scenarios/composite_scenario.rb +9 -0
- data/vendor/plugins/scenarios/spec/scenarios/empty_scenario.rb +4 -0
- data/vendor/plugins/scenarios/spec/scenarios/people_scenario.rb +26 -0
- data/vendor/plugins/scenarios/spec/scenarios/places_scenario.rb +22 -0
- data/vendor/plugins/scenarios/spec/scenarios/things_scenario.rb +22 -0
- data/vendor/plugins/scenarios/spec/scenarios_spec.rb +189 -0
- data/vendor/plugins/scenarios/spec/spec.opts +7 -0
- data/vendor/plugins/scenarios/spec/spec_helper.rb +6 -0
- data/vendor/plugins/scenarios/tasks/scenario.rake +21 -0
- data/vendor/plugins/scenarios/test/scenarios_test.rb +39 -0
- data/vendor/plugins/scenarios/test/test_helper.rb +5 -0
- data/vendor/plugins/scenarios/testing/application.rb +2 -0
- data/vendor/plugins/scenarios/testing/database.yml +9 -0
- data/vendor/plugins/scenarios/testing/environment.rb +68 -0
- data/vendor/plugins/scenarios/testing/library.rb +128 -0
- data/vendor/plugins/scenarios/testing/models.rb +14 -0
- data/vendor/plugins/scenarios/testing/rspec_on_rails_3014.patch +52 -0
- data/vendor/plugins/scenarios/testing/rspec_on_rails_3119.patch +53 -0
- data/vendor/plugins/scenarios/testing/schema.rb +31 -0
- data/vendor/rails/Rakefile +21 -0
- data/vendor/rails/actionmailer/CHANGELOG +44 -26
- data/vendor/rails/actionmailer/MIT-LICENSE +1 -1
- data/vendor/rails/actionmailer/README +2 -2
- data/vendor/rails/actionmailer/Rakefile +4 -3
- data/vendor/rails/actionmailer/install.rb +1 -1
- data/vendor/rails/actionmailer/lib/action_mailer.rb +5 -3
- data/vendor/rails/actionmailer/lib/action_mailer/base.rb +57 -36
- data/vendor/rails/actionmailer/lib/action_mailer/helpers.rb +4 -4
- data/vendor/rails/actionmailer/lib/action_mailer/part.rb +2 -5
- data/vendor/rails/actionmailer/lib/action_mailer/test_case.rb +59 -0
- data/vendor/rails/actionmailer/lib/action_mailer/test_helper.rb +67 -0
- data/vendor/rails/actionmailer/lib/action_mailer/vendor.rb +14 -0
- data/vendor/rails/actionmailer/lib/action_mailer/vendor/{text → text-format-0.6.3/text}/format.rb +0 -0
- data/vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.1.0/tmail.rb +4 -0
- data/vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.1.0/tmail/Makefile +19 -0
- data/vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.1.0/tmail/address.rb +245 -0
- data/vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.1.0/tmail/attachments.rb +47 -0
- data/vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.1.0/tmail/base64.rb +52 -0
- data/vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.1.0/tmail/compat.rb +39 -0
- data/vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.1.0/tmail/config.rb +71 -0
- data/vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.1.0/tmail/core_extensions.rb +67 -0
- data/vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.1.0/tmail/encode.rb +481 -0
- data/vendor/rails/actionmailer/lib/action_mailer/vendor/{tmail → tmail-1.1.0/tmail}/facade.rb +0 -0
- data/vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.1.0/tmail/header.rb +931 -0
- data/vendor/rails/actionmailer/lib/action_mailer/vendor/{tmail → tmail-1.1.0/tmail}/info.rb +0 -0
- data/vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.1.0/tmail/interface.rb +540 -0
- data/vendor/rails/actionmailer/lib/action_mailer/vendor/{tmail → tmail-1.1.0/tmail}/loader.rb +0 -0
- data/vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.1.0/tmail/mail.rb +462 -0
- data/vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.1.0/tmail/mailbox.rb +435 -0
- data/vendor/rails/actionmailer/lib/action_mailer/vendor/{tmail → tmail-1.1.0/tmail}/mbox.rb +0 -0
- data/vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.1.0/tmail/net.rb +282 -0
- data/vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.1.0/tmail/obsolete.rb +137 -0
- data/vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.1.0/tmail/parser.rb +1475 -0
- data/vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.1.0/tmail/parser.y +381 -0
- data/vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.1.0/tmail/port.rb +379 -0
- data/vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.1.0/tmail/quoting.rb +142 -0
- data/vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.1.0/tmail/scanner.rb +43 -0
- data/vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.1.0/tmail/scanner_r.rb +263 -0
- data/vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.1.0/tmail/stringio.rb +279 -0
- data/vendor/rails/actionmailer/lib/action_mailer/vendor/{tmail → tmail-1.1.0/tmail}/tmail.rb +0 -0
- data/vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.1.0/tmail/utils.rb +281 -0
- data/vendor/rails/actionmailer/lib/action_mailer/vendor/tmail-1.1.0/tmail/version.rb +38 -0
- data/vendor/rails/actionmailer/lib/action_mailer/version.rb +3 -3
- data/vendor/rails/actionmailer/lib/actionmailer.rb +1 -0
- data/vendor/rails/actionmailer/test/abstract_unit.rb +19 -0
- data/vendor/rails/actionmailer/test/delivery_method_test.rb +51 -0
- data/vendor/rails/actionmailer/test/fixtures/first_mailer/share.erb +1 -0
- data/vendor/rails/actionmailer/test/fixtures/first_mailer/share.rhtml +0 -1
- data/vendor/rails/actionmailer/test/fixtures/helper_mailer/use_example_helper.erb +1 -0
- data/vendor/rails/actionmailer/test/fixtures/helper_mailer/use_example_helper.rhtml +0 -0
- data/vendor/rails/actionmailer/test/fixtures/helper_mailer/use_helper.erb +1 -0
- data/vendor/rails/actionmailer/test/fixtures/helper_mailer/use_helper.rhtml +0 -1
- data/vendor/rails/actionmailer/test/fixtures/helper_mailer/use_helper_method.erb +1 -0
- data/vendor/rails/actionmailer/test/fixtures/helper_mailer/use_helper_method.rhtml +0 -1
- data/vendor/rails/actionmailer/test/fixtures/helper_mailer/use_mail_helper.erb +5 -0
- data/vendor/rails/actionmailer/test/fixtures/helper_mailer/use_mail_helper.rhtml +0 -5
- data/vendor/rails/actionmailer/test/fixtures/helpers/example_helper.rb +5 -0
- data/vendor/rails/actionmailer/test/fixtures/path.with.dots/funky_path_mailer/multipart_with_template_path_with_dots.erb +1 -0
- data/vendor/rails/actionmailer/test/fixtures/path.with.dots/funky_path_mailer/multipart_with_template_path_with_dots.rhtml +0 -1
- data/vendor/rails/actionmailer/test/fixtures/raw_base64_decoded_string +0 -0
- data/vendor/rails/actionmailer/test/fixtures/raw_base64_encoded_string +1 -0
- data/vendor/rails/actionmailer/test/fixtures/raw_email_with_invalid_characters_in_content_type +104 -0
- data/vendor/rails/actionmailer/test/fixtures/raw_email_with_nested_attachment +100 -0
- data/vendor/rails/actionmailer/test/fixtures/second_mailer/share.erb +1 -0
- data/vendor/rails/actionmailer/test/fixtures/second_mailer/share.rhtml +0 -1
- data/vendor/rails/actionmailer/test/fixtures/templates/signed_up.erb +3 -0
- data/vendor/rails/actionmailer/test/fixtures/templates/signed_up.rhtml +0 -3
- data/vendor/rails/actionmailer/test/fixtures/test_mailer/_subtemplate.text.plain.erb +1 -0
- data/vendor/rails/actionmailer/test/fixtures/test_mailer/custom_templating_extension.text.html.haml +6 -0
- data/vendor/rails/actionmailer/test/fixtures/test_mailer/custom_templating_extension.text.plain.haml +6 -0
- data/vendor/rails/actionmailer/test/fixtures/test_mailer/implicitly_multipart_example.ignored.erb +1 -0
- data/vendor/rails/actionmailer/test/fixtures/test_mailer/implicitly_multipart_example.ignored.rhtml +0 -1
- data/vendor/rails/actionmailer/test/fixtures/test_mailer/implicitly_multipart_example.text.html.erb +10 -0
- data/vendor/rails/actionmailer/test/fixtures/test_mailer/implicitly_multipart_example.text.html.rhtml +0 -10
- data/vendor/rails/actionmailer/test/fixtures/test_mailer/implicitly_multipart_example.text.plain.erb +2 -0
- data/vendor/rails/actionmailer/test/fixtures/test_mailer/implicitly_multipart_example.text.plain.rhtml +0 -2
- data/vendor/rails/actionmailer/test/fixtures/test_mailer/implicitly_multipart_example.text.yaml.erb +1 -0
- data/vendor/rails/actionmailer/test/fixtures/test_mailer/implicitly_multipart_example.text.yaml.rhtml +0 -1
- data/vendor/rails/actionmailer/test/fixtures/test_mailer/included_subtemplate.text.plain.erb +1 -0
- data/vendor/rails/actionmailer/test/fixtures/test_mailer/rxml_template.builder +2 -0
- data/vendor/rails/actionmailer/test/fixtures/test_mailer/rxml_template.rxml +2 -0
- data/vendor/rails/actionmailer/test/fixtures/test_mailer/signed_up.erb +3 -0
- data/vendor/rails/actionmailer/test/fixtures/test_mailer/signed_up.rhtml +0 -3
- data/vendor/rails/actionmailer/test/fixtures/test_mailer/signed_up_with_url.erb +5 -0
- data/vendor/rails/actionmailer/test/fixtures/test_mailer/signed_up_with_url.rhtml +0 -3
- data/vendor/rails/actionmailer/test/mail_helper_test.rb +10 -6
- data/vendor/rails/actionmailer/test/mail_render_test.rb +45 -2
- data/vendor/rails/actionmailer/test/mail_service_test.rb +150 -27
- data/vendor/rails/actionmailer/test/quoting_test.rb +57 -3
- data/vendor/rails/actionmailer/test/test_helper_test.rb +117 -0
- data/vendor/rails/actionmailer/test/tmail_test.rb +9 -0
- data/vendor/rails/actionmailer/test/url_test.rb +10 -2
- data/vendor/rails/actionpack/CHANGELOG +1439 -20
- data/vendor/rails/actionpack/MIT-LICENSE +1 -1
- data/vendor/rails/actionpack/README +5 -5
- data/vendor/rails/actionpack/RUNNING_UNIT_TESTS +4 -5
- data/vendor/rails/actionpack/Rakefile +5 -6
- data/vendor/rails/actionpack/install.rb +2 -2
- data/vendor/rails/actionpack/lib/action_controller.rb +11 -15
- data/vendor/rails/actionpack/lib/action_controller/assertions.rb +12 -25
- data/vendor/rails/actionpack/lib/action_controller/assertions/dom_assertions.rb +18 -4
- data/vendor/rails/actionpack/lib/action_controller/assertions/model_assertions.rb +8 -1
- data/vendor/rails/actionpack/lib/action_controller/assertions/response_assertions.rb +35 -12
- data/vendor/rails/actionpack/lib/action_controller/assertions/routing_assertions.rb +56 -12
- data/vendor/rails/actionpack/lib/action_controller/assertions/selector_assertions.rb +105 -38
- data/vendor/rails/actionpack/lib/action_controller/assertions/tag_assertions.rb +28 -15
- data/vendor/rails/actionpack/lib/action_controller/base.rb +320 -262
- data/vendor/rails/actionpack/lib/action_controller/benchmarking.rb +36 -31
- data/vendor/rails/actionpack/lib/action_controller/caching.rb +132 -66
- data/vendor/rails/actionpack/lib/action_controller/cgi_ext.rb +16 -0
- data/vendor/rails/actionpack/lib/action_controller/cgi_ext/cookie.rb +106 -0
- data/vendor/rails/actionpack/lib/action_controller/cgi_ext/query_extension.rb +22 -0
- data/vendor/rails/actionpack/lib/action_controller/cgi_ext/session.rb +73 -0
- data/vendor/rails/actionpack/lib/action_controller/cgi_ext/stdinput.rb +23 -0
- data/vendor/rails/actionpack/lib/action_controller/cgi_process.rb +36 -55
- data/vendor/rails/actionpack/lib/action_controller/components.rb +19 -36
- data/vendor/rails/actionpack/lib/action_controller/cookies.rb +13 -9
- data/vendor/rails/actionpack/lib/action_controller/dispatcher.rb +195 -0
- data/vendor/rails/actionpack/lib/action_controller/filters.rb +35 -34
- data/vendor/rails/actionpack/lib/action_controller/flash.rb +30 -35
- data/vendor/rails/actionpack/lib/action_controller/helpers.rb +123 -50
- data/vendor/rails/actionpack/lib/action_controller/http_authentication.rb +126 -0
- data/vendor/rails/actionpack/lib/action_controller/integration.rb +127 -108
- data/vendor/rails/actionpack/lib/action_controller/layout.rb +61 -48
- data/vendor/rails/actionpack/lib/action_controller/mime_responds.rb +57 -68
- data/vendor/rails/actionpack/lib/action_controller/mime_type.rb +43 -80
- data/vendor/rails/actionpack/lib/action_controller/mime_types.rb +20 -0
- data/vendor/rails/actionpack/lib/action_controller/polymorphic_routes.rb +88 -0
- data/vendor/rails/actionpack/lib/action_controller/record_identifier.rb +91 -0
- data/vendor/rails/actionpack/lib/action_controller/request.rb +553 -88
- data/vendor/rails/actionpack/lib/action_controller/request_forgery_protection.rb +132 -0
- data/vendor/rails/actionpack/lib/action_controller/request_profiler.rb +138 -0
- data/vendor/rails/actionpack/lib/action_controller/rescue.rb +185 -69
- data/vendor/rails/actionpack/lib/action_controller/resources.rb +211 -172
- data/vendor/rails/actionpack/lib/action_controller/response.rb +49 -8
- data/vendor/rails/actionpack/lib/action_controller/routing.rb +368 -242
- data/vendor/rails/actionpack/lib/action_controller/routing_optimisation.rb +119 -0
- data/vendor/rails/actionpack/lib/action_controller/session/active_record_store.rb +3 -2
- data/vendor/rails/actionpack/lib/action_controller/session/cookie_store.rb +164 -0
- data/vendor/rails/actionpack/lib/action_controller/session/mem_cache_store.rb +9 -16
- data/vendor/rails/actionpack/lib/action_controller/session_management.rb +17 -8
- data/vendor/rails/actionpack/lib/action_controller/streaming.rb +6 -3
- data/vendor/rails/actionpack/lib/action_controller/templates/rescues/_request_and_response.erb +24 -0
- data/vendor/rails/actionpack/lib/action_controller/templates/rescues/{_trace.rhtml → _trace.erb} +0 -0
- data/vendor/rails/actionpack/lib/action_controller/templates/rescues/diagnostics.erb +11 -0
- data/vendor/rails/actionpack/lib/action_controller/templates/rescues/{layout.rhtml → layout.erb} +0 -0
- data/vendor/rails/actionpack/lib/action_controller/templates/rescues/{missing_template.rhtml → missing_template.erb} +0 -0
- data/vendor/rails/actionpack/lib/action_controller/templates/rescues/{routing_error.rhtml → routing_error.erb} +0 -0
- data/vendor/rails/actionpack/lib/action_controller/templates/rescues/template_error.erb +21 -0
- data/vendor/rails/actionpack/lib/action_controller/templates/rescues/{unknown_action.rhtml → unknown_action.erb} +0 -0
- data/vendor/rails/actionpack/lib/action_controller/test_case.rb +53 -0
- data/vendor/rails/actionpack/lib/action_controller/test_process.rb +59 -46
- data/vendor/rails/actionpack/lib/action_controller/url_rewriter.rb +48 -24
- data/vendor/rails/actionpack/lib/action_controller/vendor/html-scanner/html/document.rb +7 -4
- data/vendor/rails/actionpack/lib/action_controller/vendor/html-scanner/html/sanitizer.rb +173 -0
- data/vendor/rails/actionpack/lib/action_controller/vendor/html-scanner/html/selector.rb +11 -6
- data/vendor/rails/actionpack/lib/action_controller/verification.rb +27 -21
- data/vendor/rails/actionpack/lib/action_pack.rb +1 -1
- data/vendor/rails/actionpack/lib/action_pack/version.rb +4 -4
- data/vendor/rails/actionpack/lib/action_view.rb +8 -3
- data/vendor/rails/actionpack/lib/action_view/base.rb +238 -140
- data/vendor/rails/actionpack/lib/action_view/compiled_templates.rb +1 -2
- data/vendor/rails/actionpack/lib/action_view/helpers/active_record_helper.rb +35 -17
- data/vendor/rails/actionpack/lib/action_view/helpers/asset_tag_helper.rb +417 -87
- data/vendor/rails/actionpack/lib/action_view/helpers/atom_feed_helper.rb +111 -0
- data/vendor/rails/actionpack/lib/action_view/helpers/benchmark_helper.rb +12 -5
- data/vendor/rails/actionpack/lib/action_view/helpers/cache_helper.rb +29 -0
- data/vendor/rails/actionpack/lib/action_view/helpers/capture_helper.rb +97 -63
- data/vendor/rails/actionpack/lib/action_view/helpers/date_helper.rb +295 -35
- data/vendor/rails/actionpack/lib/action_view/helpers/debug_helper.rb +6 -2
- data/vendor/rails/actionpack/lib/action_view/helpers/form_helper.rb +354 -111
- data/vendor/rails/actionpack/lib/action_view/helpers/form_options_helper.rb +171 -109
- data/vendor/rails/actionpack/lib/action_view/helpers/form_tag_helper.rb +332 -76
- data/vendor/rails/actionpack/lib/action_view/helpers/javascript_helper.rb +35 -11
- data/vendor/rails/actionpack/lib/action_view/helpers/javascripts/controls.js +484 -354
- data/vendor/rails/actionpack/lib/action_view/helpers/javascripts/dragdrop.js +88 -58
- data/vendor/rails/actionpack/lib/action_view/helpers/javascripts/effects.js +396 -364
- data/vendor/rails/actionpack/lib/action_view/helpers/javascripts/prototype.js +2817 -1107
- data/vendor/rails/actionpack/lib/action_view/helpers/number_helper.rb +84 -60
- data/vendor/rails/actionpack/lib/action_view/helpers/prototype_helper.rb +419 -43
- data/vendor/rails/actionpack/lib/action_view/helpers/record_identification_helper.rb +20 -0
- data/vendor/rails/actionpack/lib/action_view/helpers/record_tag_helper.rb +59 -0
- data/vendor/rails/actionpack/lib/action_view/helpers/sanitize_helper.rb +223 -0
- data/vendor/rails/actionpack/lib/action_view/helpers/scriptaculous_helper.rb +63 -4
- data/vendor/rails/actionpack/lib/action_view/helpers/tag_helper.rb +69 -39
- data/vendor/rails/actionpack/lib/action_view/helpers/text_helper.rb +221 -148
- data/vendor/rails/actionpack/lib/action_view/helpers/url_helper.rb +283 -165
- data/vendor/rails/actionpack/lib/action_view/partials.rb +134 -62
- data/vendor/rails/actionpack/lib/action_view/template_error.rb +4 -12
- data/vendor/rails/actionpack/lib/action_view/template_handler.rb +17 -0
- data/vendor/rails/actionpack/lib/action_view/template_handlers/builder.rb +19 -0
- data/vendor/rails/actionpack/lib/action_view/template_handlers/erb.rb +21 -0
- data/vendor/rails/actionpack/lib/action_view/template_handlers/rjs.rb +14 -0
- data/vendor/rails/actionpack/lib/actionpack.rb +1 -0
- data/vendor/rails/actionpack/test/abstract_unit.rb +21 -1
- data/vendor/rails/actionpack/test/action_view_test.rb +44 -0
- data/vendor/rails/actionpack/test/active_record_unit.rb +12 -20
- data/vendor/rails/actionpack/test/activerecord/active_record_store_test.rb +2 -2
- data/vendor/rails/actionpack/test/activerecord/render_partial_with_record_identification_test.rb +74 -0
- data/vendor/rails/actionpack/test/controller/action_pack_assertions_test.rb +21 -152
- data/vendor/rails/actionpack/test/controller/addresses_render_test.rb +2 -7
- data/vendor/rails/actionpack/test/controller/assert_select_test.rb +120 -14
- data/vendor/rails/actionpack/test/controller/base_test.rb +11 -13
- data/vendor/rails/actionpack/test/controller/caching_test.rb +125 -5
- data/vendor/rails/actionpack/test/controller/capture_test.rb +23 -16
- data/vendor/rails/actionpack/test/controller/cgi_test.rb +70 -395
- data/vendor/rails/actionpack/test/controller/components_test.rb +31 -42
- data/vendor/rails/actionpack/test/controller/content_type_test.rb +1 -1
- data/vendor/rails/actionpack/test/controller/cookie_test.rb +51 -15
- data/vendor/rails/actionpack/test/controller/deprecation/deprecated_base_methods_test.rb +1 -42
- data/vendor/rails/actionpack/test/controller/dispatcher_test.rb +123 -0
- data/vendor/rails/actionpack/test/controller/fake_models.rb +5 -0
- data/vendor/rails/actionpack/test/controller/filters_test.rb +45 -7
- data/vendor/rails/actionpack/test/controller/flash_test.rb +46 -2
- data/vendor/rails/actionpack/test/controller/fragment_store_setting_test.rb +10 -8
- data/vendor/rails/actionpack/test/controller/helper_test.rb +23 -4
- data/vendor/rails/actionpack/test/controller/html-scanner/document_test.rb +124 -0
- data/vendor/rails/actionpack/test/controller/html-scanner/node_test.rb +69 -0
- data/vendor/rails/actionpack/test/controller/html-scanner/sanitizer_test.rb +250 -0
- data/vendor/rails/actionpack/test/controller/html-scanner/tag_node_test.rb +239 -0
- data/vendor/rails/actionpack/test/controller/html-scanner/text_node_test.rb +51 -0
- data/vendor/rails/actionpack/test/controller/html-scanner/tokenizer_test.rb +125 -0
- data/vendor/rails/actionpack/test/controller/http_authentication_test.rb +54 -0
- data/vendor/rails/actionpack/test/controller/integration_test.rb +47 -31
- data/vendor/rails/actionpack/test/controller/layout_test.rb +64 -12
- data/vendor/rails/actionpack/test/controller/mime_responds_test.rb +193 -38
- data/vendor/rails/actionpack/test/controller/mime_type_test.rb +30 -8
- data/vendor/rails/actionpack/test/controller/new_render_test.rb +104 -22
- data/vendor/rails/actionpack/test/controller/polymorphic_routes_test.rb +98 -0
- data/vendor/rails/actionpack/test/controller/record_identifier_test.rb +103 -0
- data/vendor/rails/actionpack/test/controller/redirect_test.rb +120 -18
- data/vendor/rails/actionpack/test/controller/render_test.rb +226 -55
- data/vendor/rails/actionpack/test/controller/request_forgery_protection_test.rb +217 -0
- data/vendor/rails/actionpack/test/controller/request_test.rb +546 -27
- data/vendor/rails/actionpack/test/controller/rescue_test.rb +501 -0
- data/vendor/rails/actionpack/test/controller/resources_test.rb +258 -132
- data/vendor/rails/actionpack/test/controller/routing_test.rb +508 -106
- data/vendor/rails/actionpack/test/controller/selector_test.rb +5 -5
- data/vendor/rails/actionpack/test/controller/send_file_test.rb +17 -7
- data/vendor/rails/actionpack/test/controller/session/cookie_store_test.rb +246 -0
- data/vendor/rails/actionpack/test/controller/session/mem_cache_store_test.rb +182 -0
- data/vendor/rails/actionpack/test/controller/session_fixation_test.rb +89 -0
- data/vendor/rails/actionpack/test/controller/session_management_test.rb +7 -7
- data/vendor/rails/actionpack/test/controller/test_test.rb +150 -38
- data/vendor/rails/actionpack/test/controller/url_rewriter_test.rb +87 -12
- data/vendor/rails/actionpack/test/controller/verification_test.rb +11 -0
- data/vendor/rails/actionpack/test/controller/view_paths_test.rb +137 -0
- data/vendor/rails/actionpack/test/controller/webservice_test.rb +11 -75
- data/vendor/rails/actionpack/test/fixtures/addresses/{list.rhtml → list.erb} +0 -0
- data/vendor/rails/actionpack/test/fixtures/db_definitions/sqlite.sql +2 -1
- data/vendor/rails/actionpack/test/fixtures/developer.rb +2 -0
- data/vendor/rails/actionpack/test/fixtures/fun/games/{hello_world.rhtml → hello_world.erb} +0 -0
- data/vendor/rails/actionpack/test/fixtures/helpers/fun/pdf_helper.rb +1 -1
- data/vendor/rails/actionpack/test/fixtures/layout_tests/alt/hello.rhtml +1 -0
- data/vendor/rails/actionpack/test/fixtures/layout_tests/layouts/multiple_extensions.html.erb +1 -0
- data/vendor/rails/actionpack/test/fixtures/layouts/{builder.rxml → builder.builder} +0 -0
- data/vendor/rails/actionpack/test/fixtures/layouts/{standard.rhtml → standard.erb} +0 -0
- data/vendor/rails/actionpack/test/fixtures/layouts/{talk_from_action.rhtml → talk_from_action.erb} +0 -0
- data/vendor/rails/actionpack/test/fixtures/layouts/{yield.rhtml → yield.erb} +0 -0
- data/vendor/rails/actionpack/test/fixtures/multipart/binary_file +0 -0
- data/vendor/rails/actionpack/test/fixtures/multipart/bracketed_param +5 -0
- data/vendor/rails/actionpack/test/fixtures/override/test/hello_world.erb +1 -0
- data/vendor/rails/actionpack/test/fixtures/override2/layouts/test/sub.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/404.html +1 -0
- data/vendor/rails/actionpack/test/fixtures/public/500.html +1 -0
- data/vendor/rails/actionpack/test/fixtures/public/javascripts/application.js +0 -1
- data/vendor/rails/actionpack/test/fixtures/public/javascripts/bank.js +1 -0
- data/vendor/rails/actionpack/test/fixtures/public/javascripts/robber.js +1 -0
- data/vendor/rails/actionpack/test/fixtures/public/stylesheets/bank.css +1 -0
- data/vendor/rails/actionpack/test/fixtures/public/stylesheets/robber.css +1 -0
- data/vendor/rails/actionpack/test/fixtures/replies.yml +2 -0
- data/vendor/rails/actionpack/test/fixtures/reply.rb +2 -1
- data/vendor/rails/actionpack/test/fixtures/respond_to/{all_types_with_layout.rhtml → all_types_with_layout.html.erb} +0 -0
- data/vendor/rails/actionpack/test/fixtures/respond_to/{all_types_with_layout.rjs → all_types_with_layout.js.rjs} +0 -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.rhtml → using_defaults.html.erb} +0 -0
- data/vendor/rails/actionpack/test/fixtures/respond_to/{using_defaults.rjs → using_defaults.js.rjs} +0 -0
- data/vendor/rails/actionpack/test/fixtures/respond_to/{using_defaults.rxml → using_defaults.xml.builder} +0 -0
- data/vendor/rails/actionpack/test/fixtures/respond_to/{using_defaults_with_type_list.rhtml → using_defaults_with_type_list.html.erb} +0 -0
- data/vendor/rails/actionpack/test/fixtures/respond_to/{using_defaults_with_type_list.rjs → using_defaults_with_type_list.js.rjs} +0 -0
- data/vendor/rails/actionpack/test/fixtures/respond_to/{using_defaults_with_type_list.rxml → using_defaults_with_type_list.xml.builder} +0 -0
- data/vendor/rails/actionpack/test/fixtures/scope/test/{modgreet.rhtml → modgreet.erb} +0 -0
- data/vendor/rails/actionpack/test/fixtures/test/{_customer.rhtml → _customer.erb} +0 -0
- data/vendor/rails/actionpack/test/fixtures/test/{_customer_greeting.rhtml → _customer_greeting.erb} +0 -0
- data/vendor/rails/actionpack/test/fixtures/test/_hash_greeting.erb +1 -0
- data/vendor/rails/actionpack/test/fixtures/test/_hash_object.erb +2 -0
- data/vendor/rails/actionpack/test/fixtures/test/{_hello.rxml → _hello.builder} +0 -0
- data/vendor/rails/actionpack/test/fixtures/test/_layout_for_partial.html.erb +3 -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/_partial_for_use_in_layout.html.erb +1 -0
- data/vendor/rails/actionpack/test/fixtures/test/{_partial_only.rhtml → _partial_only.erb} +0 -0
- data/vendor/rails/actionpack/test/fixtures/test/{_person.rhtml → _person.erb} +0 -0
- data/vendor/rails/actionpack/test/fixtures/test/{action_talk_to_layout.rhtml → action_talk_to_layout.erb} +0 -0
- data/vendor/rails/actionpack/test/fixtures/test/{block_content_for.rhtml → block_content_for.erb} +0 -0
- data/vendor/rails/actionpack/test/fixtures/test/calling_partial_with_layout.html.erb +1 -0
- data/vendor/rails/actionpack/test/fixtures/test/{capturing.rhtml → capturing.erb} +0 -0
- data/vendor/rails/actionpack/test/fixtures/test/{content_for.rhtml → content_for.erb} +0 -0
- data/vendor/rails/actionpack/test/fixtures/test/content_for_concatenated.erb +3 -0
- data/vendor/rails/actionpack/test/fixtures/test/content_for_with_parameter.erb +2 -0
- data/vendor/rails/actionpack/test/fixtures/test/dot.directory/{render_file_with_ivar.rhtml → render_file_with_ivar.erb} +0 -0
- data/vendor/rails/actionpack/test/fixtures/test/{erb_content_for.rhtml → erb_content_for.erb} +0 -0
- data/vendor/rails/actionpack/test/fixtures/test/formatted_html_erb.html.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/{greeting.rhtml → greeting.erb} +0 -0
- data/vendor/rails/actionpack/test/fixtures/test/{hello.rxml → hello.builder} +0 -0
- data/vendor/rails/actionpack/test/fixtures/test/{hello_world.rhtml → hello_world.erb} +0 -0
- data/vendor/rails/actionpack/test/fixtures/test/{hello_world_container.rxml → hello_world_container.builder} +0 -0
- data/vendor/rails/actionpack/test/fixtures/test/{hello_world.rxml → hello_world_from_rxml.builder} +0 -0
- data/vendor/rails/actionpack/test/fixtures/test/{hello_world_with_layout_false.rhtml → hello_world_with_layout_false.erb} +0 -0
- data/vendor/rails/actionpack/test/fixtures/test/{hello_xml_world.rxml → hello_xml_world.builder} +0 -0
- data/vendor/rails/actionpack/test/fixtures/test/list.erb +1 -0
- data/vendor/rails/actionpack/test/fixtures/test/{non_erb_block_content_for.rxml → non_erb_block_content_for.builder} +0 -0
- data/vendor/rails/actionpack/test/fixtures/test/{potential_conflicts.rhtml → potential_conflicts.erb} +0 -0
- data/vendor/rails/actionpack/test/fixtures/test/{render_file_with_ivar.rhtml → render_file_with_ivar.erb} +0 -0
- data/vendor/rails/actionpack/test/fixtures/test/{render_file_with_locals.rhtml → render_file_with_locals.erb} +0 -0
- data/vendor/rails/actionpack/test/fixtures/test/{render_to_string_test.rhtml → render_to_string_test.erb} +0 -0
- data/vendor/rails/actionpack/test/fixtures/test/{update_element_with_capture.rhtml → update_element_with_capture.erb} +0 -0
- data/vendor/rails/actionpack/test/fixtures/test/using_layout_around_block.html.erb +1 -0
- data/vendor/rails/actionpack/test/fixtures/topic.rb +1 -1
- data/vendor/rails/actionpack/test/template/active_record_helper_test.rb +67 -20
- data/vendor/rails/actionpack/test/template/asset_tag_helper_test.rb +255 -54
- data/vendor/rails/actionpack/test/template/atom_feed_helper_test.rb +101 -0
- data/vendor/rails/actionpack/test/template/benchmark_helper_test.rb +2 -2
- data/vendor/rails/actionpack/test/template/compiled_templates_test.rb +88 -42
- data/vendor/rails/actionpack/test/template/date_helper_test.rb +125 -9
- data/vendor/rails/actionpack/test/template/erb_util_test.rb +56 -0
- data/vendor/rails/actionpack/test/template/form_helper_test.rb +326 -33
- data/vendor/rails/actionpack/test/template/form_options_helper_test.rb +822 -15
- data/vendor/rails/actionpack/test/template/form_tag_helper_test.rb +96 -30
- data/vendor/rails/actionpack/test/template/javascript_helper_test.rb +61 -13
- data/vendor/rails/actionpack/test/template/number_helper_test.rb +12 -11
- data/vendor/rails/actionpack/test/template/prototype_helper_test.rb +185 -24
- data/vendor/rails/actionpack/test/template/sanitize_helper_test.rb +49 -0
- data/vendor/rails/actionpack/test/template/scriptaculous_helper_test.rb +9 -3
- data/vendor/rails/actionpack/test/template/tag_helper_test.rb +13 -2
- data/vendor/rails/actionpack/test/template/text_helper_test.rb +38 -52
- data/vendor/rails/actionpack/test/template/url_helper_test.rb +216 -46
- data/vendor/rails/activemodel/CHANGES +12 -0
- data/vendor/rails/activemodel/README +21 -0
- data/vendor/rails/activemodel/Rakefile +4 -0
- data/vendor/rails/activemodel/lib/active_model.rb +17 -0
- data/vendor/rails/activemodel/lib/active_model/base.rb +4 -0
- data/vendor/rails/activemodel/lib/active_model/callbacks.rb +5 -0
- data/vendor/rails/activemodel/lib/active_model/observing.rb +100 -0
- data/vendor/rails/activemodel/lib/active_model/validations.rb +4 -0
- data/vendor/rails/activemodel/spec/observing_spec.rb +120 -0
- data/vendor/rails/activemodel/spec/spec_helper.rb +17 -0
- data/vendor/rails/activerecord/CHANGELOG +2484 -34
- data/vendor/rails/activerecord/MIT-LICENSE +1 -1
- data/vendor/rails/activerecord/README +1 -15
- data/vendor/rails/activerecord/RUNNING_UNIT_TESTS +3 -34
- data/vendor/rails/activerecord/Rakefile +98 -77
- data/vendor/rails/activerecord/install.rb +1 -1
- data/vendor/rails/activerecord/lib/active_record.rb +13 -22
- data/vendor/rails/activerecord/lib/active_record/aggregations.rb +38 -49
- data/vendor/rails/activerecord/lib/active_record/associations.rb +465 -338
- data/vendor/rails/activerecord/lib/active_record/associations/association_collection.rb +66 -20
- data/vendor/rails/activerecord/lib/active_record/associations/association_proxy.rb +24 -22
- data/vendor/rails/activerecord/lib/active_record/associations/has_and_belongs_to_many_association.rb +46 -51
- data/vendor/rails/activerecord/lib/active_record/associations/has_many_association.rb +21 -57
- data/vendor/rails/activerecord/lib/active_record/associations/has_many_through_association.rb +52 -25
- data/vendor/rails/activerecord/lib/active_record/associations/has_one_association.rb +30 -14
- data/vendor/rails/activerecord/lib/active_record/attribute_methods.rb +253 -0
- data/vendor/rails/activerecord/lib/active_record/base.rb +830 -532
- data/vendor/rails/activerecord/lib/active_record/calculations.rb +60 -63
- data/vendor/rails/activerecord/lib/active_record/callbacks.rb +57 -83
- data/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/connection_specification.rb +38 -9
- data/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb +56 -15
- data/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb +87 -0
- data/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/quoting.rb +23 -12
- data/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb +191 -62
- data/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb +37 -34
- data/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb +28 -17
- data/vendor/rails/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb +119 -37
- data/vendor/rails/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb +473 -210
- data/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb +34 -0
- data/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb +91 -107
- data/vendor/rails/activerecord/lib/active_record/fixtures.rb +522 -116
- data/vendor/rails/activerecord/lib/active_record/locking/optimistic.rb +72 -34
- data/vendor/rails/activerecord/lib/active_record/migration.rb +80 -57
- data/vendor/rails/activerecord/lib/active_record/observer.rb +13 -10
- data/vendor/rails/activerecord/lib/active_record/query_cache.rb +14 -57
- data/vendor/rails/activerecord/lib/active_record/reflection.rb +35 -38
- data/vendor/rails/activerecord/lib/active_record/schema.rb +5 -5
- data/vendor/rails/activerecord/lib/active_record/schema_dumper.rb +35 -13
- data/vendor/rails/activerecord/lib/active_record/serialization.rb +98 -0
- data/vendor/rails/activerecord/lib/active_record/serializers/json_serializer.rb +71 -0
- data/vendor/rails/activerecord/lib/active_record/serializers/xml_serializer.rb +315 -0
- data/vendor/rails/activerecord/lib/active_record/timestamp.rb +20 -21
- data/vendor/rails/activerecord/lib/active_record/transactions.rb +39 -43
- data/vendor/rails/activerecord/lib/active_record/validations.rb +290 -108
- data/vendor/rails/activerecord/lib/active_record/version.rb +3 -3
- data/vendor/rails/activerecord/lib/activerecord.rb +1 -0
- data/vendor/rails/activerecord/test/aaa_create_tables_test.rb +15 -2
- data/vendor/rails/activerecord/test/abstract_unit.rb +24 -17
- data/vendor/rails/activerecord/test/active_schema_test_mysql.rb +20 -8
- data/vendor/rails/activerecord/test/adapter_test.rb +23 -5
- data/vendor/rails/activerecord/test/adapter_test_sqlserver.rb +15 -1
- data/vendor/rails/activerecord/test/aggregations_test.rb +34 -1
- data/vendor/rails/activerecord/test/all.sh +2 -2
- data/vendor/rails/activerecord/test/associations/callbacks_test.rb +51 -30
- data/vendor/rails/activerecord/test/associations/cascaded_eager_loading_test.rb +1 -29
- data/vendor/rails/activerecord/test/associations/eager_singularization_test.rb +145 -0
- data/vendor/rails/activerecord/test/associations/eager_test.rb +42 -6
- data/vendor/rails/activerecord/test/associations/extension_test.rb +6 -1
- data/vendor/rails/activerecord/test/associations/inner_join_association_test.rb +88 -0
- data/vendor/rails/activerecord/test/associations/join_model_test.rb +66 -13
- data/vendor/rails/activerecord/test/associations_test.rb +531 -226
- data/vendor/rails/activerecord/test/attribute_methods_test.rb +97 -0
- data/vendor/rails/activerecord/test/base_test.rb +251 -105
- data/vendor/rails/activerecord/test/binary_test.rb +22 -27
- data/vendor/rails/activerecord/test/calculations_test.rb +37 -5
- data/vendor/rails/activerecord/test/callbacks_test.rb +23 -0
- data/vendor/rails/activerecord/test/connection_test_firebird.rb +2 -2
- data/vendor/rails/activerecord/test/connection_test_mysql.rb +30 -0
- data/vendor/rails/activerecord/test/connections/native_mysql/connection.rb +3 -0
- data/vendor/rails/activerecord/test/connections/native_sqlite/connection.rb +5 -14
- data/vendor/rails/activerecord/test/connections/native_sqlite3/connection.rb +5 -14
- data/vendor/rails/activerecord/test/connections/native_sqlite3/in_memory_connection.rb +1 -1
- data/vendor/rails/activerecord/test/copy_table_test_sqlite.rb +69 -0
- data/vendor/rails/activerecord/test/datatype_test_postgresql.rb +178 -27
- data/vendor/rails/activerecord/test/date_time_test.rb +37 -0
- data/vendor/rails/activerecord/test/defaults_test.rb +6 -14
- data/vendor/rails/activerecord/test/deprecated_finder_test.rb +7 -128
- data/vendor/rails/activerecord/test/finder_test.rb +201 -55
- data/vendor/rails/activerecord/test/fixtures/all/developers.yml +0 -0
- data/vendor/rails/activerecord/test/fixtures/all/people.csv +0 -0
- data/vendor/rails/activerecord/test/fixtures/all/tasks.yml +0 -0
- data/vendor/rails/activerecord/test/fixtures/author.rb +14 -5
- data/vendor/rails/activerecord/test/fixtures/binaries.yml +130 -435
- data/vendor/rails/activerecord/test/fixtures/book.rb +4 -0
- data/vendor/rails/activerecord/test/fixtures/books.yml +7 -0
- data/vendor/rails/activerecord/test/fixtures/category.rb +6 -0
- data/vendor/rails/activerecord/test/fixtures/citation.rb +6 -0
- data/vendor/rails/activerecord/test/fixtures/company.rb +8 -1
- data/vendor/rails/activerecord/test/fixtures/computer.rb +1 -0
- data/vendor/rails/activerecord/test/fixtures/contact.rb +16 -0
- data/vendor/rails/activerecord/test/fixtures/customer.rb +2 -2
- data/vendor/rails/activerecord/test/fixtures/db_definitions/db2.drop.sql +1 -0
- data/vendor/rails/activerecord/test/fixtures/db_definitions/db2.sql +4 -0
- data/vendor/rails/activerecord/test/fixtures/db_definitions/firebird.drop.sql +3 -1
- data/vendor/rails/activerecord/test/fixtures/db_definitions/firebird.sql +6 -0
- data/vendor/rails/activerecord/test/fixtures/db_definitions/frontbase.drop.sql +1 -0
- data/vendor/rails/activerecord/test/fixtures/db_definitions/frontbase.sql +5 -0
- data/vendor/rails/activerecord/test/fixtures/db_definitions/openbase.sql +41 -25
- data/vendor/rails/activerecord/test/fixtures/db_definitions/oracle.drop.sql +2 -0
- data/vendor/rails/activerecord/test/fixtures/db_definitions/oracle.sql +5 -0
- data/vendor/rails/activerecord/test/fixtures/db_definitions/postgresql.drop.sql +7 -0
- data/vendor/rails/activerecord/test/fixtures/db_definitions/postgresql.sql +87 -58
- data/vendor/rails/activerecord/test/fixtures/db_definitions/postgresql2.sql +1 -2
- data/vendor/rails/activerecord/test/fixtures/db_definitions/schema.rb +289 -8
- data/vendor/rails/activerecord/test/fixtures/db_definitions/schema2.rb +11 -0
- data/vendor/rails/activerecord/test/fixtures/db_definitions/sqlite.drop.sql +1 -0
- data/vendor/rails/activerecord/test/fixtures/db_definitions/sqlite.sql +4 -0
- data/vendor/rails/activerecord/test/fixtures/db_definitions/sybase.drop.sql +1 -0
- data/vendor/rails/activerecord/test/fixtures/db_definitions/sybase.sql +4 -0
- data/vendor/rails/activerecord/test/fixtures/developer.rb +10 -0
- data/vendor/rails/activerecord/test/fixtures/example.log +1 -0
- data/vendor/rails/activerecord/test/fixtures/flowers.jpg +0 -0
- data/vendor/rails/activerecord/test/fixtures/item.rb +7 -0
- data/vendor/rails/activerecord/test/fixtures/items.yml +4 -0
- data/vendor/rails/activerecord/test/fixtures/joke.rb +0 -3
- data/vendor/rails/activerecord/test/fixtures/matey.rb +4 -0
- data/vendor/rails/activerecord/test/fixtures/mateys.yml +4 -0
- data/vendor/rails/activerecord/test/fixtures/minimalistic.rb +2 -0
- data/vendor/rails/activerecord/test/fixtures/minimalistics.yml +2 -0
- data/vendor/rails/activerecord/test/fixtures/mixins.yml +2 -100
- data/vendor/rails/activerecord/test/fixtures/parrot.rb +13 -0
- data/vendor/rails/activerecord/test/fixtures/parrots.yml +27 -0
- data/vendor/rails/activerecord/test/fixtures/parrots_pirates.yml +7 -0
- data/vendor/rails/activerecord/test/fixtures/pirate.rb +5 -0
- data/vendor/rails/activerecord/test/fixtures/pirates.yml +9 -0
- data/vendor/rails/activerecord/test/fixtures/post.rb +1 -0
- data/vendor/rails/activerecord/test/fixtures/project.rb +3 -2
- data/vendor/rails/activerecord/test/fixtures/reply.rb +0 -0
- data/vendor/rails/activerecord/test/fixtures/reserved_words/distinct.yml +5 -0
- data/vendor/rails/activerecord/test/fixtures/reserved_words/distincts_selects.yml +11 -0
- data/vendor/rails/activerecord/test/fixtures/reserved_words/group.yml +14 -0
- data/vendor/rails/activerecord/test/fixtures/reserved_words/select.yml +8 -0
- data/vendor/rails/activerecord/test/fixtures/reserved_words/values.yml +7 -0
- data/vendor/rails/activerecord/test/fixtures/ship.rb +3 -0
- data/vendor/rails/activerecord/test/fixtures/ships.yml +5 -0
- data/vendor/rails/activerecord/test/fixtures/tagging.rb +4 -0
- data/vendor/rails/activerecord/test/fixtures/taggings.yml +8 -1
- data/vendor/rails/activerecord/test/fixtures/topic.rb +13 -1
- data/vendor/rails/activerecord/test/fixtures/treasure.rb +4 -0
- data/vendor/rails/activerecord/test/fixtures/treasures.yml +10 -0
- data/vendor/rails/activerecord/test/fixtures_test.rb +220 -23
- data/vendor/rails/activerecord/test/inheritance_test.rb +7 -1
- data/vendor/rails/activerecord/test/json_serialization_test.rb +180 -0
- data/vendor/rails/activerecord/test/lifecycle_test.rb +1 -1
- data/vendor/rails/activerecord/test/locking_test.rb +94 -2
- data/vendor/rails/activerecord/test/migration_test.rb +206 -40
- data/vendor/rails/activerecord/test/mixin_test.rb +13 -515
- data/vendor/rails/activerecord/test/pk_test.rb +3 -6
- data/vendor/rails/activerecord/test/query_cache_test.rb +104 -0
- data/vendor/rails/activerecord/test/readonly_test.rb +0 -0
- data/vendor/rails/activerecord/test/reflection_test.rb +16 -0
- data/vendor/rails/activerecord/test/reserved_word_test_mysql.rb +177 -0
- data/vendor/rails/activerecord/test/schema_dumper_test.rb +38 -3
- data/vendor/rails/activerecord/test/serialization_test.rb +47 -0
- data/vendor/rails/activerecord/test/transactions_test.rb +74 -23
- data/vendor/rails/activerecord/test/unconnected_test.rb +1 -1
- data/vendor/rails/activerecord/test/validations_test.rb +330 -32
- data/vendor/rails/activerecord/test/xml_serialization_test.rb +121 -44
- data/vendor/rails/activeresource/CHANGELOG +223 -0
- data/vendor/rails/activeresource/MIT-LICENSE +20 -0
- data/vendor/rails/activeresource/README +165 -0
- data/vendor/rails/activeresource/Rakefile +133 -0
- data/vendor/rails/activeresource/lib/active_resource.rb +47 -0
- data/vendor/rails/activeresource/lib/active_resource/base.rb +872 -0
- data/vendor/rails/activeresource/lib/active_resource/connection.rb +172 -0
- data/vendor/rails/activeresource/lib/active_resource/custom_methods.rb +105 -0
- data/vendor/rails/activeresource/lib/active_resource/formats.rb +14 -0
- data/vendor/rails/activeresource/lib/active_resource/formats/json_format.rb +23 -0
- data/vendor/rails/activeresource/lib/active_resource/formats/xml_format.rb +34 -0
- data/vendor/rails/activeresource/lib/active_resource/http_mock.rb +147 -0
- data/vendor/rails/activeresource/lib/active_resource/validations.rb +288 -0
- data/vendor/rails/activeresource/lib/active_resource/version.rb +9 -0
- data/vendor/rails/activeresource/lib/activeresource.rb +1 -0
- data/vendor/rails/activeresource/test/abstract_unit.rb +10 -0
- data/vendor/rails/activeresource/test/authorization_test.rb +82 -0
- data/vendor/rails/activeresource/test/base/custom_methods_test.rb +96 -0
- data/vendor/rails/activeresource/test/base/equality_test.rb +43 -0
- data/vendor/rails/activeresource/test/base/load_test.rb +111 -0
- data/vendor/rails/activeresource/test/base_errors_test.rb +48 -0
- data/vendor/rails/activeresource/test/base_test.rb +454 -0
- data/vendor/rails/activeresource/test/connection_test.rb +170 -0
- data/vendor/rails/activeresource/test/fixtures/beast.rb +14 -0
- data/vendor/rails/activeresource/test/fixtures/person.rb +3 -0
- data/vendor/rails/activeresource/test/fixtures/street_address.rb +4 -0
- data/vendor/rails/activeresource/test/format_test.rb +42 -0
- data/vendor/rails/activeresource/test/setter_trap.rb +27 -0
- data/vendor/rails/activesupport/CHANGELOG +274 -7
- data/vendor/rails/activesupport/MIT-LICENSE +1 -1
- data/vendor/rails/activesupport/Rakefile +2 -1
- data/vendor/rails/activesupport/install.rb +1 -1
- data/vendor/rails/activesupport/lib/active_support.rb +9 -4
- data/vendor/rails/activesupport/lib/active_support/basic_object.rb +5 -0
- data/vendor/rails/activesupport/lib/active_support/buffered_logger.rb +107 -0
- data/vendor/rails/activesupport/lib/active_support/clean_logger.rb +94 -5
- data/vendor/rails/activesupport/lib/active_support/core_ext.rb +4 -1
- data/vendor/rails/activesupport/lib/active_support/core_ext/array.rb +8 -2
- data/vendor/rails/activesupport/lib/active_support/core_ext/array/access.rb +28 -0
- data/vendor/rails/activesupport/lib/active_support/core_ext/array/conversions.rb +40 -18
- data/vendor/rails/activesupport/lib/active_support/core_ext/array/extract_options.rb +19 -0
- data/vendor/rails/activesupport/lib/active_support/core_ext/array/grouping.rb +20 -7
- data/vendor/rails/activesupport/lib/active_support/core_ext/array/random_access.rb +12 -0
- data/vendor/rails/activesupport/lib/active_support/core_ext/bigdecimal.rb +1 -2
- data/vendor/rails/activesupport/lib/active_support/core_ext/bigdecimal/conversions.rb +6 -0
- data/vendor/rails/activesupport/lib/active_support/core_ext/blank.rb +2 -8
- data/vendor/rails/activesupport/lib/active_support/core_ext/cgi.rb +2 -2
- data/vendor/rails/activesupport/lib/active_support/core_ext/class.rb +4 -3
- data/vendor/rails/activesupport/lib/active_support/core_ext/class/attribute_accessors.rb +1 -1
- data/vendor/rails/activesupport/lib/active_support/core_ext/class/delegating_attributes.rb +40 -0
- data/vendor/rails/activesupport/lib/active_support/core_ext/class/inheritable_attributes.rb +3 -3
- data/vendor/rails/activesupport/lib/active_support/core_ext/class/removal.rb +2 -2
- data/vendor/rails/activesupport/lib/active_support/core_ext/date.rb +5 -1
- data/vendor/rails/activesupport/lib/active_support/core_ext/date/behavior.rb +13 -0
- data/vendor/rails/activesupport/lib/active_support/core_ext/date/calculations.rb +188 -0
- data/vendor/rails/activesupport/lib/active_support/core_ext/date/conversions.rb +72 -13
- data/vendor/rails/activesupport/lib/active_support/core_ext/date_time.rb +10 -0
- data/vendor/rails/activesupport/lib/active_support/core_ext/date_time/calculations.rb +77 -0
- data/vendor/rails/activesupport/lib/active_support/core_ext/date_time/conversions.rb +74 -0
- data/vendor/rails/activesupport/lib/active_support/core_ext/duplicable.rb +37 -0
- data/vendor/rails/activesupport/lib/active_support/core_ext/enumerable.rb +1 -0
- data/vendor/rails/activesupport/lib/active_support/core_ext/exception.rb +2 -2
- data/vendor/rails/activesupport/lib/active_support/core_ext/file.rb +21 -0
- data/vendor/rails/activesupport/lib/active_support/core_ext/float.rb +5 -0
- data/vendor/rails/activesupport/lib/active_support/core_ext/float/rounding.rb +24 -0
- data/vendor/rails/activesupport/lib/active_support/core_ext/hash.rb +5 -5
- data/vendor/rails/activesupport/lib/active_support/core_ext/hash/conversions.rb +91 -49
- data/vendor/rails/activesupport/lib/active_support/core_ext/hash/diff.rb +8 -0
- data/vendor/rails/activesupport/lib/active_support/core_ext/hash/except.rb +24 -0
- data/vendor/rails/activesupport/lib/active_support/core_ext/hash/indifferent_access.rb +16 -2
- data/vendor/rails/activesupport/lib/active_support/core_ext/hash/keys.rb +9 -8
- data/vendor/rails/activesupport/lib/active_support/core_ext/hash/reverse_merge.rb +2 -2
- data/vendor/rails/activesupport/lib/active_support/core_ext/hash/slice.rb +28 -0
- data/vendor/rails/activesupport/lib/active_support/core_ext/integer.rb +2 -2
- data/vendor/rails/activesupport/lib/active_support/core_ext/integer/even_odd.rb +4 -4
- data/vendor/rails/activesupport/lib/active_support/core_ext/kernel.rb +5 -4
- data/vendor/rails/activesupport/lib/active_support/core_ext/kernel/debugger.rb +13 -0
- data/vendor/rails/activesupport/lib/active_support/core_ext/module.rb +8 -7
- data/vendor/rails/activesupport/lib/active_support/core_ext/module/aliasing.rb +17 -5
- data/vendor/rails/activesupport/lib/active_support/core_ext/module/attr_accessor_with_default.rb +31 -0
- data/vendor/rails/activesupport/lib/active_support/core_ext/module/attribute_accessors.rb +1 -1
- data/vendor/rails/activesupport/lib/active_support/core_ext/module/delegation.rb +21 -0
- data/vendor/rails/activesupport/lib/active_support/core_ext/name_error.rb +2 -2
- data/vendor/rails/activesupport/lib/active_support/core_ext/numeric.rb +2 -2
- data/vendor/rails/activesupport/lib/active_support/core_ext/numeric/time.rb +30 -11
- data/vendor/rails/activesupport/lib/active_support/core_ext/object.rb +4 -2
- data/vendor/rails/activesupport/lib/active_support/core_ext/object/conversions.rb +14 -0
- data/vendor/rails/activesupport/lib/active_support/core_ext/object/extending.rb +40 -29
- data/vendor/rails/activesupport/lib/active_support/core_ext/object/instance_variables.rb +22 -0
- data/vendor/rails/activesupport/lib/active_support/core_ext/object/misc.rb +29 -4
- data/vendor/rails/activesupport/lib/active_support/core_ext/pathname.rb +1 -1
- data/vendor/rails/activesupport/lib/active_support/core_ext/range.rb +7 -1
- data/vendor/rails/activesupport/lib/active_support/core_ext/range/blockless_step.rb +22 -0
- data/vendor/rails/activesupport/lib/active_support/core_ext/range/conversions.rb +11 -9
- data/vendor/rails/activesupport/lib/active_support/core_ext/range/include_range.rb +22 -0
- data/vendor/rails/activesupport/lib/active_support/core_ext/range/overlaps.rb +12 -0
- data/vendor/rails/activesupport/lib/active_support/core_ext/string.rb +16 -8
- data/vendor/rails/activesupport/lib/active_support/core_ext/string/conversions.rb +11 -2
- data/vendor/rails/activesupport/lib/active_support/core_ext/string/starts_ends_with.rb +7 -0
- data/vendor/rails/activesupport/lib/active_support/core_ext/string/unicode.rb +2 -2
- data/vendor/rails/activesupport/lib/active_support/core_ext/string/xchar.rb +11 -0
- data/vendor/rails/activesupport/lib/active_support/core_ext/symbol.rb +12 -10
- data/vendor/rails/activesupport/lib/active_support/core_ext/test.rb +1 -0
- data/vendor/rails/activesupport/lib/active_support/core_ext/test/unit/assertions.rb +62 -0
- data/vendor/rails/activesupport/lib/active_support/core_ext/time.rb +4 -2
- data/vendor/rails/activesupport/lib/active_support/core_ext/time/behavior.rb +13 -0
- data/vendor/rails/activesupport/lib/active_support/core_ext/time/calculations.rb +87 -54
- data/vendor/rails/activesupport/lib/active_support/core_ext/time/conversions.rb +71 -10
- data/vendor/rails/activesupport/lib/active_support/dependencies.rb +32 -31
- data/vendor/rails/activesupport/lib/active_support/deprecation.rb +4 -2
- data/vendor/rails/activesupport/lib/active_support/duration.rb +96 -0
- data/vendor/rails/activesupport/lib/active_support/inflections.rb +2 -1
- data/vendor/rails/activesupport/lib/active_support/inflector.rb +13 -6
- data/vendor/rails/activesupport/lib/active_support/json.rb +22 -39
- data/vendor/rails/activesupport/lib/active_support/json/decoding.rb +60 -0
- data/vendor/rails/activesupport/lib/active_support/json/encoders/date.rb +5 -0
- data/vendor/rails/activesupport/lib/active_support/json/encoders/date_time.rb +5 -0
- data/vendor/rails/activesupport/lib/active_support/json/encoders/enumerable.rb +12 -0
- data/vendor/rails/activesupport/lib/active_support/json/encoders/false_class.rb +5 -0
- data/vendor/rails/activesupport/lib/active_support/json/encoders/hash.rb +50 -0
- data/vendor/rails/activesupport/lib/active_support/json/encoders/nil_class.rb +5 -0
- data/vendor/rails/activesupport/lib/active_support/json/encoders/numeric.rb +5 -0
- data/vendor/rails/activesupport/lib/active_support/json/encoders/object.rb +6 -0
- data/vendor/rails/activesupport/lib/active_support/json/encoders/regexp.rb +5 -0
- data/vendor/rails/activesupport/lib/active_support/json/encoders/string.rb +30 -0
- data/vendor/rails/activesupport/lib/active_support/json/encoders/symbol.rb +5 -0
- data/vendor/rails/activesupport/lib/active_support/json/encoders/time.rb +5 -0
- data/vendor/rails/activesupport/lib/active_support/json/encoders/true_class.rb +5 -0
- data/vendor/rails/activesupport/lib/active_support/json/encoding.rb +38 -0
- data/vendor/rails/activesupport/lib/active_support/json/variable.rb +10 -0
- data/vendor/rails/activesupport/lib/active_support/multibyte.rb +7 -5
- data/vendor/rails/activesupport/lib/active_support/multibyte/chars.rb +14 -2
- data/vendor/rails/activesupport/lib/active_support/multibyte/handlers/utf8_handler.rb +115 -5
- data/vendor/rails/activesupport/lib/active_support/option_merger.rb +7 -7
- data/vendor/rails/activesupport/lib/active_support/ordered_options.rb +22 -17
- data/vendor/rails/activesupport/lib/active_support/test_case.rb +5 -0
- data/vendor/rails/activesupport/lib/active_support/testing.rb +1 -0
- data/vendor/rails/activesupport/lib/active_support/testing/default.rb +12 -0
- data/vendor/rails/activesupport/lib/active_support/values/time_zone.rb +8 -7
- data/vendor/rails/activesupport/lib/active_support/vendor.rb +14 -0
- data/vendor/rails/activesupport/lib/active_support/vendor/builder-2.1.2/blankslate.rb +113 -0
- data/vendor/rails/activesupport/lib/active_support/vendor/{builder.rb → builder-2.1.2/builder.rb} +0 -0
- data/vendor/rails/activesupport/lib/active_support/vendor/builder-2.1.2/builder/blankslate.rb +20 -0
- data/vendor/rails/activesupport/lib/active_support/vendor/builder-2.1.2/builder/css.rb +250 -0
- data/vendor/rails/activesupport/lib/active_support/vendor/builder-2.1.2/builder/xchar.rb +115 -0
- data/vendor/rails/activesupport/lib/active_support/vendor/builder-2.1.2/builder/xmlbase.rb +139 -0
- data/vendor/rails/activesupport/lib/active_support/vendor/builder-2.1.2/builder/xmlevents.rb +63 -0
- data/vendor/rails/activesupport/lib/active_support/vendor/builder-2.1.2/builder/xmlmarkup.rb +328 -0
- data/vendor/rails/activesupport/lib/active_support/vendor/xml-simple-1.0.11/xmlsimple.rb +1021 -0
- data/vendor/rails/activesupport/lib/active_support/version.rb +3 -3
- data/vendor/rails/activesupport/lib/active_support/whiny_nil.rb +12 -12
- data/vendor/rails/activesupport/lib/activesupport.rb +1 -0
- data/vendor/rails/activesupport/test/abstract_unit.rb +13 -0
- data/vendor/rails/activesupport/test/buffered_logger_test.rb +107 -0
- data/vendor/rails/activesupport/test/clean_logger_test.rb +12 -35
- data/vendor/rails/activesupport/test/core_ext/array_ext_test.rb +74 -6
- data/vendor/rails/activesupport/test/core_ext/blank_test.rb +12 -4
- data/vendor/rails/activesupport/test/core_ext/class/class_inheritable_attributes_test.rb +16 -0
- data/vendor/rails/activesupport/test/core_ext/class/delegating_attributes_test.rb +105 -0
- data/vendor/rails/activesupport/test/core_ext/class_test.rb +10 -0
- data/vendor/rails/activesupport/test/core_ext/date_ext_test.rb +180 -4
- data/vendor/rails/activesupport/test/core_ext/date_time_ext_test.rb +230 -0
- data/vendor/rails/activesupport/test/core_ext/duplicable_test.rb +22 -0
- data/vendor/rails/activesupport/test/core_ext/duration_test.rb +21 -0
- data/vendor/rails/activesupport/test/core_ext/enumerable_test.rb +10 -10
- data/vendor/rails/activesupport/test/core_ext/file_test.rb +29 -0
- data/vendor/rails/activesupport/test/core_ext/float_ext_test.rb +25 -0
- data/vendor/rails/activesupport/test/core_ext/hash_ext_test.rb +262 -28
- data/vendor/rails/activesupport/test/core_ext/module/attr_accessor_with_default_test.rb +30 -0
- data/vendor/rails/activesupport/test/core_ext/module/attr_internal_test.rb +11 -11
- data/vendor/rails/activesupport/test/core_ext/module/attribute_accessor_test.rb +7 -7
- data/vendor/rails/activesupport/test/core_ext/module/attribute_aliasing_test.rb +29 -2
- data/vendor/rails/activesupport/test/core_ext/module_test.rb +92 -28
- data/vendor/rails/activesupport/test/core_ext/numeric_ext_test.rb +91 -1
- data/vendor/rails/activesupport/test/core_ext/object_and_class_ext_test.rb +98 -7
- data/vendor/rails/activesupport/test/core_ext/range_ext_test.rb +50 -0
- data/vendor/rails/activesupport/test/core_ext/string_ext_test.rb +40 -12
- data/vendor/rails/activesupport/test/core_ext/time_ext_test.rb +107 -22
- data/vendor/rails/activesupport/test/dependencies_test.rb +30 -31
- data/vendor/rails/activesupport/test/inflector_test.rb +49 -205
- data/vendor/rails/activesupport/test/inflector_test_cases.rb +208 -0
- data/vendor/rails/activesupport/test/json/decoding_test.rb +41 -0
- data/vendor/rails/activesupport/test/json/encoding_test.rb +111 -0
- data/vendor/rails/activesupport/test/multibyte_chars_test.rb +10 -1
- data/vendor/rails/activesupport/test/multibyte_conformance.rb +2 -2
- data/vendor/rails/activesupport/test/multibyte_handler_test.rb +95 -2
- data/vendor/rails/activesupport/test/ordered_options_test.rb +5 -1
- data/vendor/rails/activesupport/test/test_test.rb +73 -0
- data/vendor/rails/activesupport/test/time_zone_test.rb +10 -3
- data/vendor/rails/cleanlogs.sh +0 -0
- data/vendor/rails/pushgems.rb +2 -2
- data/vendor/rails/railties/CHANGELOG +518 -9
- data/vendor/rails/railties/MIT-LICENSE +1 -1
- data/vendor/rails/railties/README +17 -25
- data/vendor/rails/railties/Rakefile +41 -18
- data/vendor/rails/railties/bin/about +1 -1
- data/vendor/rails/railties/bin/console +1 -1
- data/vendor/rails/railties/bin/destroy +1 -1
- data/vendor/rails/railties/bin/generate +1 -1
- data/vendor/rails/railties/bin/performance/request +3 -0
- data/vendor/rails/railties/bin/plugin +1 -1
- data/vendor/rails/railties/bin/rails +0 -0
- data/vendor/rails/railties/bin/runner +1 -1
- data/vendor/rails/railties/bin/server +1 -1
- data/vendor/rails/railties/builtin/rails_info/rails/info.rb +3 -3
- data/vendor/rails/railties/configs/apache.conf +1 -1
- data/vendor/rails/railties/configs/databases/mysql.yml +10 -4
- data/vendor/rails/railties/configs/databases/postgresql.yml +16 -12
- data/vendor/rails/railties/configs/databases/sqlite3.yml +1 -1
- data/vendor/rails/railties/configs/initializers/inflections.rb +10 -0
- data/vendor/rails/railties/configs/initializers/mime_types.rb +5 -0
- data/vendor/rails/railties/configs/routes.rb +23 -11
- data/vendor/rails/railties/dispatches/dispatch.fcgi +0 -0
- data/vendor/rails/railties/dispatches/dispatch.rb +0 -0
- data/vendor/rails/railties/doc/README_FOR_APP +1 -1
- data/vendor/rails/railties/environments/boot.rb +96 -26
- data/vendor/rails/railties/environments/development.rb +2 -5
- data/vendor/rails/railties/environments/environment.rb +24 -25
- data/vendor/rails/railties/environments/production.rb +1 -0
- data/vendor/rails/railties/environments/test.rb +4 -1
- data/vendor/rails/railties/fresh_rakefile +0 -0
- data/vendor/rails/railties/helpers/application.rb +5 -2
- data/vendor/rails/railties/helpers/test_helper.rb +10 -0
- data/vendor/rails/railties/html/422.html +30 -0
- data/vendor/rails/railties/html/500.html +1 -1
- data/vendor/rails/railties/html/index.html +2 -2
- data/vendor/rails/railties/html/javascripts/controls.js +484 -354
- data/vendor/rails/railties/html/javascripts/dragdrop.js +88 -58
- data/vendor/rails/railties/html/javascripts/effects.js +396 -364
- data/vendor/rails/railties/html/javascripts/prototype.js +2817 -1107
- data/vendor/rails/railties/html/robots.txt +5 -1
- data/vendor/rails/railties/lib/commands/console.rb +12 -5
- data/vendor/rails/railties/lib/commands/generate.rb +0 -0
- data/vendor/rails/railties/lib/commands/performance/request.rb +6 -0
- data/vendor/rails/railties/lib/commands/plugin.rb +17 -12
- data/vendor/rails/railties/lib/commands/process/spawner.rb +14 -4
- data/vendor/rails/railties/lib/commands/runner.rb +1 -1
- data/vendor/rails/railties/lib/commands/servers/base.rb +12 -0
- data/vendor/rails/railties/lib/commands/servers/mongrel.rb +5 -1
- data/vendor/rails/railties/lib/commands/servers/webrick.rb +14 -7
- data/vendor/rails/railties/lib/console_app.rb +5 -2
- data/vendor/rails/railties/lib/console_with_helpers.rb +5 -2
- data/vendor/rails/railties/lib/dispatcher.rb +3 -151
- data/vendor/rails/railties/lib/fcgi_handler.rb +79 -81
- data/vendor/rails/railties/lib/initializer.rb +125 -169
- data/vendor/rails/railties/lib/rails/plugin.rb +84 -0
- data/vendor/rails/railties/lib/rails/plugin/loader.rb +150 -0
- data/vendor/rails/railties/lib/rails/plugin/locator.rb +78 -0
- data/vendor/rails/railties/lib/rails/version.rb +3 -3
- data/vendor/rails/railties/lib/rails_generator/base.rb +11 -9
- data/vendor/rails/railties/lib/rails_generator/commands.rb +24 -14
- data/vendor/rails/railties/lib/rails_generator/generators/applications/app/USAGE +0 -7
- data/vendor/rails/railties/lib/rails_generator/generators/applications/app/app_generator.rb +26 -7
- data/vendor/rails/railties/lib/rails_generator/generators/components/controller/USAGE +11 -12
- data/vendor/rails/railties/lib/rails_generator/generators/components/controller/controller_generator.rb +2 -2
- data/vendor/rails/railties/lib/rails_generator/generators/components/controller/templates/functional_test.rb +1 -11
- data/vendor/rails/railties/lib/rails_generator/generators/components/controller/templates/{view.rhtml → view.html.erb} +0 -0
- data/vendor/rails/railties/lib/rails_generator/generators/components/integration_test/USAGE +5 -11
- data/vendor/rails/railties/lib/rails_generator/generators/components/mailer/USAGE +8 -10
- data/vendor/rails/railties/lib/rails_generator/generators/components/mailer/mailer_generator.rb +3 -3
- data/vendor/rails/railties/lib/rails_generator/generators/components/mailer/templates/fixture.erb +3 -0
- data/vendor/rails/railties/lib/rails_generator/generators/components/mailer/templates/fixture.rhtml +0 -3
- data/vendor/rails/railties/lib/rails_generator/generators/components/mailer/templates/unit_test.rb +8 -24
- data/vendor/rails/railties/lib/rails_generator/generators/components/mailer/templates/view.erb +3 -0
- data/vendor/rails/railties/lib/rails_generator/generators/components/mailer/templates/view.rhtml +0 -3
- data/vendor/rails/railties/lib/rails_generator/generators/components/migration/USAGE +23 -8
- data/vendor/rails/railties/lib/rails_generator/generators/components/migration/migration_generator.rb +15 -2
- data/vendor/rails/railties/lib/rails_generator/generators/components/migration/templates/migration.rb +6 -2
- data/vendor/rails/railties/lib/rails_generator/generators/components/model/USAGE +15 -14
- data/vendor/rails/railties/lib/rails_generator/generators/components/model/model_generator.rb +10 -3
- data/vendor/rails/railties/lib/rails_generator/generators/components/model/templates/fixtures.yml +11 -3
- data/vendor/rails/railties/lib/rails_generator/generators/components/model/templates/migration.rb +4 -1
- data/vendor/rails/railties/lib/rails_generator/generators/components/model/templates/unit_test.rb +1 -3
- data/vendor/rails/railties/lib/rails_generator/generators/components/observer/USAGE +5 -7
- data/vendor/rails/railties/lib/rails_generator/generators/components/observer/templates/unit_test.rb +0 -2
- data/vendor/rails/railties/lib/rails_generator/generators/components/plugin/USAGE +8 -18
- data/vendor/rails/railties/lib/rails_generator/generators/components/plugin/plugin_generator.rb +1 -0
- data/vendor/rails/railties/lib/rails_generator/generators/components/plugin/templates/MIT-LICENSE +20 -0
- data/vendor/rails/railties/lib/rails_generator/generators/components/plugin/templates/README +10 -1
- data/vendor/rails/railties/lib/rails_generator/generators/components/plugin/templates/Rakefile +0 -0
- data/vendor/rails/railties/lib/rails_generator/generators/components/plugin/templates/USAGE +1 -1
- data/vendor/rails/railties/lib/rails_generator/generators/components/plugin/templates/init.rb +1 -1
- data/vendor/rails/railties/lib/rails_generator/generators/components/plugin/templates/plugin.rb +1 -1
- data/vendor/rails/railties/lib/rails_generator/generators/components/plugin/templates/tasks.rake +1 -1
- data/vendor/rails/railties/lib/rails_generator/generators/components/resource/USAGE +23 -0
- data/vendor/rails/railties/lib/rails_generator/generators/components/resource/resource_generator.rb +13 -15
- data/vendor/rails/railties/lib/rails_generator/generators/components/resource/templates/controller.rb +1 -1
- data/vendor/rails/railties/lib/rails_generator/generators/components/resource/templates/functional_test.rb +2 -14
- data/vendor/rails/railties/lib/rails_generator/generators/components/scaffold/USAGE +24 -31
- data/vendor/rails/railties/lib/rails_generator/generators/components/scaffold/scaffold_generator.rb +45 -146
- data/vendor/rails/railties/lib/rails_generator/generators/components/scaffold/templates/controller.rb +64 -37
- data/vendor/rails/railties/lib/rails_generator/generators/components/scaffold/templates/functional_test.rb +23 -80
- data/vendor/rails/railties/lib/rails_generator/generators/components/scaffold/templates/{layout.rhtml → layout.html.erb} +0 -0
- data/vendor/rails/railties/lib/rails_generator/generators/components/scaffold/templates/style.css +1 -1
- data/vendor/rails/railties/lib/rails_generator/generators/components/scaffold/templates/view_edit.html.erb +19 -0
- data/vendor/rails/railties/lib/rails_generator/generators/components/scaffold/templates/view_index.html.erb +24 -0
- data/vendor/rails/railties/lib/rails_generator/generators/components/scaffold/templates/view_new.html.erb +18 -0
- data/vendor/rails/railties/lib/rails_generator/generators/components/scaffold/templates/view_show.html.erb +10 -0
- data/vendor/rails/railties/lib/rails_generator/generators/components/session_migration/USAGE +6 -11
- data/vendor/rails/railties/lib/rails_generator/generators/components/session_migration/templates/migration.rb +3 -3
- data/vendor/rails/railties/lib/rails_generator/lookup.rb +45 -10
- data/vendor/rails/railties/lib/rails_generator/scripts.rb +6 -3
- data/vendor/rails/railties/lib/rails_generator/scripts/destroy.rb +23 -0
- data/vendor/rails/railties/lib/rails_generator/secret_key_generator.rb +160 -0
- data/vendor/rails/railties/lib/rails_generator/spec.rb +1 -1
- data/vendor/rails/railties/lib/source_annotation_extractor.rb +62 -0
- data/vendor/rails/railties/lib/tasks/annotations.rake +23 -0
- data/vendor/rails/railties/lib/tasks/databases.rake +260 -84
- data/vendor/rails/railties/lib/tasks/documentation.rake +11 -13
- data/vendor/rails/railties/lib/tasks/framework.rake +14 -8
- data/vendor/rails/railties/lib/tasks/misc.rake +7 -1
- data/vendor/rails/railties/lib/tasks/rails.rb +1 -1
- data/vendor/rails/railties/lib/tasks/testing.rake +5 -7
- data/vendor/rails/railties/lib/test_help.rb +4 -3
- data/vendor/rails/railties/lib/webrick_server.rb +3 -4
- data/vendor/rails/railties/test/abstract_unit.rb +11 -7
- data/vendor/rails/railties/test/boot_test.rb +179 -0
- data/vendor/rails/railties/test/console_app_test.rb +29 -0
- data/vendor/rails/railties/test/fcgi_dispatcher_test.rb +147 -176
- data/vendor/rails/railties/test/fixtures/environment_with_constant.rb +1 -1
- data/vendor/rails/railties/test/fixtures/plugins/default/plugin_with_no_lib_dir/init.rb +0 -0
- data/vendor/rails/railties/test/generators/generator_test_helper.rb +195 -0
- data/vendor/rails/railties/test/generators/rails_model_generator_test.rb +109 -0
- data/vendor/rails/railties/test/generators/rails_resource_generator_test.rb +106 -0
- data/vendor/rails/railties/test/generators/rails_scaffold_generator_test.rb +185 -0
- data/vendor/rails/railties/test/initializer_test.rb +204 -19
- data/vendor/rails/railties/test/plugin_loader_test.rb +140 -0
- data/vendor/rails/railties/test/plugin_locator_test.rb +69 -0
- data/vendor/rails/railties/test/plugin_test.rb +130 -100
- data/vendor/rails/railties/test/plugin_test_helper.rb +29 -0
- data/vendor/rails/railties/test/rails_generator_test.rb +25 -15
- data/vendor/rails/railties/test/rails_info_test.rb +7 -0
- data/vendor/rails/railties/test/secret_key_generation_test.rb +35 -0
- data/vendor/rails/release.rb +4 -4
- metadata +1355 -486
- data/app/views/admin/extension/index.rhtml +0 -45
- data/app/views/admin/layout/edit.rhtml +0 -39
- data/app/views/admin/page/_meta_row.rhtml +0 -4
- data/app/views/admin/page/_tag_reference.rhtml +0 -4
- data/app/views/admin/page/edit.rhtml +0 -140
- data/app/views/admin/page/index.rhtml +0 -31
- data/app/views/admin/user/edit.rhtml +0 -54
- data/app/views/admin/user/preferences.rhtml +0 -29
- data/lib/console_utils.rb +0 -167
- data/lib/plugins/extension_patches/lib/view_paths_extension.rb +0 -23
- data/public/javascripts/admin.js +0 -89
- data/public/javascripts/sitemap.js +0 -131
- data/public/javascripts/tabcontrol.js +0 -125
- data/public/javascripts/tag_reference_search.js +0 -23
- data/test/functional/admin/abstract_model_controller_test.rb +0 -125
- data/test/functional/admin/export_controller_test.rb +0 -23
- data/test/functional/admin/extension_controller_test.rb +0 -41
- data/test/functional/admin/layout_controller_test.rb +0 -42
- data/test/functional/admin/page_controller_test.rb +0 -300
- data/test/functional/admin/snippet_controller_test.rb +0 -11
- data/test/functional/admin/user_controller_test.rb +0 -90
- data/test/functional/admin/welcome_controller_test.rb +0 -51
- data/test/functional/application_controller_test.rb +0 -45
- data/test/functional/extension_initialization_test.rb +0 -131
- data/test/functional/extension_load_order_test.rb +0 -49
- data/test/functional/login_system_test.rb +0 -138
- data/test/functional/site_controller_test.rb +0 -203
- data/test/unit/admin_ui_test.rb +0 -93
- data/test/unit/annotatable_test.rb +0 -76
- data/test/unit/extension_migrator_test.rb +0 -17
- data/test/unit/extension_test.rb +0 -42
- data/test/unit/file_not_found_page_test.rb +0 -31
- data/test/unit/inheritable_class_attributes_test.rb +0 -47
- data/test/unit/layout_test.rb +0 -29
- data/test/unit/local_time_test.rb +0 -45
- data/test/unit/method_observer_test.rb +0 -53
- data/test/unit/page_context_test.rb +0 -60
- data/test/unit/page_part_test.rb +0 -44
- data/test/unit/page_test.rb +0 -449
- data/test/unit/radiant/config_test.rb +0 -57
- data/test/unit/radiant/exporter_test.rb +0 -26
- data/test/unit/radiant/taggable_test.rb +0 -105
- data/test/unit/response_cache_test.rb +0 -233
- data/test/unit/simpleton_test.rb +0 -42
- data/test/unit/snippet_test.rb +0 -47
- data/test/unit/standard_tags_test.rb +0 -472
- data/test/unit/status_test.rb +0 -43
- data/test/unit/text_filter_test.rb +0 -42
- data/test/unit/user_action_observer_test.rb +0 -40
- data/test/unit/user_test.rb +0 -137
- data/vendor/rails/actionmailer/lib/action_mailer/vendor/tmail.rb +0 -3
- data/vendor/rails/actionmailer/lib/action_mailer/vendor/tmail/address.rb +0 -242
- data/vendor/rails/actionmailer/lib/action_mailer/vendor/tmail/attachments.rb +0 -39
- data/vendor/rails/actionmailer/lib/action_mailer/vendor/tmail/base64.rb +0 -71
- data/vendor/rails/actionmailer/lib/action_mailer/vendor/tmail/config.rb +0 -69
- data/vendor/rails/actionmailer/lib/action_mailer/vendor/tmail/encode.rb +0 -467
- data/vendor/rails/actionmailer/lib/action_mailer/vendor/tmail/header.rb +0 -914
- data/vendor/rails/actionmailer/lib/action_mailer/vendor/tmail/mail.rb +0 -447
- data/vendor/rails/actionmailer/lib/action_mailer/vendor/tmail/mailbox.rb +0 -433
- data/vendor/rails/actionmailer/lib/action_mailer/vendor/tmail/net.rb +0 -280
- data/vendor/rails/actionmailer/lib/action_mailer/vendor/tmail/obsolete.rb +0 -135
- data/vendor/rails/actionmailer/lib/action_mailer/vendor/tmail/parser.rb +0 -1522
- data/vendor/rails/actionmailer/lib/action_mailer/vendor/tmail/port.rb +0 -377
- data/vendor/rails/actionmailer/lib/action_mailer/vendor/tmail/quoting.rb +0 -131
- data/vendor/rails/actionmailer/lib/action_mailer/vendor/tmail/scanner.rb +0 -41
- data/vendor/rails/actionmailer/lib/action_mailer/vendor/tmail/scanner_r.rb +0 -263
- data/vendor/rails/actionmailer/lib/action_mailer/vendor/tmail/stringio.rb +0 -277
- data/vendor/rails/actionmailer/lib/action_mailer/vendor/tmail/utils.rb +0 -238
- data/vendor/rails/actionmailer/test/fixtures/helper_mailer/use_test_helper.rhtml +0 -1
- data/vendor/rails/actionmailer/test/fixtures/helpers/test_helper.rb +0 -5
- data/vendor/rails/actionmailer/test/fixtures/raw_email11 +0 -34
- data/vendor/rails/actionpack/examples/address_book/index.rhtml +0 -33
- data/vendor/rails/actionpack/examples/address_book/layout.rhtml +0 -8
- data/vendor/rails/actionpack/examples/address_book_controller.cgi +0 -9
- data/vendor/rails/actionpack/examples/address_book_controller.fcgi +0 -6
- data/vendor/rails/actionpack/examples/address_book_controller.rb +0 -52
- data/vendor/rails/actionpack/examples/address_book_controller.rbx +0 -4
- data/vendor/rails/actionpack/examples/benchmark.rb +0 -52
- data/vendor/rails/actionpack/examples/benchmark_with_ar.fcgi +0 -89
- data/vendor/rails/actionpack/examples/blog_controller.cgi +0 -53
- data/vendor/rails/actionpack/examples/debate/index.rhtml +0 -14
- data/vendor/rails/actionpack/examples/debate/new_topic.rhtml +0 -22
- data/vendor/rails/actionpack/examples/debate/topic.rhtml +0 -32
- data/vendor/rails/actionpack/examples/debate_controller.cgi +0 -57
- data/vendor/rails/actionpack/lib/action_controller/assertions/deprecated_assertions.rb +0 -228
- data/vendor/rails/actionpack/lib/action_controller/cgi_ext/cgi_ext.rb +0 -36
- data/vendor/rails/actionpack/lib/action_controller/cgi_ext/cgi_methods.rb +0 -211
- data/vendor/rails/actionpack/lib/action_controller/cgi_ext/cookie_performance_fix.rb +0 -125
- data/vendor/rails/actionpack/lib/action_controller/cgi_ext/pstore_performance_fix.rb +0 -30
- data/vendor/rails/actionpack/lib/action_controller/cgi_ext/raw_post_data_fix.rb +0 -95
- data/vendor/rails/actionpack/lib/action_controller/cgi_ext/session_performance_fix.rb +0 -30
- data/vendor/rails/actionpack/lib/action_controller/deprecated_dependencies.rb +0 -65
- data/vendor/rails/actionpack/lib/action_controller/deprecated_redirects.rb +0 -17
- data/vendor/rails/actionpack/lib/action_controller/deprecated_request_methods.rb +0 -34
- data/vendor/rails/actionpack/lib/action_controller/macros/auto_complete.rb +0 -53
- data/vendor/rails/actionpack/lib/action_controller/macros/in_place_editing.rb +0 -33
- data/vendor/rails/actionpack/lib/action_controller/pagination.rb +0 -408
- data/vendor/rails/actionpack/lib/action_controller/scaffolding.rb +0 -189
- data/vendor/rails/actionpack/lib/action_controller/templates/rescues/_request_and_response.rhtml +0 -44
- data/vendor/rails/actionpack/lib/action_controller/templates/rescues/diagnostics.rhtml +0 -11
- data/vendor/rails/actionpack/lib/action_controller/templates/rescues/template_error.rhtml +0 -21
- data/vendor/rails/actionpack/lib/action_controller/templates/scaffolds/edit.rhtml +0 -7
- data/vendor/rails/actionpack/lib/action_controller/templates/scaffolds/layout.rhtml +0 -69
- data/vendor/rails/actionpack/lib/action_controller/templates/scaffolds/list.rhtml +0 -27
- data/vendor/rails/actionpack/lib/action_controller/templates/scaffolds/new.rhtml +0 -6
- data/vendor/rails/actionpack/lib/action_controller/templates/scaffolds/show.rhtml +0 -9
- data/vendor/rails/actionpack/lib/action_controller/vendor/xml_node.rb +0 -97
- data/vendor/rails/actionpack/lib/action_view/helpers/deprecated_helper.rb +0 -37
- data/vendor/rails/actionpack/lib/action_view/helpers/java_script_macros_helper.rb +0 -233
- data/vendor/rails/actionpack/lib/action_view/helpers/pagination_helper.rb +0 -86
- data/vendor/rails/actionpack/test/activerecord/active_record_assertions_test.rb +0 -92
- data/vendor/rails/actionpack/test/activerecord/pagination_test.rb +0 -165
- data/vendor/rails/actionpack/test/controller/deprecated_instance_variables_test.rb +0 -48
- data/vendor/rails/actionpack/test/controller/raw_post_test.rb +0 -68
- data/vendor/rails/actionpack/test/fixtures/deprecated_instance_variables/_cookies_ivar.rhtml +0 -1
- data/vendor/rails/actionpack/test/fixtures/deprecated_instance_variables/_cookies_method.rhtml +0 -1
- data/vendor/rails/actionpack/test/fixtures/deprecated_instance_variables/_flash_ivar.rhtml +0 -1
- data/vendor/rails/actionpack/test/fixtures/deprecated_instance_variables/_flash_method.rhtml +0 -1
- data/vendor/rails/actionpack/test/fixtures/deprecated_instance_variables/_headers_ivar.rhtml +0 -1
- data/vendor/rails/actionpack/test/fixtures/deprecated_instance_variables/_headers_method.rhtml +0 -1
- data/vendor/rails/actionpack/test/fixtures/deprecated_instance_variables/_params_ivar.rhtml +0 -1
- data/vendor/rails/actionpack/test/fixtures/deprecated_instance_variables/_params_method.rhtml +0 -1
- data/vendor/rails/actionpack/test/fixtures/deprecated_instance_variables/_request_ivar.rhtml +0 -1
- data/vendor/rails/actionpack/test/fixtures/deprecated_instance_variables/_request_method.rhtml +0 -1
- data/vendor/rails/actionpack/test/fixtures/deprecated_instance_variables/_response_ivar.rhtml +0 -1
- data/vendor/rails/actionpack/test/fixtures/deprecated_instance_variables/_response_method.rhtml +0 -1
- data/vendor/rails/actionpack/test/fixtures/deprecated_instance_variables/_session_ivar.rhtml +0 -1
- data/vendor/rails/actionpack/test/fixtures/deprecated_instance_variables/_session_method.rhtml +0 -1
- data/vendor/rails/actionpack/test/fixtures/respond_to/layouts/standard.rhtml +0 -1
- data/vendor/rails/actionpack/test/fixtures/test/_hash_object.rhtml +0 -1
- data/vendor/rails/actionpack/test/fixtures/test/list.rhtml +0 -1
- data/vendor/rails/actionpack/test/template/deprecated_helper_test.rb +0 -36
- data/vendor/rails/actionpack/test/template/deprecated_instance_variables_test.rb +0 -43
- data/vendor/rails/actionpack/test/template/java_script_macros_helper_test.rb +0 -109
- data/vendor/rails/actionwebservice/CHANGELOG +0 -293
- data/vendor/rails/actionwebservice/MIT-LICENSE +0 -21
- data/vendor/rails/actionwebservice/README +0 -364
- data/vendor/rails/actionwebservice/Rakefile +0 -171
- data/vendor/rails/actionwebservice/TODO +0 -32
- data/vendor/rails/actionwebservice/examples/googlesearch/README +0 -143
- data/vendor/rails/actionwebservice/examples/googlesearch/autoloading/google_search_api.rb +0 -50
- data/vendor/rails/actionwebservice/examples/googlesearch/autoloading/google_search_controller.rb +0 -57
- data/vendor/rails/actionwebservice/examples/googlesearch/delegated/google_search_service.rb +0 -108
- data/vendor/rails/actionwebservice/examples/googlesearch/delegated/search_controller.rb +0 -7
- data/vendor/rails/actionwebservice/examples/googlesearch/direct/google_search_api.rb +0 -50
- data/vendor/rails/actionwebservice/examples/googlesearch/direct/search_controller.rb +0 -58
- data/vendor/rails/actionwebservice/examples/metaWeblog/README +0 -17
- data/vendor/rails/actionwebservice/examples/metaWeblog/apis/blogger_api.rb +0 -60
- data/vendor/rails/actionwebservice/examples/metaWeblog/apis/blogger_service.rb +0 -34
- data/vendor/rails/actionwebservice/examples/metaWeblog/apis/meta_weblog_api.rb +0 -67
- data/vendor/rails/actionwebservice/examples/metaWeblog/apis/meta_weblog_service.rb +0 -48
- data/vendor/rails/actionwebservice/examples/metaWeblog/controllers/xmlrpc_controller.rb +0 -16
- data/vendor/rails/actionwebservice/install.rb +0 -30
- data/vendor/rails/actionwebservice/lib/action_web_service.rb +0 -66
- data/vendor/rails/actionwebservice/lib/action_web_service/api.rb +0 -249
- data/vendor/rails/actionwebservice/lib/action_web_service/base.rb +0 -42
- data/vendor/rails/actionwebservice/lib/action_web_service/casting.rb +0 -136
- data/vendor/rails/actionwebservice/lib/action_web_service/client.rb +0 -3
- data/vendor/rails/actionwebservice/lib/action_web_service/client/base.rb +0 -28
- data/vendor/rails/actionwebservice/lib/action_web_service/client/soap_client.rb +0 -113
- data/vendor/rails/actionwebservice/lib/action_web_service/client/xmlrpc_client.rb +0 -58
- data/vendor/rails/actionwebservice/lib/action_web_service/container.rb +0 -3
- data/vendor/rails/actionwebservice/lib/action_web_service/container/action_controller_container.rb +0 -93
- data/vendor/rails/actionwebservice/lib/action_web_service/container/delegated_container.rb +0 -86
- data/vendor/rails/actionwebservice/lib/action_web_service/container/direct_container.rb +0 -69
- data/vendor/rails/actionwebservice/lib/action_web_service/dispatcher.rb +0 -2
- data/vendor/rails/actionwebservice/lib/action_web_service/dispatcher/abstract.rb +0 -203
- data/vendor/rails/actionwebservice/lib/action_web_service/dispatcher/action_controller_dispatcher.rb +0 -376
- data/vendor/rails/actionwebservice/lib/action_web_service/invocation.rb +0 -202
- data/vendor/rails/actionwebservice/lib/action_web_service/protocol.rb +0 -4
- data/vendor/rails/actionwebservice/lib/action_web_service/protocol/abstract.rb +0 -112
- data/vendor/rails/actionwebservice/lib/action_web_service/protocol/discovery.rb +0 -37
- data/vendor/rails/actionwebservice/lib/action_web_service/protocol/soap_protocol.rb +0 -176
- data/vendor/rails/actionwebservice/lib/action_web_service/protocol/soap_protocol/marshaler.rb +0 -241
- data/vendor/rails/actionwebservice/lib/action_web_service/protocol/xmlrpc_protocol.rb +0 -110
- data/vendor/rails/actionwebservice/lib/action_web_service/scaffolding.rb +0 -283
- data/vendor/rails/actionwebservice/lib/action_web_service/struct.rb +0 -68
- data/vendor/rails/actionwebservice/lib/action_web_service/support/class_inheritable_options.rb +0 -26
- data/vendor/rails/actionwebservice/lib/action_web_service/support/signature_types.rb +0 -222
- data/vendor/rails/actionwebservice/lib/action_web_service/templates/scaffolds/layout.rhtml +0 -65
- data/vendor/rails/actionwebservice/lib/action_web_service/templates/scaffolds/methods.rhtml +0 -6
- data/vendor/rails/actionwebservice/lib/action_web_service/templates/scaffolds/parameters.rhtml +0 -29
- data/vendor/rails/actionwebservice/lib/action_web_service/templates/scaffolds/result.rhtml +0 -30
- data/vendor/rails/actionwebservice/lib/action_web_service/test_invoke.rb +0 -110
- data/vendor/rails/actionwebservice/lib/action_web_service/version.rb +0 -9
- data/vendor/rails/actionwebservice/setup.rb +0 -1379
- data/vendor/rails/actionwebservice/test/abstract_client.rb +0 -183
- data/vendor/rails/actionwebservice/test/abstract_dispatcher.rb +0 -505
- data/vendor/rails/actionwebservice/test/abstract_unit.rb +0 -45
- data/vendor/rails/actionwebservice/test/api_test.rb +0 -102
- data/vendor/rails/actionwebservice/test/apis/auto_load_api.rb +0 -3
- data/vendor/rails/actionwebservice/test/apis/broken_auto_load_api.rb +0 -2
- data/vendor/rails/actionwebservice/test/base_test.rb +0 -42
- data/vendor/rails/actionwebservice/test/casting_test.rb +0 -86
- data/vendor/rails/actionwebservice/test/client_soap_test.rb +0 -152
- data/vendor/rails/actionwebservice/test/client_xmlrpc_test.rb +0 -151
- data/vendor/rails/actionwebservice/test/container_test.rb +0 -73
- data/vendor/rails/actionwebservice/test/dispatcher_action_controller_soap_test.rb +0 -137
- data/vendor/rails/actionwebservice/test/dispatcher_action_controller_xmlrpc_test.rb +0 -59
- data/vendor/rails/actionwebservice/test/fixtures/db_definitions/mysql.sql +0 -7
- data/vendor/rails/actionwebservice/test/fixtures/users.yml +0 -10
- data/vendor/rails/actionwebservice/test/gencov +0 -3
- data/vendor/rails/actionwebservice/test/invocation_test.rb +0 -185
- data/vendor/rails/actionwebservice/test/run +0 -6
- data/vendor/rails/actionwebservice/test/scaffolded_controller_test.rb +0 -146
- data/vendor/rails/actionwebservice/test/struct_test.rb +0 -52
- data/vendor/rails/actionwebservice/test/test_invoke_test.rb +0 -112
- data/vendor/rails/activerecord/benchmarks/benchmark.rb +0 -26
- data/vendor/rails/activerecord/benchmarks/mysql_benchmark.rb +0 -19
- data/vendor/rails/activerecord/examples/associations.rb +0 -87
- data/vendor/rails/activerecord/examples/shared_setup.rb +0 -15
- data/vendor/rails/activerecord/examples/validation.rb +0 -85
- data/vendor/rails/activerecord/lib/active_record/acts/list.rb +0 -256
- data/vendor/rails/activerecord/lib/active_record/acts/nested_set.rb +0 -211
- data/vendor/rails/activerecord/lib/active_record/acts/tree.rb +0 -96
- data/vendor/rails/activerecord/lib/active_record/connection_adapters/db2_adapter.rb +0 -228
- data/vendor/rails/activerecord/lib/active_record/connection_adapters/firebird_adapter.rb +0 -728
- data/vendor/rails/activerecord/lib/active_record/connection_adapters/frontbase_adapter.rb +0 -861
- data/vendor/rails/activerecord/lib/active_record/connection_adapters/openbase_adapter.rb +0 -350
- data/vendor/rails/activerecord/lib/active_record/connection_adapters/oracle_adapter.rb +0 -690
- data/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlserver_adapter.rb +0 -607
- data/vendor/rails/activerecord/lib/active_record/connection_adapters/sybase_adapter.rb +0 -662
- data/vendor/rails/activerecord/lib/active_record/deprecated_associations.rb +0 -104
- data/vendor/rails/activerecord/lib/active_record/deprecated_finders.rb +0 -44
- data/vendor/rails/activerecord/lib/active_record/vendor/simple.rb +0 -693
- data/vendor/rails/activerecord/lib/active_record/wrappers/yaml_wrapper.rb +0 -15
- data/vendor/rails/activerecord/lib/active_record/wrappings.rb +0 -58
- data/vendor/rails/activerecord/lib/active_record/xml_serialization.rb +0 -308
- data/vendor/rails/activerecord/test/connections/native_sqlserver/connection.rb +0 -23
- data/vendor/rails/activerecord/test/connections/native_sqlserver_odbc/connection.rb +0 -25
- data/vendor/rails/activerecord/test/copy_table_sqlite.rb +0 -64
- data/vendor/rails/activerecord/test/deprecated_associations_test.rb +0 -396
- data/vendor/rails/activerecord/test/empty_date_time_test.rb +0 -25
- data/vendor/rails/activerecord/test/fixtures/db_definitions/mysql.drop.sql +0 -32
- data/vendor/rails/activerecord/test/fixtures/db_definitions/mysql.sql +0 -234
- data/vendor/rails/activerecord/test/fixtures/db_definitions/mysql2.drop.sql +0 -2
- data/vendor/rails/activerecord/test/fixtures/db_definitions/mysql2.sql +0 -5
- data/vendor/rails/activerecord/test/fixtures/db_definitions/sqlserver.drop.sql +0 -34
- data/vendor/rails/activerecord/test/fixtures/db_definitions/sqlserver.sql +0 -243
- data/vendor/rails/activerecord/test/fixtures/db_definitions/sqlserver2.drop.sql +0 -2
- data/vendor/rails/activerecord/test/fixtures/db_definitions/sqlserver2.sql +0 -5
- data/vendor/rails/activerecord/test/fixtures/mixin.rb +0 -63
- data/vendor/rails/activerecord/test/mixin_nested_set_test.rb +0 -196
- data/vendor/rails/activesupport/lib/active_support/binding_of_caller.rb +0 -84
- data/vendor/rails/activesupport/lib/active_support/breakpoint.rb +0 -528
- data/vendor/rails/activesupport/lib/active_support/caching_tools.rb +0 -62
- data/vendor/rails/activesupport/lib/active_support/core_ext/bigdecimal/formatting.rb +0 -7
- data/vendor/rails/activesupport/lib/active_support/json/encoders.rb +0 -25
- data/vendor/rails/activesupport/lib/active_support/json/encoders/core.rb +0 -70
- data/vendor/rails/activesupport/lib/active_support/reloadable.rb +0 -60
- data/vendor/rails/activesupport/lib/active_support/vendor/builder/blankslate.rb +0 -63
- data/vendor/rails/activesupport/lib/active_support/vendor/builder/xchar.rb +0 -112
- data/vendor/rails/activesupport/lib/active_support/vendor/builder/xmlbase.rb +0 -145
- data/vendor/rails/activesupport/lib/active_support/vendor/builder/xmlevents.rb +0 -63
- data/vendor/rails/activesupport/lib/active_support/vendor/builder/xmlmarkup.rb +0 -327
- data/vendor/rails/activesupport/lib/active_support/vendor/xml_simple.rb +0 -1021
- data/vendor/rails/activesupport/test/caching_tools_test.rb +0 -79
- data/vendor/rails/activesupport/test/core_ext/module/attr_accessor_with_default.rb +0 -30
- data/vendor/rails/activesupport/test/json_test.rb +0 -97
- data/vendor/rails/activesupport/test/reloadable_test.rb +0 -123
- data/vendor/rails/railties/bin/breakpointer +0 -3
- data/vendor/rails/railties/lib/binding_of_caller.rb +0 -85
- data/vendor/rails/railties/lib/breakpoint.rb +0 -553
- data/vendor/rails/railties/lib/breakpoint_client.rb +0 -196
- data/vendor/rails/railties/lib/commands/breakpointer.rb +0 -1
- data/vendor/rails/railties/lib/rails_generator/generators/components/resource/templates/USAGE +0 -18
- data/vendor/rails/railties/lib/rails_generator/generators/components/resource/templates/fixtures.yml +0 -11
- data/vendor/rails/railties/lib/rails_generator/generators/components/resource/templates/migration.rb +0 -13
- data/vendor/rails/railties/lib/rails_generator/generators/components/resource/templates/model.rb +0 -2
- data/vendor/rails/railties/lib/rails_generator/generators/components/resource/templates/unit_test.rb +0 -10
- data/vendor/rails/railties/lib/rails_generator/generators/components/scaffold/templates/form.rhtml +0 -3
- data/vendor/rails/railties/lib/rails_generator/generators/components/scaffold/templates/form_scaffolding.rhtml +0 -1
- data/vendor/rails/railties/lib/rails_generator/generators/components/scaffold/templates/view_edit.rhtml +0 -9
- data/vendor/rails/railties/lib/rails_generator/generators/components/scaffold/templates/view_list.rhtml +0 -27
- data/vendor/rails/railties/lib/rails_generator/generators/components/scaffold/templates/view_new.rhtml +0 -8
- data/vendor/rails/railties/lib/rails_generator/generators/components/scaffold/templates/view_show.rhtml +0 -8
- data/vendor/rails/railties/lib/rails_generator/generators/components/scaffold_resource/USAGE +0 -29
- data/vendor/rails/railties/lib/rails_generator/generators/components/scaffold_resource/scaffold_resource_generator.rb +0 -93
- data/vendor/rails/railties/lib/rails_generator/generators/components/scaffold_resource/templates/controller.rb +0 -79
- data/vendor/rails/railties/lib/rails_generator/generators/components/scaffold_resource/templates/fixtures.yml +0 -11
- data/vendor/rails/railties/lib/rails_generator/generators/components/scaffold_resource/templates/functional_test.rb +0 -57
- data/vendor/rails/railties/lib/rails_generator/generators/components/scaffold_resource/templates/helper.rb +0 -2
- data/vendor/rails/railties/lib/rails_generator/generators/components/scaffold_resource/templates/layout.rhtml +0 -17
- data/vendor/rails/railties/lib/rails_generator/generators/components/scaffold_resource/templates/migration.rb +0 -13
- data/vendor/rails/railties/lib/rails_generator/generators/components/scaffold_resource/templates/model.rb +0 -2
- data/vendor/rails/railties/lib/rails_generator/generators/components/scaffold_resource/templates/style.css +0 -74
- data/vendor/rails/railties/lib/rails_generator/generators/components/scaffold_resource/templates/unit_test.rb +0 -10
- data/vendor/rails/railties/lib/rails_generator/generators/components/scaffold_resource/templates/view_edit.rhtml +0 -19
- data/vendor/rails/railties/lib/rails_generator/generators/components/scaffold_resource/templates/view_index.rhtml +0 -24
- data/vendor/rails/railties/lib/rails_generator/generators/components/scaffold_resource/templates/view_new.rhtml +0 -18
- data/vendor/rails/railties/lib/rails_generator/generators/components/scaffold_resource/templates/view_show.rhtml +0 -10
- data/vendor/rails/railties/lib/rails_generator/generators/components/web_service/USAGE +0 -28
- data/vendor/rails/railties/lib/rails_generator/generators/components/web_service/templates/api_definition.rb +0 -5
- data/vendor/rails/railties/lib/rails_generator/generators/components/web_service/templates/controller.rb +0 -8
- data/vendor/rails/railties/lib/rails_generator/generators/components/web_service/templates/functional_test.rb +0 -19
- data/vendor/rails/railties/lib/rails_generator/generators/components/web_service/web_service_generator.rb +0 -29
- data/vendor/rails/railties/lib/tasks/pre_namespace_aliases.rake +0 -53
- data/vendor/rails/railties/test/dispatcher_test.rb +0 -141
- data/vendor/rails/railties/test/mocks/dispatcher.rb +0 -13
- data/vendor/rails/railties/test/mocks/fcgi.rb +0 -15
- data/vendor/rails/railties/test/mocks/stubbed_breakpoint.rb +0 -2
- data/vendor/rails/railties/test/mocks/stubbed_kernel.rb +0 -5
@@ -1,40 +1,108 @@
|
|
1
1
|
require 'base64'
|
2
2
|
require 'yaml'
|
3
3
|
require 'set'
|
4
|
-
require 'active_record/deprecated_finders'
|
5
4
|
|
6
5
|
module ActiveRecord #:nodoc:
|
7
|
-
|
6
|
+
# Generic ActiveRecord exception class.
|
7
|
+
class ActiveRecordError < StandardError
|
8
8
|
end
|
9
|
+
|
10
|
+
# Raised when the single-table inheritance mechanism failes to locate the subclass
|
11
|
+
# (for example due to improper usage of column that +inheritance_column+ points to).
|
9
12
|
class SubclassNotFound < ActiveRecordError #:nodoc:
|
10
13
|
end
|
11
|
-
|
14
|
+
|
15
|
+
# Raised when object assigned to association is of incorrect type.
|
16
|
+
#
|
17
|
+
# Example:
|
18
|
+
#
|
19
|
+
# class Ticket < ActiveRecord::Base
|
20
|
+
# has_many :patches
|
21
|
+
# end
|
22
|
+
#
|
23
|
+
# class Patch < ActiveRecord::Base
|
24
|
+
# belongs_to :ticket
|
25
|
+
# end
|
26
|
+
#
|
27
|
+
# and somewhere in the code:
|
28
|
+
#
|
29
|
+
# @ticket.patches << Comment.new(:content => "Please attach tests to your patch.")
|
30
|
+
# @ticket.save
|
31
|
+
class AssociationTypeMismatch < ActiveRecordError
|
12
32
|
end
|
13
|
-
|
33
|
+
|
34
|
+
# Raised when unserialized object's type mismatches one specified for serializable field.
|
35
|
+
class SerializationTypeMismatch < ActiveRecordError
|
14
36
|
end
|
15
|
-
|
37
|
+
|
38
|
+
# Raised when adapter not specified on connection (or configuration file config/database.yml misses adapter field).
|
39
|
+
class AdapterNotSpecified < ActiveRecordError
|
16
40
|
end
|
17
|
-
|
41
|
+
|
42
|
+
# Raised when ActiveRecord cannot find database adapter specified in config/database.yml or programmatically.
|
43
|
+
class AdapterNotFound < ActiveRecordError
|
18
44
|
end
|
19
|
-
|
45
|
+
|
46
|
+
# Raised when connection to the database could not been established (for example when connection= is given a nil object).
|
47
|
+
class ConnectionNotEstablished < ActiveRecordError
|
20
48
|
end
|
21
|
-
|
49
|
+
|
50
|
+
# Raised when ActiveRecord cannot find record by given id or set of ids.
|
51
|
+
class RecordNotFound < ActiveRecordError
|
22
52
|
end
|
23
|
-
|
53
|
+
|
54
|
+
# Raised by ActiveRecord::Base.save! and ActiveRecord::Base.create! methods when record cannot be
|
55
|
+
# saved because record is invalid.
|
56
|
+
class RecordNotSaved < ActiveRecordError
|
24
57
|
end
|
25
|
-
|
58
|
+
|
59
|
+
# Raised when SQL statement cannot be executed by the database (for example, it's often the case for MySQL when Ruby driver used is too old).
|
60
|
+
class StatementInvalid < ActiveRecordError
|
26
61
|
end
|
27
|
-
|
62
|
+
|
63
|
+
# Raised when number of bind variables in statement given to :condition key (for example, when using +find+ method)
|
64
|
+
# does not match number of expected variables.
|
65
|
+
#
|
66
|
+
# Example:
|
67
|
+
#
|
68
|
+
# Location.find :all, :conditions => ["lat = ? AND lng = ?", 53.7362]
|
69
|
+
#
|
70
|
+
# in example above two placeholders are given but only one variable to fill them.
|
71
|
+
class PreparedStatementInvalid < ActiveRecordError
|
28
72
|
end
|
29
|
-
|
73
|
+
|
74
|
+
# Raised on attempt to save stale record. Record is stale when it's being saved in another query after
|
75
|
+
# instantiation, for example, when two users edit the same wiki page and one starts editing and saves
|
76
|
+
# the page before the other.
|
77
|
+
#
|
78
|
+
# Read more about optimistic locking in +ActiveRecord::Locking+ module RDoc.
|
79
|
+
class StaleObjectError < ActiveRecordError
|
30
80
|
end
|
31
|
-
|
81
|
+
|
82
|
+
# Raised when association is being configured improperly or
|
83
|
+
# user tries to use offset and limit together with has_many or has_and_belongs_to_many associations.
|
84
|
+
class ConfigurationError < ActiveRecordError
|
85
|
+
end
|
86
|
+
|
87
|
+
# Raised on attempt to update record that is instantiated as read only.
|
88
|
+
class ReadOnlyRecord < ActiveRecordError
|
32
89
|
end
|
33
|
-
|
90
|
+
|
91
|
+
# Used by ActiveRecord transaction mechanism to distinguish rollback from other exceptional situations.
|
92
|
+
# You can use it to roll your transaction back explicitly in the block passed to +transaction+ method.
|
93
|
+
class Rollback < ActiveRecordError
|
34
94
|
end
|
35
|
-
|
95
|
+
|
96
|
+
# Raised when attribute has a name reserved by ActiveRecord (when attribute has name of one of ActiveRecord instance methods).
|
97
|
+
class DangerousAttributeError < ActiveRecordError
|
36
98
|
end
|
37
|
-
|
99
|
+
|
100
|
+
# Raised when you've tried to access a column which wasn't
|
101
|
+
# loaded by your finder. Typically this is because :select
|
102
|
+
# has been specified
|
103
|
+
class MissingAttributeError < NoMethodError
|
104
|
+
end
|
105
|
+
|
38
106
|
class AttributeAssignmentError < ActiveRecordError #:nodoc:
|
39
107
|
attr_reader :exception, :attribute
|
40
108
|
def initialize(message, exception, attribute)
|
@@ -61,7 +129,7 @@ module ActiveRecord #:nodoc:
|
|
61
129
|
# == Creation
|
62
130
|
#
|
63
131
|
# Active Records accept constructor parameters either in a hash or as a block. The hash method is especially useful when
|
64
|
-
# you're receiving the data from somewhere else, like
|
132
|
+
# you're receiving the data from somewhere else, like an HTTP request. It works like this:
|
65
133
|
#
|
66
134
|
# user = User.new(:name => "David", :occupation => "Code Artist")
|
67
135
|
# user.name # => "David"
|
@@ -101,15 +169,15 @@ module ActiveRecord #:nodoc:
|
|
101
169
|
# end
|
102
170
|
#
|
103
171
|
# The <tt>authenticate_unsafely</tt> method inserts the parameters directly into the query and is thus susceptible to SQL-injection
|
104
|
-
# attacks if the <tt>user_name</tt> and +password+ parameters come directly from
|
105
|
-
# <tt>authenticate_safely_simply</tt> both will sanitize the <tt>user_name</tt> and +password+ before inserting them in the query,
|
172
|
+
# attacks if the <tt>user_name</tt> and +password+ parameters come directly from an HTTP request. The <tt>authenticate_safely</tt> and
|
173
|
+
# <tt>authenticate_safely_simply</tt> both will sanitize the <tt>user_name</tt> and +password+ before inserting them in the query,
|
106
174
|
# which will ensure that an attacker can't escape the query and fake the login (or worse).
|
107
175
|
#
|
108
176
|
# When using multiple parameters in the conditions, it can easily become hard to read exactly what the fourth or fifth
|
109
177
|
# question mark is supposed to represent. In those cases, you can resort to named bind variables instead. That's done by replacing
|
110
178
|
# the question marks with symbols and supplying a hash with values for the matching symbol keys:
|
111
179
|
#
|
112
|
-
# Company.find(:first, [
|
180
|
+
# Company.find(:first, :conditions => [
|
113
181
|
# "id = :id AND name = :name AND division = :division AND created_at > :accounting_date",
|
114
182
|
# { :id => 3, :name => "37signals", :division => "First", :accounting_date => '2005-01-01' }
|
115
183
|
# ])
|
@@ -126,9 +194,9 @@ module ActiveRecord #:nodoc:
|
|
126
194
|
#
|
127
195
|
# == Overwriting default accessors
|
128
196
|
#
|
129
|
-
# All column values are automatically available through basic accessors on the Active Record object, but
|
130
|
-
# want to specialize this behavior. This can be done by
|
131
|
-
# name as the attribute) calling read_attribute(attr_name) and write_attribute(attr_name, value) to actually change things.
|
197
|
+
# All column values are automatically available through basic accessors on the Active Record object, but sometimes you
|
198
|
+
# want to specialize this behavior. This can be done by overwriting the default accessors (using the same
|
199
|
+
# name as the attribute) and calling read_attribute(attr_name) and write_attribute(attr_name, value) to actually change things.
|
132
200
|
# Example:
|
133
201
|
#
|
134
202
|
# class Song < ActiveRecord::Base
|
@@ -143,9 +211,23 @@ module ActiveRecord #:nodoc:
|
|
143
211
|
# end
|
144
212
|
# end
|
145
213
|
#
|
146
|
-
# You can alternatively use self[:attribute]=(value) and self[:attribute] instead of write_attribute(:attribute,
|
214
|
+
# You can alternatively use self[:attribute]=(value) and self[:attribute] instead of write_attribute(:attribute, value) and
|
147
215
|
# read_attribute(:attribute) as a shorter form.
|
148
216
|
#
|
217
|
+
# == Attribute query methods
|
218
|
+
#
|
219
|
+
# In addition to the basic accessors, query methods are also automatically available on the Active Record object.
|
220
|
+
# Query methods allow you to test whether an attribute value is present.
|
221
|
+
#
|
222
|
+
# For example, an Active Record User with the <tt>name</tt> attribute has a <tt>name?</tt> method that you can call
|
223
|
+
# to determine whether the user has a name:
|
224
|
+
#
|
225
|
+
# user = User.new(:name => "David")
|
226
|
+
# user.name? # => true
|
227
|
+
#
|
228
|
+
# anonymous = User.new(:name => "")
|
229
|
+
# anonymous.name? # => false
|
230
|
+
#
|
149
231
|
# == Accessing attributes before they have been typecasted
|
150
232
|
#
|
151
233
|
# Sometimes you want to be able to read the raw attribute data without having the column-determined typecast run its course first.
|
@@ -161,12 +243,12 @@ module ActiveRecord #:nodoc:
|
|
161
243
|
# Dynamic attribute-based finders are a cleaner way of getting (and/or creating) objects by simple queries without turning to SQL. They work by
|
162
244
|
# appending the name of an attribute to <tt>find_by_</tt> or <tt>find_all_by_</tt>, so you get finders like Person.find_by_user_name,
|
163
245
|
# Person.find_all_by_last_name, Payment.find_by_transaction_id. So instead of writing
|
164
|
-
# <tt>Person.find(:first, ["user_name = ?", user_name])</tt>, you just do <tt>Person.find_by_user_name(user_name)</tt>.
|
165
|
-
# And instead of writing <tt>Person.find(:all, ["last_name = ?", last_name])</tt>, you just do <tt>Person.find_all_by_last_name(last_name)</tt>.
|
246
|
+
# <tt>Person.find(:first, :conditions => ["user_name = ?", user_name])</tt>, you just do <tt>Person.find_by_user_name(user_name)</tt>.
|
247
|
+
# And instead of writing <tt>Person.find(:all, :conditions => ["last_name = ?", last_name])</tt>, you just do <tt>Person.find_all_by_last_name(last_name)</tt>.
|
166
248
|
#
|
167
249
|
# It's also possible to use multiple attributes in the same find by separating them with "_and_", so you get finders like
|
168
250
|
# <tt>Person.find_by_user_name_and_password</tt> or even <tt>Payment.find_by_purchaser_and_state_and_country</tt>. So instead of writing
|
169
|
-
# <tt>Person.find(:first, ["user_name = ? AND password = ?", user_name, password])</tt>, you just do
|
251
|
+
# <tt>Person.find(:first, :conditions => ["user_name = ? AND password = ?", user_name, password])</tt>, you just do
|
170
252
|
# <tt>Person.find_by_user_name_and_password(user_name, password)</tt>.
|
171
253
|
#
|
172
254
|
# It's even possible to use all the additional parameters to find. For example, the full interface for Payment.find_all_by_amount
|
@@ -178,7 +260,7 @@ module ActiveRecord #:nodoc:
|
|
178
260
|
#
|
179
261
|
# # No 'Summer' tag exists
|
180
262
|
# Tag.find_or_create_by_name("Summer") # equal to Tag.create(:name => "Summer")
|
181
|
-
#
|
263
|
+
#
|
182
264
|
# # Now the 'Summer' tag does exist
|
183
265
|
# Tag.find_or_create_by_name("Summer") # equal to Tag.find_by_name("Summer")
|
184
266
|
#
|
@@ -188,6 +270,13 @@ module ActiveRecord #:nodoc:
|
|
188
270
|
# winter = Tag.find_or_initialize_by_name("Winter")
|
189
271
|
# winter.new_record? # true
|
190
272
|
#
|
273
|
+
# To find by a subset of the attributes to be used for instantiating a new object, pass a hash instead of
|
274
|
+
# a list of parameters. For example:
|
275
|
+
#
|
276
|
+
# Tag.find_or_create_by_name(:name => "rails", :creator => current_user)
|
277
|
+
#
|
278
|
+
# That will either find an existing tag named "rails", or create a new one while setting the user that created it.
|
279
|
+
#
|
191
280
|
# == Saving arrays, hashes, and other non-mappable objects in text columns
|
192
281
|
#
|
193
282
|
# Active Record can serialize any object in text columns using YAML. To do so, you must specify this with a call to the class method +serialize+.
|
@@ -212,7 +301,7 @@ module ActiveRecord #:nodoc:
|
|
212
301
|
#
|
213
302
|
# == Single table inheritance
|
214
303
|
#
|
215
|
-
# Active Record allows inheritance by storing the name of the class in a column that by default is
|
304
|
+
# Active Record allows inheritance by storing the name of the class in a column that by default is named "type" (can be changed
|
216
305
|
# by overwriting <tt>Base.inheritance_column</tt>). This means that an inheritance looking like this:
|
217
306
|
#
|
218
307
|
# class Company < ActiveRecord::Base; end
|
@@ -233,7 +322,7 @@ module ActiveRecord #:nodoc:
|
|
233
322
|
#
|
234
323
|
# Connections are usually created through ActiveRecord::Base.establish_connection and retrieved by ActiveRecord::Base.connection.
|
235
324
|
# All classes inheriting from ActiveRecord::Base will use this connection. But you can also set a class-specific connection.
|
236
|
-
# For example, if Course is
|
325
|
+
# For example, if Course is an ActiveRecord::Base, but resides in a different database, you can just say Course.establish_connection
|
237
326
|
# and Course *and all its subclasses* will use this connection instead.
|
238
327
|
#
|
239
328
|
# This feature is implemented by keeping a connection pool in ActiveRecord::Base that is a Hash indexed by the class. If a connection is
|
@@ -242,12 +331,12 @@ module ActiveRecord #:nodoc:
|
|
242
331
|
# == Exceptions
|
243
332
|
#
|
244
333
|
# * +ActiveRecordError+ -- generic error class and superclass of all other errors raised by Active Record
|
245
|
-
# * +AdapterNotSpecified+ -- the configuration hash used in <tt>establish_connection</tt> didn't include
|
334
|
+
# * +AdapterNotSpecified+ -- the configuration hash used in <tt>establish_connection</tt> didn't include an
|
246
335
|
# <tt>:adapter</tt> key.
|
247
|
-
# * +AdapterNotFound+ -- the <tt>:adapter</tt> key used in <tt>establish_connection</tt> specified
|
336
|
+
# * +AdapterNotFound+ -- the <tt>:adapter</tt> key used in <tt>establish_connection</tt> specified a non-existent adapter
|
248
337
|
# (or a bad spelling of an existing one).
|
249
338
|
# * +AssociationTypeMismatch+ -- the object assigned to the association wasn't of the type specified in the association definition.
|
250
|
-
# * +SerializationTypeMismatch+ -- the object
|
339
|
+
# * +SerializationTypeMismatch+ -- the serialized object wasn't of the class specified as the second parameter.
|
251
340
|
# * +ConnectionNotEstablished+ -- no connection has been established. Use <tt>establish_connection</tt> before querying.
|
252
341
|
# * +RecordNotFound+ -- no record responded to the find* method.
|
253
342
|
# Either the row with the given ID doesn't exist or the row didn't meet the additional restrictions.
|
@@ -266,15 +355,13 @@ module ActiveRecord #:nodoc:
|
|
266
355
|
# Accepts a logger conforming to the interface of Log4r or the default Ruby 1.8+ Logger class, which is then passed
|
267
356
|
# on to any new database connections made and which can be retrieved on both a class and instance level by calling +logger+.
|
268
357
|
cattr_accessor :logger, :instance_writer => false
|
269
|
-
|
270
|
-
include Reloadable::Deprecated
|
271
|
-
|
358
|
+
|
272
359
|
def self.inherited(child) #:nodoc:
|
273
360
|
@@subclasses[self] ||= []
|
274
361
|
@@subclasses[self] << child
|
275
362
|
super
|
276
363
|
end
|
277
|
-
|
364
|
+
|
278
365
|
def self.reset_subclasses #:nodoc:
|
279
366
|
nonreloadables = []
|
280
367
|
subclasses.each do |klass|
|
@@ -312,13 +399,13 @@ module ActiveRecord #:nodoc:
|
|
312
399
|
cattr_accessor :table_name_suffix, :instance_writer => false
|
313
400
|
@@table_name_suffix = ""
|
314
401
|
|
315
|
-
# Indicates whether
|
402
|
+
# Indicates whether table names should be the pluralized versions of the corresponding class names.
|
316
403
|
# If true, the default table name for a +Product+ class will be +products+. If false, it would just be +product+.
|
317
404
|
# See table_name for the full rules on table/class naming. This is true, by default.
|
318
405
|
cattr_accessor :pluralize_table_names, :instance_writer => false
|
319
406
|
@@pluralize_table_names = true
|
320
407
|
|
321
|
-
# Determines whether
|
408
|
+
# Determines whether to use ANSI codes to colorize the logging statements committed by the connection adapter. These colors
|
322
409
|
# make it much easier to overview things during debugging (when used through a reader like +tail+ and on a black background), but
|
323
410
|
# may complicate matters if you use software like syslog. This is true, by default.
|
324
411
|
cattr_accessor :colorize_logging, :instance_writer => false
|
@@ -329,21 +416,14 @@ module ActiveRecord #:nodoc:
|
|
329
416
|
cattr_accessor :default_timezone, :instance_writer => false
|
330
417
|
@@default_timezone = :local
|
331
418
|
|
332
|
-
# Determines whether
|
419
|
+
# Determines whether to use a connection for each thread, or a single shared connection for all threads.
|
333
420
|
# Defaults to false. Set to true if you're writing a threaded application.
|
334
421
|
cattr_accessor :allow_concurrency, :instance_writer => false
|
335
422
|
@@allow_concurrency = false
|
336
423
|
|
337
|
-
# Determines whether to speed up access by generating optimized reader
|
338
|
-
# methods to avoid expensive calls to method_missing when accessing
|
339
|
-
# attributes by name. You might want to set this to false in development
|
340
|
-
# mode, because the methods would be regenerated on each request.
|
341
|
-
cattr_accessor :generate_read_methods, :instance_writer => false
|
342
|
-
@@generate_read_methods = true
|
343
|
-
|
344
424
|
# Specifies the format to use when dumping the database schema with Rails'
|
345
425
|
# Rakefile. If :sql, the schema is dumped as (potentially database-
|
346
|
-
# specific) SQL statements. If :ruby, the schema is dumped as an
|
426
|
+
# specific) SQL statements. If :ruby, the schema is dumped as an
|
347
427
|
# ActiveRecord::Schema file which can be loaded into any database that
|
348
428
|
# supports migrations. Use :ruby if you want to have different database
|
349
429
|
# adapters for, e.g., your development and test environments.
|
@@ -356,25 +436,26 @@ module ActiveRecord #:nodoc:
|
|
356
436
|
# * Find by id: This can either be a specific id (1), a list of ids (1, 5, 6), or an array of ids ([5, 6, 10]).
|
357
437
|
# If no record can be found for all of the listed ids, then RecordNotFound will be raised.
|
358
438
|
# * Find first: This will return the first record matched by the options used. These options can either be specific
|
359
|
-
# conditions or merely an order. If no record can matched, nil is returned.
|
439
|
+
# conditions or merely an order. If no record can be matched, nil is returned.
|
360
440
|
# * Find all: This will return all the records matched by the options used. If no records are found, an empty array is returned.
|
361
441
|
#
|
362
|
-
# All approaches accept an
|
442
|
+
# All approaches accept an options hash as their last parameter. The options are:
|
363
443
|
#
|
364
444
|
# * <tt>:conditions</tt>: An SQL fragment like "administrator = 1" or [ "user_name = ?", username ]. See conditions in the intro.
|
365
445
|
# * <tt>:order</tt>: An SQL fragment like "created_at DESC, name".
|
366
446
|
# * <tt>:group</tt>: An attribute name by which the result should be grouped. Uses the GROUP BY SQL-clause.
|
367
447
|
# * <tt>:limit</tt>: An integer determining the limit on the number of rows that should be returned.
|
368
|
-
# * <tt>:offset</tt>: An integer determining the offset from where the rows should be fetched. So at 5, it would skip
|
369
|
-
# * <tt>:joins</tt>:
|
370
|
-
#
|
448
|
+
# * <tt>:offset</tt>: An integer determining the offset from where the rows should be fetched. So at 5, it would skip rows 0 through 4.
|
449
|
+
# * <tt>:joins</tt>: Either an SQL fragment for additional joins like "LEFT JOIN comments ON comments.post_id = id" (rarely needed)
|
450
|
+
# or named associations in the same form used for the :include option, which will perform an INNER JOIN on the associated table(s).
|
451
|
+
# If the value is a string, then the records will be returned read-only since they will have attributes that do not correspond to the table's columns.
|
371
452
|
# Pass :readonly => false to override.
|
372
453
|
# * <tt>:include</tt>: Names associations that should be loaded alongside using LEFT OUTER JOINs. The symbols named refer
|
373
454
|
# to already defined associations. See eager loading under Associations.
|
374
|
-
# * <tt>:select</tt>: By default, this is * as in SELECT * FROM, but can be changed if you for example want to do a join
|
455
|
+
# * <tt>:select</tt>: By default, this is * as in SELECT * FROM, but can be changed if you, for example, want to do a join but not
|
375
456
|
# include the joined columns.
|
376
457
|
# * <tt>:from</tt>: By default, this is the table name of the class, but can be changed to an alternate table name (or even the name
|
377
|
-
# of a database view).
|
458
|
+
# of a database view).
|
378
459
|
# * <tt>:readonly</tt>: Mark the returned records read-only so they cannot be saved or updated.
|
379
460
|
# * <tt>:lock</tt>: An SQL fragment like "FOR UPDATE" or "LOCK IN SHARE MODE".
|
380
461
|
# :lock => true gives connection's default exclusive lock, usually "FOR UPDATE".
|
@@ -383,9 +464,13 @@ module ActiveRecord #:nodoc:
|
|
383
464
|
# Person.find(1) # returns the object for ID = 1
|
384
465
|
# Person.find(1, 2, 6) # returns an array for objects with IDs in (1, 2, 6)
|
385
466
|
# Person.find([7, 17]) # returns an array for objects with IDs in (7, 17)
|
386
|
-
# Person.find([1]) # returns an array for
|
467
|
+
# Person.find([1]) # returns an array for the object with ID = 1
|
387
468
|
# Person.find(1, :conditions => "administrator = 1", :order => "created_on DESC")
|
388
469
|
#
|
470
|
+
# Note that returned records may not be in the same order as the ids you
|
471
|
+
# provide since database rows are unordered. Give an explicit :order
|
472
|
+
# to ensure the results are sorted.
|
473
|
+
#
|
389
474
|
# Examples for find first:
|
390
475
|
# Person.find(:first) # returns the first object fetched by SELECT * FROM people
|
391
476
|
# Person.find(:first, :conditions => [ "user_name = ?", user_name])
|
@@ -409,7 +494,7 @@ module ActiveRecord #:nodoc:
|
|
409
494
|
# person.save!
|
410
495
|
# end
|
411
496
|
def find(*args)
|
412
|
-
options =
|
497
|
+
options = args.extract_options!
|
413
498
|
validate_find_options(options)
|
414
499
|
set_readonly_option!(options)
|
415
500
|
|
@@ -419,51 +504,91 @@ module ActiveRecord #:nodoc:
|
|
419
504
|
else find_from_ids(args, options)
|
420
505
|
end
|
421
506
|
end
|
422
|
-
|
423
|
-
#
|
424
|
-
#
|
425
|
-
#
|
507
|
+
|
508
|
+
#
|
509
|
+
# Executes a custom sql query against your database and returns all the results. The results will
|
510
|
+
# be returned as an array with columns requested encapsulated as attributes of the model you call
|
511
|
+
# this method from. If you call +Product.find_by_sql+ then the results will be returned in a Product
|
512
|
+
# object with the attributes you specified in the SQL query.
|
513
|
+
#
|
514
|
+
# If you call a complicated SQL query which spans multiple tables the columns specified by the
|
515
|
+
# SELECT will be attributes of the model, whether or not they are columns of the corresponding
|
516
|
+
# table.
|
517
|
+
#
|
518
|
+
# The +sql+ parameter is a full sql query as a string. It will be called as is, there will be
|
519
|
+
# no database agnostic conversions performed. This should be a last resort because using, for example,
|
520
|
+
# MySQL specific terms will lock you to using that particular database engine or require you to
|
521
|
+
# change your call if you switch engines
|
522
|
+
#
|
523
|
+
# ==== Examples
|
524
|
+
# # A simple sql query spanning multiple tables
|
525
|
+
# Post.find_by_sql "SELECT p.title, c.author FROM posts p, comments c WHERE p.id = c.post_id"
|
526
|
+
# > [#<Post:0x36bff9c @attributes={"title"=>"Ruby Meetup", "first_name"=>"Quentin"}>, ...]
|
527
|
+
#
|
528
|
+
# # You can use the same string replacement techniques as you can with ActiveRecord#find
|
529
|
+
# Post.find_by_sql ["SELECT title FROM posts WHERE author = ? AND created > ?", author_id, start_date]
|
530
|
+
# > [#<Post:0x36bff9c @attributes={"first_name"=>"The Cheap Man Buys Twice"}>, ...]
|
426
531
|
def find_by_sql(sql)
|
427
532
|
connection.select_all(sanitize_sql(sql), "#{name} Load").collect! { |record| instantiate(record) }
|
428
533
|
end
|
429
534
|
|
430
|
-
#
|
431
|
-
#
|
432
|
-
#
|
535
|
+
# Checks whether a record exists in the database that matches conditions given. These conditions
|
536
|
+
# can either be a single integer representing a primary key id to be found, or a condition to be
|
537
|
+
# matched like using ActiveRecord#find.
|
538
|
+
#
|
539
|
+
# The +id_or_conditions+ parameter can be an Integer or a String if you want to search the primary key
|
540
|
+
# column of the table for a matching id, or if you're looking to match against a condition you can use
|
541
|
+
# an Array or a Hash.
|
542
|
+
#
|
543
|
+
# Possible gotcha: You can't pass in a condition as a string e.g. "name = 'Jamie'", this would be
|
544
|
+
# sanitized and then queried against the primary key column as "id = 'name = \'Jamie"
|
545
|
+
#
|
546
|
+
# ==== Examples
|
433
547
|
# Person.exists?(5)
|
434
548
|
# Person.exists?('5')
|
435
549
|
# Person.exists?(:name => "David")
|
436
550
|
# Person.exists?(['name LIKE ?', "%#{query}%"])
|
437
551
|
def exists?(id_or_conditions)
|
438
|
-
!find(:first, :
|
439
|
-
|
440
|
-
false
|
552
|
+
!find(:first, :select => "#{quoted_table_name}.#{primary_key}",
|
553
|
+
:conditions => expand_id_conditions(id_or_conditions)).nil?
|
441
554
|
end
|
442
555
|
|
443
|
-
# Creates an object
|
444
|
-
#
|
556
|
+
# Creates an object (or multiple objects) and saves it to the database, if validations pass.
|
557
|
+
# The resulting object is returned whether the object was saved successfully to the database or not.
|
558
|
+
#
|
559
|
+
# The +attributes+ parameter can be either be a Hash or an Array of Hashes. These Hashes describe the
|
560
|
+
# attributes on the objects that are to be created.
|
561
|
+
#
|
562
|
+
# ==== Examples
|
563
|
+
# # Create a single new object
|
564
|
+
# User.create(:first_name => 'Jamie')
|
565
|
+
# # Create an Array of new objects
|
566
|
+
# User.create([{:first_name => 'Jamie'}, {:first_name => 'Jeremy'}])
|
445
567
|
def create(attributes = nil)
|
446
568
|
if attributes.is_a?(Array)
|
447
569
|
attributes.collect { |attr| create(attr) }
|
448
570
|
else
|
449
571
|
object = new(attributes)
|
450
|
-
scope(:create).each { |att,value| object.send("#{att}=", value) } if scoped?(:create)
|
451
572
|
object.save
|
452
573
|
object
|
453
574
|
end
|
454
575
|
end
|
455
576
|
|
456
|
-
#
|
457
|
-
#
|
577
|
+
# Updates an object (or multiple objects) and saves it to the database, if validations pass.
|
578
|
+
# The resulting object is returned whether the object was saved successfully to the database or not.
|
458
579
|
#
|
459
|
-
#
|
460
|
-
# +attributes+ and an array of objects is returned.
|
580
|
+
# ==== Options
|
461
581
|
#
|
462
|
-
#
|
582
|
+
# +id+ This should be the id or an array of ids to be updated
|
583
|
+
# +attributes+ This should be a Hash of attributes to be set on the object, or an array of Hashes.
|
584
|
+
#
|
585
|
+
# ==== Examples
|
586
|
+
#
|
587
|
+
# # Updating one record:
|
463
588
|
# Person.update(15, {:user_name => 'Samuel', :group => 'expert'})
|
464
|
-
#
|
465
|
-
#
|
466
|
-
# people = { 1 => { "first_name" => "David" }, 2 => { "first_name" => "Jeremy"} }
|
589
|
+
#
|
590
|
+
# # Updating multiple records:
|
591
|
+
# people = { 1 => { "first_name" => "David" }, 2 => { "first_name" => "Jeremy"} }
|
467
592
|
# Person.update(people.keys, people.values)
|
468
593
|
def update(id, attributes)
|
469
594
|
if id.is_a?(Array)
|
@@ -476,62 +601,201 @@ module ActiveRecord #:nodoc:
|
|
476
601
|
end
|
477
602
|
end
|
478
603
|
|
479
|
-
#
|
480
|
-
# are
|
604
|
+
# Delete an object (or multiple objects) where the +id+ given matches the primary_key. A SQL +DELETE+ command
|
605
|
+
# is executed on the database which means that no callbacks are fired off running this. This is an efficient method
|
606
|
+
# of deleting records that don't need cleaning up after or other actions to be taken.
|
607
|
+
#
|
608
|
+
# Objects are _not_ instantiated with this method.
|
609
|
+
#
|
610
|
+
# ==== Options
|
611
|
+
#
|
612
|
+
# +id+ Can be either an Integer or an Array of Integers
|
613
|
+
#
|
614
|
+
# ==== Examples
|
615
|
+
#
|
616
|
+
# # Delete a single object
|
617
|
+
# Todo.delete(1)
|
618
|
+
#
|
619
|
+
# # Delete multiple objects
|
620
|
+
# todos = [1,2,3]
|
621
|
+
# Todo.delete(todos)
|
481
622
|
def delete(id)
|
482
623
|
delete_all([ "#{connection.quote_column_name(primary_key)} IN (?)", id ])
|
483
624
|
end
|
484
625
|
|
485
|
-
#
|
486
|
-
#
|
626
|
+
# Destroy an object (or multiple objects) that has the given id, the object is instantiated first,
|
627
|
+
# therefore all callbacks and filters are fired off before the object is deleted. This method is
|
628
|
+
# less efficient than ActiveRecord#delete but allows cleanup methods and other actions to be run.
|
629
|
+
#
|
630
|
+
# This essentially finds the object (or multiple objects) with the given id, creates a new object
|
631
|
+
# from the attributes, and then calls destroy on it.
|
632
|
+
#
|
633
|
+
# ==== Options
|
634
|
+
#
|
635
|
+
# +id+ Can be either an Integer or an Array of Integers
|
636
|
+
#
|
637
|
+
# ==== Examples
|
638
|
+
#
|
639
|
+
# # Destroy a single object
|
640
|
+
# Todo.destroy(1)
|
641
|
+
#
|
642
|
+
# # Destroy multiple objects
|
643
|
+
# todos = [1,2,3]
|
644
|
+
# Todo.destroy(todos)
|
487
645
|
def destroy(id)
|
488
646
|
id.is_a?(Array) ? id.each { |id| destroy(id) } : find(id).destroy
|
489
647
|
end
|
490
648
|
|
491
|
-
# Updates all records with
|
492
|
-
#
|
493
|
-
#
|
494
|
-
|
495
|
-
|
496
|
-
|
649
|
+
# Updates all records with details given if they match a set of conditions supplied, limits and order can
|
650
|
+
# also be supplied.
|
651
|
+
#
|
652
|
+
# ==== Options
|
653
|
+
#
|
654
|
+
# +updates+ A String of column and value pairs that will be set on any records that match conditions
|
655
|
+
# +conditions+ An SQL fragment like "administrator = 1" or [ "user_name = ?", username ].
|
656
|
+
# See conditions in the intro for more info.
|
657
|
+
# +options+ Additional options are :limit and/or :order, see the examples for usage.
|
658
|
+
#
|
659
|
+
# ==== Examples
|
660
|
+
#
|
661
|
+
# # Update all billing objects with the 3 different attributes given
|
662
|
+
# Billing.update_all( "category = 'authorized', approved = 1, author = 'David'" )
|
663
|
+
#
|
664
|
+
# # Update records that match our conditions
|
665
|
+
# Billing.update_all( "author = 'David'", "title LIKE '%Rails%'" )
|
666
|
+
#
|
667
|
+
# # Update records that match our conditions but limit it to 5 ordered by date
|
668
|
+
# Billing.update_all( "author = 'David'", "title LIKE '%Rails%'",
|
669
|
+
# :order => 'created_at', :limit => 5 )
|
670
|
+
def update_all(updates, conditions = nil, options = {})
|
671
|
+
sql = "UPDATE #{table_name} SET #{sanitize_sql_for_assignment(updates)} "
|
672
|
+
scope = scope(:find)
|
673
|
+
add_conditions!(sql, conditions, scope)
|
674
|
+
add_order!(sql, options[:order], scope)
|
675
|
+
add_limit!(sql, options, scope)
|
497
676
|
connection.update(sql, "#{name} Update")
|
498
677
|
end
|
499
678
|
|
500
|
-
# Destroys the
|
501
|
-
#
|
679
|
+
# Destroys the records matching +conditions+ by instantiating each record and calling the destroy method.
|
680
|
+
# This means at least 2*N database queries to destroy N records, so avoid destroy_all if you are deleting
|
681
|
+
# many records. If you want to simply delete records without worrying about dependent associations or
|
682
|
+
# callbacks, use the much faster +delete_all+ method instead.
|
683
|
+
#
|
684
|
+
# ==== Options
|
685
|
+
#
|
686
|
+
# +conditions+ Conditions are specified the same way as with +find+ method.
|
687
|
+
#
|
688
|
+
# ==== Example
|
689
|
+
#
|
502
690
|
# Person.destroy_all "last_login < '2004-04-04'"
|
691
|
+
#
|
692
|
+
# This loads and destroys each person one by one, including its dependent associations and before_ and
|
693
|
+
# after_destroy callbacks.
|
503
694
|
def destroy_all(conditions = nil)
|
504
695
|
find(:all, :conditions => conditions).each { |object| object.destroy }
|
505
696
|
end
|
506
697
|
|
507
|
-
# Deletes
|
508
|
-
# calling the destroy method
|
698
|
+
# Deletes the records matching +conditions+ without instantiating the records first, and hence not
|
699
|
+
# calling the destroy method and invoking callbacks. This is a single SQL query, much more efficient
|
700
|
+
# than destroy_all.
|
701
|
+
#
|
702
|
+
# ==== Options
|
703
|
+
#
|
704
|
+
# +conditions+ Conditions are specified the same way as with +find+ method.
|
705
|
+
#
|
706
|
+
# ==== Example
|
707
|
+
#
|
509
708
|
# Post.delete_all "person_id = 5 AND (category = 'Something' OR category = 'Else')"
|
709
|
+
#
|
710
|
+
# This deletes the affected posts all at once with a single DELETE query. If you need to destroy dependent
|
711
|
+
# associations or call your before_ or after_destroy callbacks, use the +destroy_all+ method instead.
|
510
712
|
def delete_all(conditions = nil)
|
511
|
-
sql = "DELETE FROM #{
|
713
|
+
sql = "DELETE FROM #{quoted_table_name} "
|
512
714
|
add_conditions!(sql, conditions, scope(:find))
|
513
715
|
connection.delete(sql, "#{name} Delete all")
|
514
716
|
end
|
515
717
|
|
516
718
|
# Returns the result of an SQL statement that should only include a COUNT(*) in the SELECT part.
|
719
|
+
# The use of this method should be restricted to complicated SQL queries that can't be executed
|
720
|
+
# using the ActiveRecord::Calculations class methods. Look into those before using this.
|
721
|
+
#
|
722
|
+
# ==== Options
|
723
|
+
#
|
724
|
+
# +sql+: An SQL statement which should return a count query from the database, see the example below
|
725
|
+
#
|
726
|
+
# ==== Examples
|
727
|
+
#
|
517
728
|
# Product.count_by_sql "SELECT COUNT(*) FROM sales s, customers c WHERE s.customer_id = c.id"
|
518
729
|
def count_by_sql(sql)
|
519
730
|
sql = sanitize_conditions(sql)
|
520
731
|
connection.select_value(sql, "#{name} Count").to_i
|
521
732
|
end
|
522
733
|
|
523
|
-
#
|
524
|
-
#
|
525
|
-
#
|
526
|
-
#
|
527
|
-
#
|
734
|
+
# A generic "counter updater" implementation, intended primarily to be
|
735
|
+
# used by increment_counter and decrement_counter, but which may also
|
736
|
+
# be useful on its own. It simply does a direct SQL update for the record
|
737
|
+
# with the given ID, altering the given hash of counters by the amount
|
738
|
+
# given by the corresponding value:
|
739
|
+
#
|
740
|
+
# ==== Options
|
741
|
+
#
|
742
|
+
# +id+ The id of the object you wish to update a counter on
|
743
|
+
# +counters+ An Array of Hashes containing the names of the fields
|
744
|
+
# to update as keys and the amount to update the field by as
|
745
|
+
# values
|
746
|
+
#
|
747
|
+
# ==== Examples
|
748
|
+
#
|
749
|
+
# # For the Post with id of 5, decrement the comment_count by 1, and
|
750
|
+
# # increment the action_count by 1
|
751
|
+
# Post.update_counters 5, :comment_count => -1, :action_count => 1
|
752
|
+
# # Executes the following SQL:
|
753
|
+
# # UPDATE posts
|
754
|
+
# # SET comment_count = comment_count - 1,
|
755
|
+
# # action_count = action_count + 1
|
756
|
+
# # WHERE id = 5
|
757
|
+
def update_counters(id, counters)
|
758
|
+
updates = counters.inject([]) { |list, (counter_name, increment)|
|
759
|
+
sign = increment < 0 ? "-" : "+"
|
760
|
+
list << "#{connection.quote_column_name(counter_name)} = #{connection.quote_column_name(counter_name)} #{sign} #{increment.abs}"
|
761
|
+
}.join(", ")
|
762
|
+
update_all(updates, "#{connection.quote_column_name(primary_key)} = #{quote_value(id)}")
|
763
|
+
end
|
764
|
+
|
765
|
+
# Increment a number field by one, usually representing a count.
|
766
|
+
#
|
767
|
+
# This is used for caching aggregate values, so that they don't need to be computed every time.
|
768
|
+
# For example, a DiscussionBoard may cache post_count and comment_count otherwise every time the board is
|
769
|
+
# shown it would have to run an SQL query to find how many posts and comments there are.
|
770
|
+
#
|
771
|
+
# ==== Options
|
772
|
+
#
|
773
|
+
# +counter_name+ The name of the field that should be incremented
|
774
|
+
# +id+ The id of the object that should be incremented
|
775
|
+
#
|
776
|
+
# ==== Examples
|
777
|
+
#
|
778
|
+
# # Increment the post_count column for the record with an id of 5
|
779
|
+
# DiscussionBoard.increment_counter(:post_count, 5)
|
528
780
|
def increment_counter(counter_name, id)
|
529
|
-
|
781
|
+
update_counters(id, counter_name => 1)
|
530
782
|
end
|
531
783
|
|
532
|
-
#
|
784
|
+
# Decrement a number field by one, usually representing a count.
|
785
|
+
#
|
786
|
+
# This works the same as increment_counter but reduces the column value by 1 instead of increasing it.
|
787
|
+
#
|
788
|
+
# ==== Options
|
789
|
+
#
|
790
|
+
# +counter_name+ The name of the field that should be decremented
|
791
|
+
# +id+ The id of the object that should be decremented
|
792
|
+
#
|
793
|
+
# ==== Examples
|
794
|
+
#
|
795
|
+
# # Decrement the post_count column for the record with an id of 5
|
796
|
+
# DiscussionBoard.decrement_counter(:post_count, 5)
|
533
797
|
def decrement_counter(counter_name, id)
|
534
|
-
|
798
|
+
update_counters(id, counter_name => -1)
|
535
799
|
end
|
536
800
|
|
537
801
|
|
@@ -550,8 +814,10 @@ module ActiveRecord #:nodoc:
|
|
550
814
|
#
|
551
815
|
# customer.credit_rating = "Average"
|
552
816
|
# customer.credit_rating # => "Average"
|
817
|
+
#
|
818
|
+
# To start from an all-closed default and enable attributes as needed, have a look at attr_accessible.
|
553
819
|
def attr_protected(*attributes)
|
554
|
-
|
820
|
+
write_inheritable_attribute("attr_protected", Set.new(attributes.map(&:to_s)) + (protected_attributes || []))
|
555
821
|
end
|
556
822
|
|
557
823
|
# Returns an array of all the attributes that have been protected from mass-assignment.
|
@@ -559,12 +825,33 @@ module ActiveRecord #:nodoc:
|
|
559
825
|
read_inheritable_attribute("attr_protected")
|
560
826
|
end
|
561
827
|
|
562
|
-
#
|
563
|
-
# <tt>new(attributes)</tt> and <tt>attributes=(attributes)</tt
|
564
|
-
#
|
565
|
-
#
|
828
|
+
# Similar to the attr_protected macro, this protects attributes of your model from mass-assignment,
|
829
|
+
# such as <tt>new(attributes)</tt> and <tt>attributes=(attributes)</tt>
|
830
|
+
# however, it does it in the opposite way. This locks all attributes and only allows access to the
|
831
|
+
# attributes specified. Assignment to attributes not in this list will be ignored and need to be set
|
832
|
+
# using the direct writer methods instead. This is meant to protect sensitive attributes from being
|
833
|
+
# overwritten by URL/form hackers. If you'd rather start from an all-open default and restrict
|
834
|
+
# attributes as needed, have a look at attr_protected.
|
835
|
+
#
|
836
|
+
# ==== Options
|
837
|
+
#
|
838
|
+
# <tt>*attributes</tt> A comma separated list of symbols that represent columns _not_ to be protected
|
839
|
+
#
|
840
|
+
# ==== Examples
|
841
|
+
#
|
842
|
+
# class Customer < ActiveRecord::Base
|
843
|
+
# attr_accessible :name, :nickname
|
844
|
+
# end
|
845
|
+
#
|
846
|
+
# customer = Customer.new(:name => "David", :nickname => "Dave", :credit_rating => "Excellent")
|
847
|
+
# customer.credit_rating # => nil
|
848
|
+
# customer.attributes = { :name => "Jolly fellow", :credit_rating => "Superb" }
|
849
|
+
# customer.credit_rating # => nil
|
850
|
+
#
|
851
|
+
# customer.credit_rating = "Average"
|
852
|
+
# customer.credit_rating # => "Average"
|
566
853
|
def attr_accessible(*attributes)
|
567
|
-
|
854
|
+
write_inheritable_attribute("attr_accessible", Set.new(attributes.map(&:to_s)) + (accessible_attributes || []))
|
568
855
|
end
|
569
856
|
|
570
857
|
# Returns an array of all the attributes that have been made accessible to mass-assignment.
|
@@ -572,10 +859,31 @@ module ActiveRecord #:nodoc:
|
|
572
859
|
read_inheritable_attribute("attr_accessible")
|
573
860
|
end
|
574
861
|
|
862
|
+
# Attributes listed as readonly can be set for a new record, but will be ignored in database updates afterwards.
|
863
|
+
def attr_readonly(*attributes)
|
864
|
+
write_inheritable_attribute("attr_readonly", Set.new(attributes.map(&:to_s)) + (readonly_attributes || []))
|
865
|
+
end
|
575
866
|
|
576
|
-
|
577
|
-
|
578
|
-
|
867
|
+
# Returns an array of all the attributes that have been specified as readonly.
|
868
|
+
def readonly_attributes
|
869
|
+
read_inheritable_attribute("attr_readonly")
|
870
|
+
end
|
871
|
+
|
872
|
+
# If you have an attribute that needs to be saved to the database as an object, and retrieved as the same object,
|
873
|
+
# then specify the name of that attribute using this method and it will be handled automatically.
|
874
|
+
# The serialization is done through YAML. If +class_name+ is specified, the serialized object must be of that
|
875
|
+
# class on retrieval or +SerializationTypeMismatch+ will be raised.
|
876
|
+
#
|
877
|
+
# ==== Options
|
878
|
+
#
|
879
|
+
# +attr_name+ The field name that should be serialized
|
880
|
+
# +class_name+ Optional, class name that the object type should be equal to
|
881
|
+
#
|
882
|
+
# ==== Example
|
883
|
+
# # Serialize a preferences attribute
|
884
|
+
# class User
|
885
|
+
# serialize :preferences
|
886
|
+
# end
|
579
887
|
def serialize(attr_name, class_name = Object)
|
580
888
|
serialized_attributes[attr_name.to_s] = class_name
|
581
889
|
end
|
@@ -588,14 +896,23 @@ module ActiveRecord #:nodoc:
|
|
588
896
|
|
589
897
|
# Guesses the table name (in forced lower-case) based on the name of the class in the inheritance hierarchy descending
|
590
898
|
# directly from ActiveRecord. So if the hierarchy looks like: Reply < Message < ActiveRecord, then Message is used
|
591
|
-
# to guess the table name
|
592
|
-
# in Active Support, which knows almost all common English inflections
|
899
|
+
# to guess the table name even when called on Reply. The rules used to do the guess are handled by the Inflector class
|
900
|
+
# in Active Support, which knows almost all common English inflections. You can add new inflections in config/initializers/inflections.rb.
|
593
901
|
#
|
594
902
|
# Nested classes are given table names prefixed by the singular form of
|
595
|
-
# the parent's table name.
|
903
|
+
# the parent's table name. Enclosing modules are not considered. Examples:
|
904
|
+
#
|
905
|
+
# class Invoice < ActiveRecord::Base; end;
|
596
906
|
# file class table_name
|
597
907
|
# invoice.rb Invoice invoices
|
598
|
-
#
|
908
|
+
#
|
909
|
+
# class Invoice < ActiveRecord::Base; class Lineitem < ActiveRecord::Base; end; end;
|
910
|
+
# file class table_name
|
911
|
+
# invoice.rb Invoice::Lineitem invoice_lineitems
|
912
|
+
#
|
913
|
+
# module Invoice; class Lineitem < ActiveRecord::Base; end; end;
|
914
|
+
# file class table_name
|
915
|
+
# invoice/lineitem.rb Invoice::Lineitem lineitems
|
599
916
|
#
|
600
917
|
# Additionally, the class-level table_name_prefix is prepended and the
|
601
918
|
# table_name_suffix is appended. So if you have "myapp_" as a prefix,
|
@@ -753,7 +1070,7 @@ module ActiveRecord #:nodoc:
|
|
753
1070
|
columns.size > 0
|
754
1071
|
rescue ActiveRecord::StatementInvalid
|
755
1072
|
false
|
756
|
-
end
|
1073
|
+
end
|
757
1074
|
end
|
758
1075
|
end
|
759
1076
|
|
@@ -796,15 +1113,10 @@ module ActiveRecord #:nodoc:
|
|
796
1113
|
end
|
797
1114
|
end
|
798
1115
|
|
799
|
-
# Contains the names of the generated reader methods.
|
800
|
-
def read_methods #:nodoc:
|
801
|
-
@read_methods ||= Set.new
|
802
|
-
end
|
803
|
-
|
804
1116
|
# Resets all the cached information about columns, which will cause them to be reloaded on the next request.
|
805
1117
|
def reset_column_information
|
806
|
-
|
807
|
-
@column_names = @columns = @columns_hash = @content_columns = @dynamic_methods_hash = @
|
1118
|
+
generated_methods.each { |name| undef_method(name) }
|
1119
|
+
@column_names = @columns = @columns_hash = @content_columns = @dynamic_methods_hash = @generated_methods = @inheritance_column = nil
|
808
1120
|
end
|
809
1121
|
|
810
1122
|
def reset_column_information_and_inheritable_attributes_for_all_subclasses#:nodoc:
|
@@ -818,21 +1130,40 @@ module ActiveRecord #:nodoc:
|
|
818
1130
|
attribute_key_name.humanize
|
819
1131
|
end
|
820
1132
|
|
821
|
-
|
822
|
-
|
1133
|
+
# True if this isn't a concrete subclass needing a STI type condition.
|
1134
|
+
def descends_from_active_record?
|
1135
|
+
if superclass.abstract_class?
|
1136
|
+
superclass.descends_from_active_record?
|
1137
|
+
else
|
1138
|
+
superclass == Base || !columns_hash.include?(inheritance_column)
|
1139
|
+
end
|
823
1140
|
end
|
824
1141
|
|
1142
|
+
def finder_needs_type_condition? #:nodoc:
|
1143
|
+
# This is like this because benchmarking justifies the strange :false stuff
|
1144
|
+
:true == (@finder_needs_type_condition ||= descends_from_active_record? ? :false : :true)
|
1145
|
+
end
|
825
1146
|
|
826
|
-
|
827
|
-
|
1147
|
+
# Returns a string like 'Post id:integer, title:string, body:text'
|
1148
|
+
def inspect
|
1149
|
+
if self == Base
|
1150
|
+
super
|
1151
|
+
elsif abstract_class?
|
1152
|
+
"#{super}(abstract)"
|
1153
|
+
elsif table_exists?
|
1154
|
+
attr_list = columns.map { |c| "#{c.name}: #{c.type}" } * ', '
|
1155
|
+
"#{super}(#{attr_list})"
|
1156
|
+
else
|
1157
|
+
"#{super}(Table doesn't exist)"
|
1158
|
+
end
|
828
1159
|
end
|
829
1160
|
|
830
|
-
|
831
|
-
|
1161
|
+
|
1162
|
+
def quote_value(value, column = nil) #:nodoc:
|
1163
|
+
connection.quote(value,column)
|
832
1164
|
end
|
833
|
-
deprecate :quote => :quote_value
|
834
1165
|
|
835
|
-
# Used to sanitize objects before they're used in an SELECT
|
1166
|
+
# Used to sanitize objects before they're used in an SQL SELECT statement. Delegates to <tt>connection.quote</tt>.
|
836
1167
|
def sanitize(object) #:nodoc:
|
837
1168
|
connection.quote(object)
|
838
1169
|
end
|
@@ -869,104 +1200,9 @@ module ActiveRecord #:nodoc:
|
|
869
1200
|
logger.level = old_logger_level if logger
|
870
1201
|
end
|
871
1202
|
|
872
|
-
# Scope parameters to method calls within the block. Takes a hash of method_name => parameters hash.
|
873
|
-
# method_name may be :find or :create. :find parameters may include the <tt>:conditions</tt>, <tt>:joins</tt>,
|
874
|
-
# <tt>:include</tt>, <tt>:offset</tt>, <tt>:limit</tt>, and <tt>:readonly</tt> options. :create parameters are an attributes hash.
|
875
|
-
#
|
876
|
-
# Article.with_scope(:find => { :conditions => "blog_id = 1" }, :create => { :blog_id => 1 }) do
|
877
|
-
# Article.find(1) # => SELECT * from articles WHERE blog_id = 1 AND id = 1
|
878
|
-
# a = Article.create(1)
|
879
|
-
# a.blog_id # => 1
|
880
|
-
# end
|
881
|
-
#
|
882
|
-
# In nested scopings, all previous parameters are overwritten by inner rule
|
883
|
-
# except :conditions in :find, that are merged as hash.
|
884
|
-
#
|
885
|
-
# Article.with_scope(:find => { :conditions => "blog_id = 1", :limit => 1 }, :create => { :blog_id => 1 }) do
|
886
|
-
# Article.with_scope(:find => { :limit => 10})
|
887
|
-
# Article.find(:all) # => SELECT * from articles WHERE blog_id = 1 LIMIT 10
|
888
|
-
# end
|
889
|
-
# Article.with_scope(:find => { :conditions => "author_id = 3" })
|
890
|
-
# Article.find(:all) # => SELECT * from articles WHERE blog_id = 1 AND author_id = 3 LIMIT 1
|
891
|
-
# end
|
892
|
-
# end
|
893
|
-
#
|
894
|
-
# You can ignore any previous scopings by using <tt>with_exclusive_scope</tt> method.
|
895
|
-
#
|
896
|
-
# Article.with_scope(:find => { :conditions => "blog_id = 1", :limit => 1 }) do
|
897
|
-
# Article.with_exclusive_scope(:find => { :limit => 10 })
|
898
|
-
# Article.find(:all) # => SELECT * from articles LIMIT 10
|
899
|
-
# end
|
900
|
-
# end
|
901
|
-
def with_scope(method_scoping = {}, action = :merge, &block)
|
902
|
-
method_scoping = method_scoping.method_scoping if method_scoping.respond_to?(:method_scoping)
|
903
|
-
|
904
|
-
# Dup first and second level of hash (method and params).
|
905
|
-
method_scoping = method_scoping.inject({}) do |hash, (method, params)|
|
906
|
-
hash[method] = (params == true) ? params : params.dup
|
907
|
-
hash
|
908
|
-
end
|
909
|
-
|
910
|
-
method_scoping.assert_valid_keys([ :find, :create ])
|
911
|
-
|
912
|
-
if f = method_scoping[:find]
|
913
|
-
f.assert_valid_keys([ :conditions, :joins, :select, :include, :from, :offset, :limit, :order, :readonly, :lock ])
|
914
|
-
f[:readonly] = true if !f[:joins].blank? && !f.has_key?(:readonly)
|
915
|
-
end
|
916
|
-
|
917
|
-
# Merge scopings
|
918
|
-
if action == :merge && current_scoped_methods
|
919
|
-
method_scoping = current_scoped_methods.inject(method_scoping) do |hash, (method, params)|
|
920
|
-
case hash[method]
|
921
|
-
when Hash
|
922
|
-
if method == :find
|
923
|
-
(hash[method].keys + params.keys).uniq.each do |key|
|
924
|
-
merge = hash[method][key] && params[key] # merge if both scopes have the same key
|
925
|
-
if key == :conditions && merge
|
926
|
-
hash[method][key] = [params[key], hash[method][key]].collect{ |sql| "( %s )" % sanitize_sql(sql) }.join(" AND ")
|
927
|
-
elsif key == :include && merge
|
928
|
-
hash[method][key] = merge_includes(hash[method][key], params[key]).uniq
|
929
|
-
else
|
930
|
-
hash[method][key] = hash[method][key] || params[key]
|
931
|
-
end
|
932
|
-
end
|
933
|
-
else
|
934
|
-
hash[method] = params.merge(hash[method])
|
935
|
-
end
|
936
|
-
else
|
937
|
-
hash[method] = params
|
938
|
-
end
|
939
|
-
hash
|
940
|
-
end
|
941
|
-
end
|
942
|
-
|
943
|
-
self.scoped_methods << method_scoping
|
944
|
-
|
945
|
-
begin
|
946
|
-
yield
|
947
|
-
ensure
|
948
|
-
self.scoped_methods.pop
|
949
|
-
end
|
950
|
-
end
|
951
|
-
|
952
|
-
# Works like with_scope, but discards any nested properties.
|
953
|
-
def with_exclusive_scope(method_scoping = {}, &block)
|
954
|
-
with_scope(method_scoping, :overwrite, &block)
|
955
|
-
end
|
956
|
-
|
957
1203
|
# Overwrite the default class equality method to provide support for association proxies.
|
958
1204
|
def ===(object)
|
959
1205
|
object.is_a?(self)
|
960
|
-
end
|
961
|
-
|
962
|
-
# Deprecated
|
963
|
-
def threaded_connections #:nodoc:
|
964
|
-
allow_concurrency
|
965
|
-
end
|
966
|
-
|
967
|
-
# Deprecated
|
968
|
-
def threaded_connections=(value) #:nodoc:
|
969
|
-
self.allow_concurrency = value
|
970
1206
|
end
|
971
1207
|
|
972
1208
|
# Returns the base AR subclass that this class descends from. If A
|
@@ -993,7 +1229,7 @@ module ActiveRecord #:nodoc:
|
|
993
1229
|
|
994
1230
|
def find_every(options)
|
995
1231
|
records = scoped?(:find, :include) || options[:include] ?
|
996
|
-
find_with_associations(options) :
|
1232
|
+
find_with_associations(options) :
|
997
1233
|
find_by_sql(construct_finder_sql(options))
|
998
1234
|
|
999
1235
|
records.each { |record| record.readonly! } if options[:readonly]
|
@@ -1017,10 +1253,10 @@ module ActiveRecord #:nodoc:
|
|
1017
1253
|
find_some(ids, options)
|
1018
1254
|
end
|
1019
1255
|
end
|
1020
|
-
|
1256
|
+
|
1021
1257
|
def find_one(id, options)
|
1022
1258
|
conditions = " AND (#{sanitize_sql(options[:conditions])})" if options[:conditions]
|
1023
|
-
options.update :conditions => "#{
|
1259
|
+
options.update :conditions => "#{quoted_table_name}.#{connection.quote_column_name(primary_key)} = #{quote_value(id,columns_hash[primary_key])}#{conditions}"
|
1024
1260
|
|
1025
1261
|
# Use find_every(options).first since the primary key condition
|
1026
1262
|
# already ensures we have a single record. Using find_initial adds
|
@@ -1031,18 +1267,31 @@ module ActiveRecord #:nodoc:
|
|
1031
1267
|
raise RecordNotFound, "Couldn't find #{name} with ID=#{id}#{conditions}"
|
1032
1268
|
end
|
1033
1269
|
end
|
1034
|
-
|
1270
|
+
|
1035
1271
|
def find_some(ids, options)
|
1036
1272
|
conditions = " AND (#{sanitize_sql(options[:conditions])})" if options[:conditions]
|
1037
1273
|
ids_list = ids.map { |id| quote_value(id,columns_hash[primary_key]) }.join(',')
|
1038
|
-
options.update :conditions => "#{
|
1274
|
+
options.update :conditions => "#{quoted_table_name}.#{connection.quote_column_name(primary_key)} IN (#{ids_list})#{conditions}"
|
1039
1275
|
|
1040
1276
|
result = find_every(options)
|
1041
1277
|
|
1042
|
-
|
1278
|
+
# Determine expected size from limit and offset, not just ids.size.
|
1279
|
+
expected_size =
|
1280
|
+
if options[:limit] && ids.size > options[:limit]
|
1281
|
+
options[:limit]
|
1282
|
+
else
|
1283
|
+
ids.size
|
1284
|
+
end
|
1285
|
+
|
1286
|
+
# 11 ids with limit 3, offset 9 should give 2 results.
|
1287
|
+
if options[:offset] && (ids.size - options[:offset] < expected_size)
|
1288
|
+
expected_size = ids.size - options[:offset]
|
1289
|
+
end
|
1290
|
+
|
1291
|
+
if result.size == expected_size
|
1043
1292
|
result
|
1044
1293
|
else
|
1045
|
-
raise RecordNotFound, "Couldn't find all #{name.pluralize} with IDs (#{ids_list})#{conditions}"
|
1294
|
+
raise RecordNotFound, "Couldn't find all #{name.pluralize} with IDs (#{ids_list})#{conditions} (found #{result.size} results, but was looking for #{expected_size})"
|
1046
1295
|
end
|
1047
1296
|
end
|
1048
1297
|
|
@@ -1052,9 +1301,10 @@ module ActiveRecord #:nodoc:
|
|
1052
1301
|
def instantiate(record)
|
1053
1302
|
object =
|
1054
1303
|
if subclass_name = record[inheritance_column]
|
1304
|
+
# No type given.
|
1055
1305
|
if subclass_name.empty?
|
1056
|
-
# No type given.
|
1057
1306
|
allocate
|
1307
|
+
|
1058
1308
|
else
|
1059
1309
|
# Ignore type if no column is present since it was probably
|
1060
1310
|
# pulled in from a sloppy join.
|
@@ -1078,6 +1328,16 @@ module ActiveRecord #:nodoc:
|
|
1078
1328
|
end
|
1079
1329
|
|
1080
1330
|
object.instance_variable_set("@attributes", record)
|
1331
|
+
object.instance_variable_set("@attributes_cache", Hash.new)
|
1332
|
+
|
1333
|
+
if object.respond_to_without_attributes?(:after_find)
|
1334
|
+
object.send(:callback, :after_find)
|
1335
|
+
end
|
1336
|
+
|
1337
|
+
if object.respond_to_without_attributes?(:after_initialize)
|
1338
|
+
object.send(:callback, :after_initialize)
|
1339
|
+
end
|
1340
|
+
|
1081
1341
|
object
|
1082
1342
|
end
|
1083
1343
|
|
@@ -1089,14 +1349,13 @@ module ActiveRecord #:nodoc:
|
|
1089
1349
|
|
1090
1350
|
def construct_finder_sql(options)
|
1091
1351
|
scope = scope(:find)
|
1092
|
-
sql = "SELECT #{(scope && scope[:select]) || options[:select] || '*'} "
|
1093
|
-
sql << "FROM #{(scope && scope[:from]) || options[:from] ||
|
1352
|
+
sql = "SELECT #{(scope && scope[:select]) || options[:select] || (options[:joins] && quoted_table_name + '.*') || '*'} "
|
1353
|
+
sql << "FROM #{(scope && scope[:from]) || options[:from] || quoted_table_name} "
|
1094
1354
|
|
1095
1355
|
add_joins!(sql, options, scope)
|
1096
1356
|
add_conditions!(sql, options[:conditions], scope)
|
1097
1357
|
|
1098
|
-
sql
|
1099
|
-
|
1358
|
+
add_group!(sql, options[:group], scope)
|
1100
1359
|
add_order!(sql, options[:order], scope)
|
1101
1360
|
add_limit!(sql, options, scope)
|
1102
1361
|
add_lock!(sql, options, scope)
|
@@ -1132,10 +1391,26 @@ module ActiveRecord #:nodoc:
|
|
1132
1391
|
end
|
1133
1392
|
end
|
1134
1393
|
|
1394
|
+
def add_group!(sql, group, scope = :auto)
|
1395
|
+
if group
|
1396
|
+
sql << " GROUP BY #{group}"
|
1397
|
+
else
|
1398
|
+
scope = scope(:find) if :auto == scope
|
1399
|
+
if scope && (scoped_group = scope[:group])
|
1400
|
+
sql << " GROUP BY #{scoped_group}"
|
1401
|
+
end
|
1402
|
+
end
|
1403
|
+
end
|
1404
|
+
|
1135
1405
|
# The optional scope argument is for the current :find scope.
|
1136
1406
|
def add_limit!(sql, options, scope = :auto)
|
1137
1407
|
scope = scope(:find) if :auto == scope
|
1138
|
-
|
1408
|
+
|
1409
|
+
if scope
|
1410
|
+
options[:limit] ||= scope[:limit]
|
1411
|
+
options[:offset] ||= scope[:offset]
|
1412
|
+
end
|
1413
|
+
|
1139
1414
|
connection.add_limit_offset!(sql, options)
|
1140
1415
|
end
|
1141
1416
|
|
@@ -1151,7 +1426,13 @@ module ActiveRecord #:nodoc:
|
|
1151
1426
|
def add_joins!(sql, options, scope = :auto)
|
1152
1427
|
scope = scope(:find) if :auto == scope
|
1153
1428
|
join = (scope && scope[:joins]) || options[:joins]
|
1154
|
-
|
1429
|
+
case join
|
1430
|
+
when Symbol, Hash, Array
|
1431
|
+
join_dependency = ActiveRecord::Associations::ClassMethods::InnerJoinDependency.new(self, join, nil)
|
1432
|
+
sql << " #{join_dependency.join_associations.collect{|join| join.association_join }.join} "
|
1433
|
+
else
|
1434
|
+
sql << " #{join} "
|
1435
|
+
end
|
1155
1436
|
end
|
1156
1437
|
|
1157
1438
|
# Adds a sanitized version of +conditions+ to the +sql+ string. Note that the passed-in +sql+ string is changed.
|
@@ -1159,17 +1440,17 @@ module ActiveRecord #:nodoc:
|
|
1159
1440
|
def add_conditions!(sql, conditions, scope = :auto)
|
1160
1441
|
scope = scope(:find) if :auto == scope
|
1161
1442
|
segments = []
|
1162
|
-
segments << sanitize_sql(scope[:conditions]) if scope && scope[:conditions]
|
1163
|
-
segments << sanitize_sql(conditions) unless conditions.
|
1164
|
-
segments << type_condition
|
1165
|
-
segments.
|
1443
|
+
segments << sanitize_sql(scope[:conditions]) if scope && !scope[:conditions].blank?
|
1444
|
+
segments << sanitize_sql(conditions) unless conditions.blank?
|
1445
|
+
segments << type_condition if finder_needs_type_condition?
|
1446
|
+
segments.delete_if{|s| s.blank?}
|
1166
1447
|
sql << "WHERE (#{segments.join(") AND (")}) " unless segments.empty?
|
1167
1448
|
end
|
1168
1449
|
|
1169
1450
|
def type_condition
|
1170
1451
|
quoted_inheritance_column = connection.quote_column_name(inheritance_column)
|
1171
|
-
type_condition = subclasses.inject("#{
|
1172
|
-
condition << "OR #{
|
1452
|
+
type_condition = subclasses.inject("#{quoted_table_name}.#{quoted_inheritance_column} = '#{name.demodulize}' ") do |condition, subclass|
|
1453
|
+
condition << "OR #{quoted_table_name}.#{quoted_inheritance_column} = '#{subclass.name.demodulize}' "
|
1173
1454
|
end
|
1174
1455
|
|
1175
1456
|
" (#{type_condition}) "
|
@@ -1184,56 +1465,69 @@ module ActiveRecord #:nodoc:
|
|
1184
1465
|
|
1185
1466
|
# Enables dynamic finders like find_by_user_name(user_name) and find_by_user_name_and_password(user_name, password) that are turned into
|
1186
1467
|
# find(:first, :conditions => ["user_name = ?", user_name]) and find(:first, :conditions => ["user_name = ? AND password = ?", user_name, password])
|
1187
|
-
# respectively. Also works for find(:all)
|
1468
|
+
# respectively. Also works for find(:all) by using find_all_by_amount(50) that is turned into find(:all, :conditions => ["amount = ?", 50]).
|
1188
1469
|
#
|
1189
1470
|
# It's even possible to use all the additional parameters to find. For example, the full interface for find_all_by_amount
|
1190
1471
|
# is actually find_all_by_amount(amount, options).
|
1191
1472
|
#
|
1192
|
-
# This also enables you to initialize a record if it is not found, such as find_or_initialize_by_amount(amount)
|
1473
|
+
# This also enables you to initialize a record if it is not found, such as find_or_initialize_by_amount(amount)
|
1193
1474
|
# or find_or_create_by_user_and_password(user, password).
|
1475
|
+
#
|
1476
|
+
# Each dynamic finder or initializer/creator is also defined in the class after it is first invoked, so that future
|
1477
|
+
# attempts to use it do not run through method_missing.
|
1194
1478
|
def method_missing(method_id, *arguments)
|
1195
1479
|
if match = /^find_(all_by|by)_([_a-zA-Z]\w*)$/.match(method_id.to_s)
|
1196
|
-
finder
|
1480
|
+
finder = determine_finder(match)
|
1197
1481
|
|
1198
1482
|
attribute_names = extract_attribute_names_from_match(match)
|
1199
1483
|
super unless all_attributes_exists?(attribute_names)
|
1200
1484
|
|
1201
|
-
|
1202
|
-
|
1203
|
-
|
1204
|
-
|
1205
|
-
|
1485
|
+
self.class_eval %{
|
1486
|
+
def self.#{method_id}(*args)
|
1487
|
+
options = args.last.is_a?(Hash) ? args.pop : {}
|
1488
|
+
attributes = construct_attributes_from_arguments([:#{attribute_names.join(',:')}], args)
|
1489
|
+
finder_options = { :conditions => attributes }
|
1490
|
+
validate_find_options(options)
|
1206
1491
|
set_readonly_option!(options)
|
1207
|
-
ActiveSupport::Deprecation.silence { send(finder, options) }
|
1208
|
-
|
1209
|
-
when Hash
|
1210
|
-
finder_options = extra_options.merge(:conditions => attributes)
|
1211
|
-
validate_find_options(finder_options)
|
1212
|
-
set_readonly_option!(finder_options)
|
1213
1492
|
|
1214
|
-
if
|
1215
|
-
with_scope(:find =>
|
1216
|
-
ActiveSupport::Deprecation.silence { send(finder,
|
1493
|
+
if options[:conditions]
|
1494
|
+
with_scope(:find => finder_options) do
|
1495
|
+
ActiveSupport::Deprecation.silence { send(:#{finder}, options) }
|
1217
1496
|
end
|
1218
1497
|
else
|
1219
|
-
ActiveSupport::Deprecation.silence { send(finder, finder_options) }
|
1498
|
+
ActiveSupport::Deprecation.silence { send(:#{finder}, options.merge(finder_options)) }
|
1220
1499
|
end
|
1221
|
-
|
1222
|
-
|
1223
|
-
|
1224
|
-
send(deprecated_finder, sanitize_sql(attributes), *arguments[attribute_names.length..-1])
|
1225
|
-
end
|
1226
|
-
end
|
1500
|
+
end
|
1501
|
+
}, __FILE__, __LINE__
|
1502
|
+
send(method_id, *arguments)
|
1227
1503
|
elsif match = /^find_or_(initialize|create)_by_([_a-zA-Z]\w*)$/.match(method_id.to_s)
|
1228
1504
|
instantiator = determine_instantiator(match)
|
1229
1505
|
attribute_names = extract_attribute_names_from_match(match)
|
1230
1506
|
super unless all_attributes_exists?(attribute_names)
|
1231
1507
|
|
1232
|
-
|
1233
|
-
|
1234
|
-
|
1508
|
+
self.class_eval %{
|
1509
|
+
def self.#{method_id}(*args)
|
1510
|
+
if args[0].is_a?(Hash)
|
1511
|
+
attributes = args[0].with_indifferent_access
|
1512
|
+
find_attributes = attributes.slice(*[:#{attribute_names.join(',:')}])
|
1513
|
+
else
|
1514
|
+
find_attributes = attributes = construct_attributes_from_arguments([:#{attribute_names.join(',:')}], args)
|
1515
|
+
end
|
1516
|
+
|
1517
|
+
options = { :conditions => find_attributes }
|
1518
|
+
set_readonly_option!(options)
|
1235
1519
|
|
1236
|
-
|
1520
|
+
record = find_initial(options)
|
1521
|
+
if record.nil?
|
1522
|
+
record = self.new { |r| r.send(:attributes=, attributes, false) }
|
1523
|
+
#{'record.save' if instantiator == :create}
|
1524
|
+
record
|
1525
|
+
else
|
1526
|
+
record
|
1527
|
+
end
|
1528
|
+
end
|
1529
|
+
}, __FILE__, __LINE__
|
1530
|
+
send(method_id, *arguments)
|
1237
1531
|
else
|
1238
1532
|
super
|
1239
1533
|
end
|
@@ -1243,10 +1537,6 @@ module ActiveRecord #:nodoc:
|
|
1243
1537
|
match.captures.first == 'all_by' ? :find_every : :find_initial
|
1244
1538
|
end
|
1245
1539
|
|
1246
|
-
def determine_deprecated_finder(match)
|
1247
|
-
match.captures.first == 'all_by' ? :find_all : :find_first
|
1248
|
-
end
|
1249
|
-
|
1250
1540
|
def determine_instantiator(match)
|
1251
1541
|
match.captures.first == 'initialize' ? :new : :create
|
1252
1542
|
end
|
@@ -1268,7 +1558,7 @@ module ActiveRecord #:nodoc:
|
|
1268
1558
|
def attribute_condition(argument)
|
1269
1559
|
case argument
|
1270
1560
|
when nil then "IS ?"
|
1271
|
-
when Array then "IN (?)"
|
1561
|
+
when Array, ActiveRecord::Associations::AssociationCollection then "IN (?)"
|
1272
1562
|
when Range then "BETWEEN ? AND ?"
|
1273
1563
|
else "= ?"
|
1274
1564
|
end
|
@@ -1314,6 +1604,103 @@ module ActiveRecord #:nodoc:
|
|
1314
1604
|
end
|
1315
1605
|
|
1316
1606
|
protected
|
1607
|
+
# Scope parameters to method calls within the block. Takes a hash of method_name => parameters hash.
|
1608
|
+
# method_name may be :find or :create. :find parameters may include the <tt>:conditions</tt>, <tt>:joins</tt>,
|
1609
|
+
# <tt>:include</tt>, <tt>:offset</tt>, <tt>:limit</tt>, and <tt>:readonly</tt> options. :create parameters are an attributes hash.
|
1610
|
+
#
|
1611
|
+
# class Article < ActiveRecord::Base
|
1612
|
+
# def self.create_with_scope
|
1613
|
+
# with_scope(:find => { :conditions => "blog_id = 1" }, :create => { :blog_id => 1 }) do
|
1614
|
+
# find(1) # => SELECT * from articles WHERE blog_id = 1 AND id = 1
|
1615
|
+
# a = create(1)
|
1616
|
+
# a.blog_id # => 1
|
1617
|
+
# end
|
1618
|
+
# end
|
1619
|
+
# end
|
1620
|
+
#
|
1621
|
+
# In nested scopings, all previous parameters are overwritten by the innermost rule, with the exception of
|
1622
|
+
# :conditions and :include options in :find, which are merged.
|
1623
|
+
#
|
1624
|
+
# class Article < ActiveRecord::Base
|
1625
|
+
# def self.find_with_scope
|
1626
|
+
# with_scope(:find => { :conditions => "blog_id = 1", :limit => 1 }, :create => { :blog_id => 1 }) do
|
1627
|
+
# with_scope(:find => { :limit => 10})
|
1628
|
+
# find(:all) # => SELECT * from articles WHERE blog_id = 1 LIMIT 10
|
1629
|
+
# end
|
1630
|
+
# with_scope(:find => { :conditions => "author_id = 3" })
|
1631
|
+
# find(:all) # => SELECT * from articles WHERE blog_id = 1 AND author_id = 3 LIMIT 1
|
1632
|
+
# end
|
1633
|
+
# end
|
1634
|
+
# end
|
1635
|
+
# end
|
1636
|
+
#
|
1637
|
+
# You can ignore any previous scopings by using the <tt>with_exclusive_scope</tt> method.
|
1638
|
+
#
|
1639
|
+
# class Article < ActiveRecord::Base
|
1640
|
+
# def self.find_with_exclusive_scope
|
1641
|
+
# with_scope(:find => { :conditions => "blog_id = 1", :limit => 1 }) do
|
1642
|
+
# with_exclusive_scope(:find => { :limit => 10 })
|
1643
|
+
# find(:all) # => SELECT * from articles LIMIT 10
|
1644
|
+
# end
|
1645
|
+
# end
|
1646
|
+
# end
|
1647
|
+
# end
|
1648
|
+
def with_scope(method_scoping = {}, action = :merge, &block)
|
1649
|
+
method_scoping = method_scoping.method_scoping if method_scoping.respond_to?(:method_scoping)
|
1650
|
+
|
1651
|
+
# Dup first and second level of hash (method and params).
|
1652
|
+
method_scoping = method_scoping.inject({}) do |hash, (method, params)|
|
1653
|
+
hash[method] = (params == true) ? params : params.dup
|
1654
|
+
hash
|
1655
|
+
end
|
1656
|
+
|
1657
|
+
method_scoping.assert_valid_keys([ :find, :create ])
|
1658
|
+
|
1659
|
+
if f = method_scoping[:find]
|
1660
|
+
f.assert_valid_keys(VALID_FIND_OPTIONS)
|
1661
|
+
set_readonly_option! f
|
1662
|
+
end
|
1663
|
+
|
1664
|
+
# Merge scopings
|
1665
|
+
if action == :merge && current_scoped_methods
|
1666
|
+
method_scoping = current_scoped_methods.inject(method_scoping) do |hash, (method, params)|
|
1667
|
+
case hash[method]
|
1668
|
+
when Hash
|
1669
|
+
if method == :find
|
1670
|
+
(hash[method].keys + params.keys).uniq.each do |key|
|
1671
|
+
merge = hash[method][key] && params[key] # merge if both scopes have the same key
|
1672
|
+
if key == :conditions && merge
|
1673
|
+
hash[method][key] = [params[key], hash[method][key]].collect{ |sql| "( %s )" % sanitize_sql(sql) }.join(" AND ")
|
1674
|
+
elsif key == :include && merge
|
1675
|
+
hash[method][key] = merge_includes(hash[method][key], params[key]).uniq
|
1676
|
+
else
|
1677
|
+
hash[method][key] = hash[method][key] || params[key]
|
1678
|
+
end
|
1679
|
+
end
|
1680
|
+
else
|
1681
|
+
hash[method] = params.merge(hash[method])
|
1682
|
+
end
|
1683
|
+
else
|
1684
|
+
hash[method] = params
|
1685
|
+
end
|
1686
|
+
hash
|
1687
|
+
end
|
1688
|
+
end
|
1689
|
+
|
1690
|
+
self.scoped_methods << method_scoping
|
1691
|
+
|
1692
|
+
begin
|
1693
|
+
yield
|
1694
|
+
ensure
|
1695
|
+
self.scoped_methods.pop
|
1696
|
+
end
|
1697
|
+
end
|
1698
|
+
|
1699
|
+
# Works like with_scope, but discards any nested properties.
|
1700
|
+
def with_exclusive_scope(method_scoping = {}, &block)
|
1701
|
+
with_scope(method_scoping, :overwrite, &block)
|
1702
|
+
end
|
1703
|
+
|
1317
1704
|
def subclasses #:nodoc:
|
1318
1705
|
@@subclasses[self] ||= []
|
1319
1706
|
@@subclasses[self] + extra = @@subclasses[self].inject([]) {|list, subclass| list + subclass.subclasses }
|
@@ -1337,18 +1724,18 @@ module ActiveRecord #:nodoc:
|
|
1337
1724
|
scoped_methods = (Thread.current[:scoped_methods] ||= {})
|
1338
1725
|
scoped_methods[self] ||= []
|
1339
1726
|
end
|
1340
|
-
|
1727
|
+
|
1341
1728
|
def single_threaded_scoped_methods #:nodoc:
|
1342
1729
|
@scoped_methods ||= []
|
1343
1730
|
end
|
1344
|
-
|
1731
|
+
|
1345
1732
|
# pick up the correct scoped_methods version from @@allow_concurrency
|
1346
1733
|
if @@allow_concurrency
|
1347
1734
|
alias_method :scoped_methods, :thread_safe_scoped_methods
|
1348
1735
|
else
|
1349
1736
|
alias_method :scoped_methods, :single_threaded_scoped_methods
|
1350
1737
|
end
|
1351
|
-
|
1738
|
+
|
1352
1739
|
def current_scoped_methods #:nodoc:
|
1353
1740
|
scoped_methods.last
|
1354
1741
|
end
|
@@ -1381,32 +1768,66 @@ module ActiveRecord #:nodoc:
|
|
1381
1768
|
end
|
1382
1769
|
|
1383
1770
|
# Accepts an array, hash, or string of sql conditions and sanitizes
|
1384
|
-
# them into a valid SQL fragment.
|
1771
|
+
# them into a valid SQL fragment for a WHERE clause.
|
1385
1772
|
# ["name='%s' and group_id='%s'", "foo'bar", 4] returns "name='foo''bar' and group_id='4'"
|
1386
1773
|
# { :name => "foo'bar", :group_id => 4 } returns "name='foo''bar' and group_id='4'"
|
1387
1774
|
# "name='foo''bar' and group_id='4'" returns "name='foo''bar' and group_id='4'"
|
1388
|
-
def
|
1775
|
+
def sanitize_sql_for_conditions(condition)
|
1389
1776
|
case condition
|
1390
1777
|
when Array; sanitize_sql_array(condition)
|
1391
|
-
when Hash;
|
1778
|
+
when Hash; sanitize_sql_hash_for_conditions(condition)
|
1392
1779
|
else condition
|
1393
1780
|
end
|
1394
1781
|
end
|
1782
|
+
alias_method :sanitize_sql, :sanitize_sql_for_conditions
|
1395
1783
|
|
1396
|
-
#
|
1784
|
+
# Accepts an array, hash, or string of sql conditions and sanitizes
|
1785
|
+
# them into a valid SQL fragment for a SET clause.
|
1786
|
+
# { :name => nil, :group_id => 4 } returns "name = NULL , group_id='4'"
|
1787
|
+
def sanitize_sql_for_assignment(assignments)
|
1788
|
+
case assignments
|
1789
|
+
when Array; sanitize_sql_array(assignments)
|
1790
|
+
when Hash; sanitize_sql_hash_for_assignment(assignments)
|
1791
|
+
else assignments
|
1792
|
+
end
|
1793
|
+
end
|
1794
|
+
|
1795
|
+
# Sanitizes a hash of attribute/value pairs into SQL conditions for a WHERE clause.
|
1397
1796
|
# { :name => "foo'bar", :group_id => 4 }
|
1398
1797
|
# # => "name='foo''bar' and group_id= 4"
|
1399
1798
|
# { :status => nil, :group_id => [1,2,3] }
|
1400
1799
|
# # => "status IS NULL and group_id IN (1,2,3)"
|
1401
1800
|
# { :age => 13..18 }
|
1402
1801
|
# # => "age BETWEEN 13 AND 18"
|
1403
|
-
|
1802
|
+
# { 'other_records.id' => 7 }
|
1803
|
+
# # => "`other_records`.`id` = 7"
|
1804
|
+
def sanitize_sql_hash_for_conditions(attrs)
|
1404
1805
|
conditions = attrs.map do |attr, value|
|
1806
|
+
attr = attr.to_s
|
1807
|
+
|
1808
|
+
# Extract table name from qualified attribute names.
|
1809
|
+
if attr.include?('.')
|
1810
|
+
table_name, attr = attr.split('.', 2)
|
1811
|
+
table_name = connection.quote_table_name(table_name)
|
1812
|
+
else
|
1813
|
+
table_name = quoted_table_name
|
1814
|
+
end
|
1815
|
+
|
1405
1816
|
"#{table_name}.#{connection.quote_column_name(attr)} #{attribute_condition(value)}"
|
1406
1817
|
end.join(' AND ')
|
1407
1818
|
|
1408
1819
|
replace_bind_variables(conditions, expand_range_bind_variables(attrs.values))
|
1409
1820
|
end
|
1821
|
+
alias_method :sanitize_sql_hash, :sanitize_sql_hash_for_conditions
|
1822
|
+
|
1823
|
+
# Sanitizes a hash of attribute/value pairs into SQL conditions for a SET clause.
|
1824
|
+
# { :status => nil, :group_id => 1 }
|
1825
|
+
# # => "status = NULL , group_id = 1"
|
1826
|
+
def sanitize_sql_hash_for_assignment(attrs)
|
1827
|
+
conditions = attrs.map do |attr, value|
|
1828
|
+
"#{connection.quote_column_name(attr)} = #{quote_bound_value(value)}"
|
1829
|
+
end.join(', ')
|
1830
|
+
end
|
1410
1831
|
|
1411
1832
|
# Accepts an array of conditions. The array has each value
|
1412
1833
|
# sanitized and interpolated into the sql statement.
|
@@ -1466,10 +1887,6 @@ module ActiveRecord #:nodoc:
|
|
1466
1887
|
end
|
1467
1888
|
end
|
1468
1889
|
|
1469
|
-
def extract_options_from_args!(args) #:nodoc:
|
1470
|
-
args.last.is_a?(Hash) ? args.pop : {}
|
1471
|
-
end
|
1472
|
-
|
1473
1890
|
VALID_FIND_OPTIONS = [ :conditions, :include, :joins, :limit, :offset,
|
1474
1891
|
:order, :select, :readonly, :group, :from, :lock ]
|
1475
1892
|
|
@@ -1481,8 +1898,8 @@ module ActiveRecord #:nodoc:
|
|
1481
1898
|
# Inherit :readonly from finder scope if set. Otherwise,
|
1482
1899
|
# if :joins is not blank then :readonly defaults to true.
|
1483
1900
|
unless options.has_key?(:readonly)
|
1484
|
-
if
|
1485
|
-
options[:readonly] =
|
1901
|
+
if scoped_readonly = scope(:find, :readonly)
|
1902
|
+
options[:readonly] = scoped_readonly
|
1486
1903
|
elsif !options[:joins].blank? && !options[:select]
|
1487
1904
|
options[:readonly] = true
|
1488
1905
|
end
|
@@ -1491,8 +1908,8 @@ module ActiveRecord #:nodoc:
|
|
1491
1908
|
|
1492
1909
|
def encode_quoted_value(value) #:nodoc:
|
1493
1910
|
quoted_value = connection.quote(value)
|
1494
|
-
quoted_value = "'#{quoted_value[1..-2].gsub(/\'/, "\\\\'")}'" if quoted_value.include?("\\\'") # (for ruby mode) "
|
1495
|
-
quoted_value
|
1911
|
+
quoted_value = "'#{quoted_value[1..-2].gsub(/\'/, "\\\\'")}'" if quoted_value.include?("\\\'") # (for ruby mode) "
|
1912
|
+
quoted_value
|
1496
1913
|
end
|
1497
1914
|
end
|
1498
1915
|
|
@@ -1503,10 +1920,14 @@ module ActiveRecord #:nodoc:
|
|
1503
1920
|
# hence you can't have attributes that aren't part of the table columns.
|
1504
1921
|
def initialize(attributes = nil)
|
1505
1922
|
@attributes = attributes_from_column_definition
|
1923
|
+
@attributes_cache = {}
|
1506
1924
|
@new_record = true
|
1507
1925
|
ensure_proper_type
|
1508
1926
|
self.attributes = attributes unless attributes.nil?
|
1509
|
-
|
1927
|
+
self.class.send(:scope, :create).each { |att,value| self.send("#{att}=", value) } if self.class.send(:scoped?, :create)
|
1928
|
+
result = yield self if block_given?
|
1929
|
+
callback(:after_initialize) if respond_to_without_attributes?(:after_initialize)
|
1930
|
+
result
|
1510
1931
|
end
|
1511
1932
|
|
1512
1933
|
# A model instance's primary key is always available as model.id
|
@@ -1514,8 +1935,11 @@ module ActiveRecord #:nodoc:
|
|
1514
1935
|
def id
|
1515
1936
|
attr_name = self.class.primary_key
|
1516
1937
|
column = column_for_attribute(attr_name)
|
1517
|
-
|
1518
|
-
|
1938
|
+
|
1939
|
+
self.class.send(:define_read_method, :id, attr_name, column)
|
1940
|
+
# now that the method exists, call it
|
1941
|
+
self.send attr_name.to_sym
|
1942
|
+
|
1519
1943
|
end
|
1520
1944
|
|
1521
1945
|
# Enables Active Record objects to be used as URL parameters in Action Pack automatically.
|
@@ -1547,8 +1971,8 @@ module ActiveRecord #:nodoc:
|
|
1547
1971
|
def save
|
1548
1972
|
create_or_update
|
1549
1973
|
end
|
1550
|
-
|
1551
|
-
# Attempts to save the record, but instead of just returning false if it couldn't happen, it raises a
|
1974
|
+
|
1975
|
+
# Attempts to save the record, but instead of just returning false if it couldn't happen, it raises a
|
1552
1976
|
# RecordNotSaved exception
|
1553
1977
|
def save!
|
1554
1978
|
create_or_update || raise(RecordNotSaved)
|
@@ -1559,7 +1983,7 @@ module ActiveRecord #:nodoc:
|
|
1559
1983
|
def destroy
|
1560
1984
|
unless new_record?
|
1561
1985
|
connection.delete <<-end_sql, "#{self.class.name} Destroy"
|
1562
|
-
DELETE FROM #{self.class.
|
1986
|
+
DELETE FROM #{self.class.quoted_table_name}
|
1563
1987
|
WHERE #{connection.quote_column_name(self.class.primary_key)} = #{quoted_id}
|
1564
1988
|
end_sql
|
1565
1989
|
end
|
@@ -1575,14 +1999,29 @@ module ActiveRecord #:nodoc:
|
|
1575
1999
|
def clone
|
1576
2000
|
attrs = self.attributes_before_type_cast
|
1577
2001
|
attrs.delete(self.class.primary_key)
|
1578
|
-
self.class.new
|
1579
|
-
|
2002
|
+
record = self.class.new
|
2003
|
+
record.send :instance_variable_set, '@attributes', attrs
|
2004
|
+
record
|
2005
|
+
end
|
2006
|
+
|
2007
|
+
# Returns an instance of the specified klass with the attributes of the current record. This is mostly useful in relation to
|
2008
|
+
# single-table inheritance structures where you want a subclass to appear as the superclass. This can be used along with record
|
2009
|
+
# identification in Action Pack to allow, say, Client < Company to do something like render :partial => @client.becomes(Company)
|
2010
|
+
# to render that instance using the companies/company partial instead of clients/client.
|
2011
|
+
#
|
2012
|
+
# Note: The new instance will share a link to the same attributes as the original class. So any change to the attributes in either
|
2013
|
+
# instance will affect the other.
|
2014
|
+
def becomes(klass)
|
2015
|
+
returning klass.new do |became|
|
2016
|
+
became.instance_variable_set("@attributes", @attributes)
|
2017
|
+
became.instance_variable_set("@attributes_cache", @attributes_cache)
|
2018
|
+
became.instance_variable_set("@new_record", new_record?)
|
1580
2019
|
end
|
1581
2020
|
end
|
1582
2021
|
|
1583
2022
|
# Updates a single attribute and saves the record. This is especially useful for boolean flags on existing records.
|
1584
2023
|
# Note: This method is overwritten by the Validation module that'll make sure that updates made with this method
|
1585
|
-
#
|
2024
|
+
# aren't subjected to validation checks. Hence, attributes can be updated even if the full object isn't valid.
|
1586
2025
|
def update_attribute(name, value)
|
1587
2026
|
send(name.to_s + '=', value)
|
1588
2027
|
save
|
@@ -1594,7 +2033,7 @@ module ActiveRecord #:nodoc:
|
|
1594
2033
|
self.attributes = attributes
|
1595
2034
|
save
|
1596
2035
|
end
|
1597
|
-
|
2036
|
+
|
1598
2037
|
# Updates an object just like Base.update_attributes but calls save! instead of save so an exception is raised if the record is invalid.
|
1599
2038
|
def update_attributes!(attributes)
|
1600
2039
|
self.attributes = attributes
|
@@ -1644,6 +2083,7 @@ module ActiveRecord #:nodoc:
|
|
1644
2083
|
clear_aggregation_cache
|
1645
2084
|
clear_association_cache
|
1646
2085
|
@attributes.update(self.class.find(self.id, options).instance_variable_get('@attributes'))
|
2086
|
+
@attributes_cache = {}
|
1647
2087
|
self
|
1648
2088
|
end
|
1649
2089
|
|
@@ -1663,15 +2103,17 @@ module ActiveRecord #:nodoc:
|
|
1663
2103
|
# Allows you to set all the attributes at once by passing in a hash with keys
|
1664
2104
|
# matching the attribute names (which again matches the column names). Sensitive attributes can be protected
|
1665
2105
|
# from this form of mass-assignment by using the +attr_protected+ macro. Or you can alternatively
|
1666
|
-
# specify which attributes *can* be accessed
|
2106
|
+
# specify which attributes *can* be accessed with the +attr_accessible+ macro. Then all the
|
1667
2107
|
# attributes not included in that won't be allowed to be mass-assigned.
|
1668
|
-
def attributes=(new_attributes)
|
2108
|
+
def attributes=(new_attributes, guard_protected_attributes = true)
|
1669
2109
|
return if new_attributes.nil?
|
1670
2110
|
attributes = new_attributes.dup
|
1671
2111
|
attributes.stringify_keys!
|
1672
2112
|
|
1673
2113
|
multi_parameter_attributes = []
|
1674
|
-
remove_attributes_protected_from_mass_assignment(attributes)
|
2114
|
+
attributes = remove_attributes_protected_from_mass_assignment(attributes) if guard_protected_attributes
|
2115
|
+
|
2116
|
+
attributes.each do |k, v|
|
1675
2117
|
k.include?("(") ? multi_parameter_attributes << [ k, v ] : send(k + "=", v)
|
1676
2118
|
end
|
1677
2119
|
|
@@ -1682,7 +2124,7 @@ module ActiveRecord #:nodoc:
|
|
1682
2124
|
# Returns a hash of all the attributes with their names as keys and clones of their objects as values.
|
1683
2125
|
def attributes(options = nil)
|
1684
2126
|
attributes = clone_attributes :read_attribute
|
1685
|
-
|
2127
|
+
|
1686
2128
|
if options.nil?
|
1687
2129
|
attributes
|
1688
2130
|
else
|
@@ -1705,11 +2147,24 @@ module ActiveRecord #:nodoc:
|
|
1705
2147
|
clone_attributes :read_attribute_before_type_cast
|
1706
2148
|
end
|
1707
2149
|
|
2150
|
+
# Format attributes nicely for inspect.
|
2151
|
+
def attribute_for_inspect(attr_name)
|
2152
|
+
value = read_attribute(attr_name)
|
2153
|
+
|
2154
|
+
if value.is_a?(String) && value.length > 50
|
2155
|
+
"#{value[0..50]}...".inspect
|
2156
|
+
elsif value.is_a?(Date) || value.is_a?(Time)
|
2157
|
+
%("#{value.to_s(:db)}")
|
2158
|
+
else
|
2159
|
+
value.inspect
|
2160
|
+
end
|
2161
|
+
end
|
2162
|
+
|
1708
2163
|
# Returns true if the specified +attribute+ has been set by the user or by a database load and is neither
|
1709
2164
|
# nil nor empty? (the latter only applies to objects that respond to empty?, most notably Strings).
|
1710
2165
|
def attribute_present?(attribute)
|
1711
2166
|
value = read_attribute(attribute)
|
1712
|
-
!value.blank?
|
2167
|
+
!value.blank?
|
1713
2168
|
end
|
1714
2169
|
|
1715
2170
|
# Returns true if the given attribute is in the attributes hash
|
@@ -1730,8 +2185,8 @@ module ActiveRecord #:nodoc:
|
|
1730
2185
|
# Returns true if the +comparison_object+ is the same object, or is of the same type and has the same id.
|
1731
2186
|
def ==(comparison_object)
|
1732
2187
|
comparison_object.equal?(self) ||
|
1733
|
-
(comparison_object.instance_of?(self.class) &&
|
1734
|
-
comparison_object.id == id &&
|
2188
|
+
(comparison_object.instance_of?(self.class) &&
|
2189
|
+
comparison_object.id == id &&
|
1735
2190
|
!comparison_object.new_record?)
|
1736
2191
|
end
|
1737
2192
|
|
@@ -1746,45 +2201,36 @@ module ActiveRecord #:nodoc:
|
|
1746
2201
|
id.hash
|
1747
2202
|
end
|
1748
2203
|
|
1749
|
-
#
|
1750
|
-
alias_method :respond_to_without_attributes?, :respond_to?
|
1751
|
-
|
1752
|
-
# A Person object with a name attribute can ask person.respond_to?("name"), person.respond_to?("name="), and
|
1753
|
-
# person.respond_to?("name?") which will all return true.
|
1754
|
-
def respond_to?(method, include_priv = false)
|
1755
|
-
if @attributes.nil?
|
1756
|
-
return super
|
1757
|
-
elsif attr_name = self.class.column_methods_hash[method.to_sym]
|
1758
|
-
return true if @attributes.include?(attr_name) || attr_name == self.class.primary_key
|
1759
|
-
return false if self.class.read_methods.include?(attr_name)
|
1760
|
-
elsif @attributes.include?(method_name = method.to_s)
|
1761
|
-
return true
|
1762
|
-
elsif md = self.class.match_attribute_method?(method.to_s)
|
1763
|
-
return true if @attributes.include?(md.pre_match)
|
1764
|
-
end
|
1765
|
-
# super must be called at the end of the method, because the inherited respond_to?
|
1766
|
-
# would return true for generated readers, even if the attribute wasn't present
|
1767
|
-
super
|
1768
|
-
end
|
1769
|
-
|
1770
|
-
# Just freeze the attributes hash, such that associations are still accessible even on destroyed records.
|
2204
|
+
# Freeze the attributes hash such that associations are still accessible, even on destroyed records.
|
1771
2205
|
def freeze
|
1772
2206
|
@attributes.freeze; self
|
1773
2207
|
end
|
1774
2208
|
|
2209
|
+
# Returns +true+ if the attributes hash has been frozen.
|
1775
2210
|
def frozen?
|
1776
2211
|
@attributes.frozen?
|
1777
2212
|
end
|
1778
2213
|
|
1779
|
-
#
|
2214
|
+
# Returns +true+ if the record is read only. Records loaded through joins with piggy-back
|
2215
|
+
# attributes will be marked as read only since they cannot be saved.
|
1780
2216
|
def readonly?
|
1781
2217
|
@readonly == true
|
1782
2218
|
end
|
1783
2219
|
|
1784
|
-
|
2220
|
+
# Marks this record as read only.
|
2221
|
+
def readonly!
|
1785
2222
|
@readonly = true
|
1786
2223
|
end
|
1787
2224
|
|
2225
|
+
# Returns the contents of the record as a nicely formatted string.
|
2226
|
+
def inspect
|
2227
|
+
attributes_as_nice_string = self.class.column_names.collect { |name|
|
2228
|
+
if has_attribute?(name) || new_record?
|
2229
|
+
"#{name}: #{attribute_for_inspect(name)}"
|
2230
|
+
end
|
2231
|
+
}.compact.join(", ")
|
2232
|
+
"#<#{self.class} #{attributes_as_nice_string}>"
|
2233
|
+
end
|
1788
2234
|
|
1789
2235
|
private
|
1790
2236
|
def create_or_update
|
@@ -1796,9 +2242,11 @@ module ActiveRecord #:nodoc:
|
|
1796
2242
|
# Updates the associated record with values matching those of the instance attributes.
|
1797
2243
|
# Returns the number of affected rows.
|
1798
2244
|
def update
|
2245
|
+
quoted_attributes = attributes_with_quotes(false, false)
|
2246
|
+
return 0 if quoted_attributes.empty?
|
1799
2247
|
connection.update(
|
1800
|
-
"UPDATE #{self.class.
|
1801
|
-
"SET #{quoted_comma_pair_list(connection,
|
2248
|
+
"UPDATE #{self.class.quoted_table_name} " +
|
2249
|
+
"SET #{quoted_comma_pair_list(connection, quoted_attributes)} " +
|
1802
2250
|
"WHERE #{connection.quote_column_name(self.class.primary_key)} = #{quote_value(id)}",
|
1803
2251
|
"#{self.class.name} Update"
|
1804
2252
|
)
|
@@ -1811,13 +2259,18 @@ module ActiveRecord #:nodoc:
|
|
1811
2259
|
self.id = connection.next_sequence_value(self.class.sequence_name)
|
1812
2260
|
end
|
1813
2261
|
|
1814
|
-
|
1815
|
-
|
2262
|
+
quoted_attributes = attributes_with_quotes
|
2263
|
+
|
2264
|
+
statement = if quoted_attributes.empty?
|
2265
|
+
connection.empty_insert_statement(self.class.table_name)
|
2266
|
+
else
|
2267
|
+
"INSERT INTO #{self.class.quoted_table_name} " +
|
1816
2268
|
"(#{quoted_column_names.join(', ')}) " +
|
1817
|
-
"VALUES(#{
|
1818
|
-
|
1819
|
-
|
1820
|
-
|
2269
|
+
"VALUES(#{quoted_attributes.values.join(', ')})"
|
2270
|
+
end
|
2271
|
+
|
2272
|
+
self.id = connection.insert(statement, "#{self.class.name} Create",
|
2273
|
+
self.class.primary_key, self.id, self.class.sequence_name)
|
1821
2274
|
|
1822
2275
|
@new_record = false
|
1823
2276
|
id
|
@@ -1833,189 +2286,42 @@ module ActiveRecord #:nodoc:
|
|
1833
2286
|
end
|
1834
2287
|
end
|
1835
2288
|
|
1836
|
-
|
1837
|
-
|
1838
|
-
|
1839
|
-
|
1840
|
-
|
1841
|
-
|
1842
|
-
#
|
1843
|
-
# It's also possible to instantiate related objects, so a Client class belonging to the clients
|
1844
|
-
# table with a master_id foreign key can instantiate master through Client#master.
|
1845
|
-
def method_missing(method_id, *args, &block)
|
1846
|
-
method_name = method_id.to_s
|
1847
|
-
if @attributes.include?(method_name) or
|
1848
|
-
(md = /\?$/.match(method_name) and
|
1849
|
-
@attributes.include?(query_method_name = md.pre_match) and
|
1850
|
-
method_name = query_method_name)
|
1851
|
-
define_read_methods if self.class.read_methods.empty? && self.class.generate_read_methods
|
1852
|
-
md ? query_attribute(method_name) : read_attribute(method_name)
|
1853
|
-
elsif self.class.primary_key.to_s == method_name
|
1854
|
-
id
|
1855
|
-
elsif md = self.class.match_attribute_method?(method_name)
|
1856
|
-
attribute_name, method_type = md.pre_match, md.to_s
|
1857
|
-
if @attributes.include?(attribute_name)
|
1858
|
-
__send__("attribute#{method_type}", attribute_name, *args, &block)
|
1859
|
-
else
|
1860
|
-
super
|
1861
|
-
end
|
1862
|
-
else
|
1863
|
-
super
|
2289
|
+
def convert_number_column_value(value)
|
2290
|
+
case value
|
2291
|
+
when FalseClass; 0
|
2292
|
+
when TrueClass; 1
|
2293
|
+
when ''; nil
|
2294
|
+
else value
|
1864
2295
|
end
|
1865
2296
|
end
|
1866
2297
|
|
1867
|
-
|
1868
|
-
|
1869
|
-
|
1870
|
-
|
1871
|
-
|
1872
|
-
|
1873
|
-
|
1874
|
-
|
1875
|
-
else
|
1876
|
-
column.type_cast(value)
|
1877
|
-
end
|
2298
|
+
def remove_attributes_protected_from_mass_assignment(attributes)
|
2299
|
+
safe_attributes =
|
2300
|
+
if self.class.accessible_attributes.nil? && self.class.protected_attributes.nil?
|
2301
|
+
attributes.reject { |key, value| attributes_protected_by_default.include?(key.gsub(/\(.+/, "")) }
|
2302
|
+
elsif self.class.protected_attributes.nil?
|
2303
|
+
attributes.reject { |key, value| !self.class.accessible_attributes.include?(key.gsub(/\(.+/, "")) || attributes_protected_by_default.include?(key.gsub(/\(.+/, "")) }
|
2304
|
+
elsif self.class.accessible_attributes.nil?
|
2305
|
+
attributes.reject { |key, value| self.class.protected_attributes.include?(key.gsub(/\(.+/,"")) || attributes_protected_by_default.include?(key.gsub(/\(.+/, "")) }
|
1878
2306
|
else
|
1879
|
-
|
2307
|
+
raise "Declare either attr_protected or attr_accessible for #{self.class}, but not both."
|
1880
2308
|
end
|
1881
|
-
else
|
1882
|
-
nil
|
1883
|
-
end
|
1884
|
-
end
|
1885
2309
|
|
1886
|
-
|
1887
|
-
@attributes[attr_name]
|
1888
|
-
end
|
1889
|
-
|
1890
|
-
# Called on first read access to any given column and generates reader
|
1891
|
-
# methods for all columns in the columns_hash if
|
1892
|
-
# ActiveRecord::Base.generate_read_methods is set to true.
|
1893
|
-
def define_read_methods
|
1894
|
-
self.class.columns_hash.each do |name, column|
|
1895
|
-
unless respond_to_without_attributes?(name)
|
1896
|
-
if self.class.serialized_attributes[name]
|
1897
|
-
define_read_method_for_serialized_attribute(name)
|
1898
|
-
else
|
1899
|
-
define_read_method(name.to_sym, name, column)
|
1900
|
-
end
|
1901
|
-
end
|
1902
|
-
|
1903
|
-
unless respond_to_without_attributes?("#{name}?")
|
1904
|
-
define_question_method(name)
|
1905
|
-
end
|
1906
|
-
end
|
1907
|
-
end
|
1908
|
-
|
1909
|
-
# Define an attribute reader method. Cope with nil column.
|
1910
|
-
def define_read_method(symbol, attr_name, column)
|
1911
|
-
cast_code = column.type_cast_code('v') if column
|
1912
|
-
access_code = cast_code ? "(v=@attributes['#{attr_name}']) && #{cast_code}" : "@attributes['#{attr_name}']"
|
1913
|
-
|
1914
|
-
unless attr_name.to_s == self.class.primary_key.to_s
|
1915
|
-
access_code = access_code.insert(0, "raise NoMethodError, 'missing attribute: #{attr_name}', caller unless @attributes.has_key?('#{attr_name}'); ")
|
1916
|
-
self.class.read_methods << attr_name
|
1917
|
-
end
|
1918
|
-
|
1919
|
-
evaluate_read_method attr_name, "def #{symbol}; #{access_code}; end"
|
1920
|
-
end
|
1921
|
-
|
1922
|
-
# Define read method for serialized attribute.
|
1923
|
-
def define_read_method_for_serialized_attribute(attr_name)
|
1924
|
-
unless attr_name.to_s == self.class.primary_key.to_s
|
1925
|
-
self.class.read_methods << attr_name
|
1926
|
-
end
|
1927
|
-
|
1928
|
-
evaluate_read_method attr_name, "def #{attr_name}; unserialize_attribute('#{attr_name}'); end"
|
1929
|
-
end
|
1930
|
-
|
1931
|
-
# Define an attribute ? method.
|
1932
|
-
def define_question_method(attr_name)
|
1933
|
-
unless attr_name.to_s == self.class.primary_key.to_s
|
1934
|
-
self.class.read_methods << "#{attr_name}?"
|
1935
|
-
end
|
1936
|
-
|
1937
|
-
evaluate_read_method attr_name, "def #{attr_name}?; query_attribute('#{attr_name}'); end"
|
1938
|
-
end
|
1939
|
-
|
1940
|
-
# Evaluate the definition for an attribute reader or ? method
|
1941
|
-
def evaluate_read_method(attr_name, method_definition)
|
1942
|
-
begin
|
1943
|
-
self.class.class_eval(method_definition)
|
1944
|
-
rescue SyntaxError => err
|
1945
|
-
self.class.read_methods.delete(attr_name)
|
1946
|
-
if logger
|
1947
|
-
logger.warn "Exception occurred during reader method compilation."
|
1948
|
-
logger.warn "Maybe #{attr_name} is not a valid Ruby identifier?"
|
1949
|
-
logger.warn "#{err.message}"
|
1950
|
-
end
|
1951
|
-
end
|
1952
|
-
end
|
1953
|
-
|
1954
|
-
# Returns true if the attribute is of a text column and marked for serialization.
|
1955
|
-
def unserializable_attribute?(attr_name, column)
|
1956
|
-
column.text? && self.class.serialized_attributes[attr_name]
|
1957
|
-
end
|
1958
|
-
|
1959
|
-
# Returns the unserialized object of the attribute.
|
1960
|
-
def unserialize_attribute(attr_name)
|
1961
|
-
unserialized_object = object_from_yaml(@attributes[attr_name])
|
1962
|
-
|
1963
|
-
if unserialized_object.is_a?(self.class.serialized_attributes[attr_name]) || unserialized_object.nil?
|
1964
|
-
@attributes[attr_name] = unserialized_object
|
1965
|
-
else
|
1966
|
-
raise SerializationTypeMismatch,
|
1967
|
-
"#{attr_name} was supposed to be a #{self.class.serialized_attributes[attr_name]}, but was a #{unserialized_object.class.to_s}"
|
1968
|
-
end
|
1969
|
-
end
|
2310
|
+
removed_attributes = attributes.keys - safe_attributes.keys
|
1970
2311
|
|
1971
|
-
|
1972
|
-
|
1973
|
-
def write_attribute(attr_name, value)
|
1974
|
-
attr_name = attr_name.to_s
|
1975
|
-
if (column = column_for_attribute(attr_name)) && column.number?
|
1976
|
-
@attributes[attr_name] = convert_number_column_value(value)
|
1977
|
-
else
|
1978
|
-
@attributes[attr_name] = value
|
2312
|
+
if removed_attributes.any?
|
2313
|
+
logger.debug "WARNING: Can't mass-assign these protected attributes: #{removed_attributes.join(', ')}"
|
1979
2314
|
end
|
1980
|
-
end
|
1981
2315
|
|
1982
|
-
|
1983
|
-
case value
|
1984
|
-
when FalseClass: 0
|
1985
|
-
when TrueClass: 1
|
1986
|
-
when '': nil
|
1987
|
-
else value
|
1988
|
-
end
|
2316
|
+
safe_attributes
|
1989
2317
|
end
|
1990
2318
|
|
1991
|
-
|
1992
|
-
|
1993
|
-
|
1994
|
-
|
1995
|
-
elsif attribute.kind_of?(String) && attribute == "0"
|
1996
|
-
false
|
1997
|
-
elsif attribute.kind_of?(String) && attribute.empty?
|
1998
|
-
false
|
1999
|
-
elsif attribute.nil?
|
2000
|
-
false
|
2001
|
-
elsif attribute == false
|
2002
|
-
false
|
2003
|
-
elsif attribute == "f"
|
2004
|
-
false
|
2005
|
-
elsif attribute == "false"
|
2006
|
-
false
|
2319
|
+
# Removes attributes which have been marked as readonly.
|
2320
|
+
def remove_readonly_attributes(attributes)
|
2321
|
+
unless self.class.readonly_attributes.nil?
|
2322
|
+
attributes.delete_if { |key, value| self.class.readonly_attributes.include?(key.gsub(/\(.+/,"")) }
|
2007
2323
|
else
|
2008
|
-
|
2009
|
-
end
|
2010
|
-
end
|
2011
|
-
|
2012
|
-
def remove_attributes_protected_from_mass_assignment(attributes)
|
2013
|
-
if self.class.accessible_attributes.nil? && self.class.protected_attributes.nil?
|
2014
|
-
attributes.reject { |key, value| attributes_protected_by_default.include?(key.gsub(/\(.+/, "")) }
|
2015
|
-
elsif self.class.protected_attributes.nil?
|
2016
|
-
attributes.reject { |key, value| !self.class.accessible_attributes.include?(key.gsub(/\(.+/, "").intern) || attributes_protected_by_default.include?(key.gsub(/\(.+/, "")) }
|
2017
|
-
elsif self.class.accessible_attributes.nil?
|
2018
|
-
attributes.reject { |key, value| self.class.protected_attributes.include?(key.gsub(/\(.+/,"").intern) || attributes_protected_by_default.include?(key.gsub(/\(.+/, "")) }
|
2324
|
+
attributes
|
2019
2325
|
end
|
2020
2326
|
end
|
2021
2327
|
|
@@ -2026,15 +2332,16 @@ module ActiveRecord #:nodoc:
|
|
2026
2332
|
default
|
2027
2333
|
end
|
2028
2334
|
|
2029
|
-
# Returns copy of the attributes hash where all the values have been safely quoted for use in
|
2335
|
+
# Returns a copy of the attributes hash where all the values have been safely quoted for use in
|
2030
2336
|
# an SQL statement.
|
2031
|
-
def attributes_with_quotes(include_primary_key = true)
|
2032
|
-
attributes.inject({}) do |quoted, (name, value)|
|
2337
|
+
def attributes_with_quotes(include_primary_key = true, include_readonly_attributes = true)
|
2338
|
+
quoted = attributes.inject({}) do |quoted, (name, value)|
|
2033
2339
|
if column = column_for_attribute(name)
|
2034
2340
|
quoted[name] = quote_value(value, column) unless !include_primary_key && column.primary
|
2035
2341
|
end
|
2036
2342
|
quoted
|
2037
2343
|
end
|
2344
|
+
include_readonly_attributes ? quoted : remove_readonly_attributes(quoted)
|
2038
2345
|
end
|
2039
2346
|
|
2040
2347
|
# Quote strings appropriately for SQL statements.
|
@@ -2042,13 +2349,6 @@ module ActiveRecord #:nodoc:
|
|
2042
2349
|
self.class.connection.quote(value, column)
|
2043
2350
|
end
|
2044
2351
|
|
2045
|
-
# Deprecated, use quote_value
|
2046
|
-
def quote(value, column = nil)
|
2047
|
-
self.class.connection.quote(value, column)
|
2048
|
-
end
|
2049
|
-
deprecate :quote => :quote_value
|
2050
|
-
|
2051
|
-
|
2052
2352
|
# Interpolate custom sql string in instance context.
|
2053
2353
|
# Optional record argument is meant for custom insert_sql.
|
2054
2354
|
def interpolate_sql(sql, record = nil)
|
@@ -2071,7 +2371,7 @@ module ActiveRecord #:nodoc:
|
|
2071
2371
|
# So having the pairs written_on(1) = "2004", written_on(2) = "6", written_on(3) = "24", will instantiate
|
2072
2372
|
# written_on (a date type) with Date.new("2004", "6", "24"). You can also specify a typecast character in the
|
2073
2373
|
# parentheses to have the parameters typecasted before they're used in the constructor. Use i for Fixnum, f for Float,
|
2074
|
-
# s for String, and a for Array. If all the values for a given attribute
|
2374
|
+
# s for String, and a for Array. If all the values for a given attribute are empty, the attribute will be set to nil.
|
2075
2375
|
def assign_multiparameter_attributes(pairs)
|
2076
2376
|
execute_callstack_for_multiparameter_attributes(
|
2077
2377
|
extract_callstack_for_multiparameter_attributes(pairs)
|
@@ -2134,6 +2434,10 @@ module ActiveRecord #:nodoc:
|
|
2134
2434
|
end
|
2135
2435
|
end
|
2136
2436
|
|
2437
|
+
def self.quoted_table_name
|
2438
|
+
self.connection.quote_table_name(self.table_name)
|
2439
|
+
end
|
2440
|
+
|
2137
2441
|
def quote_columns(quoter, hash)
|
2138
2442
|
hash.inject({}) do |quoted, (name, value)|
|
2139
2443
|
quoted[quoter.quote_column_name(name)] = value
|
@@ -2159,13 +2463,7 @@ module ActiveRecord #:nodoc:
|
|
2159
2463
|
|
2160
2464
|
def clone_attribute_value(reader_method, attribute_name)
|
2161
2465
|
value = send(reader_method, attribute_name)
|
2162
|
-
|
2163
|
-
case value
|
2164
|
-
when nil, Fixnum, true, false
|
2165
|
-
value
|
2166
|
-
else
|
2167
|
-
value.clone
|
2168
|
-
end
|
2466
|
+
value.duplicable? ? value.clone : value
|
2169
2467
|
rescue TypeError, NoMethodError
|
2170
2468
|
value
|
2171
2469
|
end
|