radiant 0.8.0 → 0.8.1
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 +33 -1
- data/CONTRIBUTORS +15 -2
- data/INSTALL +9 -7
- data/README +11 -7
- data/app/controllers/admin/layouts_controller.rb +5 -2
- data/app/controllers/admin/pages_controller.rb +8 -5
- data/app/controllers/admin/snippets_controller.rb +5 -2
- data/app/controllers/application_controller.rb +7 -0
- data/app/helpers/admin/node_helper.rb +2 -2
- data/app/helpers/application_helper.rb +2 -2
- data/app/models/radiant/config.rb +36 -4
- data/app/models/standard_tags.rb +1 -1
- data/app/views/admin/layouts/index.html.haml +15 -12
- data/app/views/admin/page_parts/_page_part.html.haml +2 -2
- data/app/views/admin/pages/index.html.haml +1 -1
- data/app/views/admin/snippets/_form.html.haml +1 -1
- data/app/views/admin/snippets/index.html.haml +14 -10
- data/config/database.db2.yml +20 -0
- data/config/environment.rb +4 -4
- data/config/environments/test.rb +1 -2
- data/features/support/env.rb +2 -1
- data/lib/generators/extension/extension_generator.rb +5 -0
- data/lib/generators/extension/templates/RSpecRakefile +11 -8
- data/lib/generators/extension/templates/cucumber.yml +1 -0
- data/lib/generators/extension/templates/cucumber_env.rb +16 -0
- data/lib/generators/extension/templates/cucumber_paths.rb +14 -0
- data/lib/generators/extension/templates/extension.rb +1 -1
- data/lib/generators/instance/instance_generator.rb +1 -1
- data/lib/generators/instance/templates/databases/db2.yml +40 -0
- data/lib/generators/instance/templates/instance_environment.rb +6 -6
- data/lib/local_time.rb +3 -9
- data/lib/radiant.rb +1 -1
- data/lib/radiant/cache.rb +10 -8
- data/lib/radiant/extension.rb +36 -0
- data/lib/radiant/extension/script.rb +1 -1
- data/lib/radiant/extension_loader.rb +5 -1
- data/lib/radiant/initializer.rb +52 -4
- data/lib/task_support.rb +33 -0
- data/lib/tasks/cucumber.rake +5 -1
- data/lib/tasks/radiant_config.rake +18 -0
- data/lib/tasks/release.rake +1 -0
- data/public/javascripts/admin/admin.js +1 -1
- data/spec/controllers/admin/layouts_controller_spec.rb +18 -12
- data/spec/controllers/admin/pages_controller_spec.rb +35 -29
- data/spec/controllers/admin/snippets_controller_spec.rb +11 -5
- data/spec/controllers/admin/welcome_controller_spec.rb +1 -1
- data/spec/controllers/application_controller_spec.rb +18 -0
- data/spec/fixtures/radiant_config.yml +10 -0
- data/spec/generators/extension_generator_spec.rb +12 -0
- data/spec/helpers/admin/node_helper_spec.rb +6 -0
- data/spec/helpers/application_helper_spec.rb +1 -1
- data/spec/lib/radiant/extension_loader_spec.rb +17 -0
- data/spec/lib/radiant/extension_spec.rb +28 -0
- data/spec/lib/radiant/initializer_spec.rb +34 -0
- data/spec/lib/task_support_spec.rb +42 -0
- data/spec/models/page_spec.rb +6 -2
- data/spec/models/radiant/config_spec.rb +42 -1
- data/spec/models/standard_tags_spec.rb +2 -2
- data/test/fixtures/extensions/01_basic/app/metal/basic_metal.rb +9 -0
- data/test/fixtures/extensions/02_overriding/app/metal/basic_metal.rb +9 -0
- data/vendor/extensions/textile_filter/textile.html +2 -2
- data/vendor/plugins/dataset/CHANGELOG +2 -1
- data/vendor/plugins/dataset/Rakefile +3 -0
- data/vendor/plugins/dataset/VERSION.yml +2 -2
- data/vendor/plugins/dataset/dataset.gemspec +9 -3
- data/vendor/plugins/dataset/lib/dataset.rb +3 -0
- data/vendor/radius/lib/radius.rb +5 -0
- data/vendor/radius/test/radius_test.rb +6 -0
- data/vendor/rails/actionmailer/CHANGELOG +8 -0
- data/vendor/rails/actionmailer/Rakefile +3 -2
- data/vendor/rails/actionmailer/lib/action_mailer/base.rb +2 -1
- data/vendor/rails/actionmailer/lib/action_mailer/version.rb +1 -1
- data/vendor/rails/actionmailer/test/abstract_unit.rb +0 -3
- data/vendor/rails/actionmailer/test/mail_service_test.rb +3 -2
- data/vendor/rails/actionpack/CHANGELOG +16 -0
- data/vendor/rails/actionpack/Rakefile +5 -3
- data/vendor/rails/actionpack/lib/action_controller.rb +2 -7
- data/vendor/rails/actionpack/lib/action_controller/assertions/response_assertions.rb +13 -3
- data/vendor/rails/actionpack/lib/action_controller/base.rb +12 -3
- data/vendor/rails/actionpack/lib/action_controller/caching.rb +1 -1
- data/vendor/rails/actionpack/lib/action_controller/caching/actions.rb +9 -1
- data/vendor/rails/actionpack/lib/action_controller/caching/sweeper.rb +45 -0
- data/vendor/rails/actionpack/lib/action_controller/caching/sweeping.rb +0 -42
- data/vendor/rails/actionpack/lib/action_controller/cookies.rb +1 -1
- data/vendor/rails/actionpack/lib/action_controller/dispatcher.rb +21 -6
- data/vendor/rails/actionpack/lib/action_controller/failsafe.rb +40 -6
- data/vendor/rails/actionpack/lib/action_controller/flash.rb +11 -3
- data/vendor/rails/actionpack/lib/action_controller/http_authentication.rb +7 -3
- data/vendor/rails/actionpack/lib/action_controller/integration.rb +5 -12
- data/vendor/rails/actionpack/lib/action_controller/middlewares.rb +0 -1
- data/vendor/rails/actionpack/lib/action_controller/params_parser.rb +6 -0
- data/vendor/rails/actionpack/lib/action_controller/reloader.rb +47 -7
- data/vendor/rails/actionpack/lib/action_controller/request.rb +6 -2
- data/vendor/rails/actionpack/lib/action_controller/request_forgery_protection.rb +2 -1
- data/vendor/rails/actionpack/lib/action_controller/resources.rb +17 -13
- data/vendor/rails/actionpack/lib/action_controller/response.rb +8 -2
- data/vendor/rails/actionpack/lib/action_controller/routing.rb +3 -0
- data/vendor/rails/actionpack/lib/action_controller/routing/route_set.rb +20 -6
- data/vendor/rails/actionpack/lib/action_controller/streaming.rb +4 -2
- data/vendor/rails/actionpack/lib/action_controller/test_process.rb +9 -1
- data/vendor/rails/actionpack/lib/action_controller/url_rewriter.rb +1 -1
- data/vendor/rails/actionpack/lib/action_pack/version.rb +1 -1
- data/vendor/rails/actionpack/lib/action_view/helpers.rb +1 -1
- data/vendor/rails/actionpack/lib/action_view/helpers/asset_tag_helper.rb +21 -9
- data/vendor/rails/actionpack/lib/action_view/helpers/atom_feed_helper.rb +1 -1
- data/vendor/rails/actionpack/lib/action_view/helpers/date_helper.rb +2 -2
- data/vendor/rails/actionpack/lib/action_view/helpers/form_helper.rb +26 -12
- data/vendor/rails/actionpack/lib/action_view/helpers/form_options_helper.rb +71 -1
- data/vendor/rails/actionpack/lib/action_view/helpers/form_tag_helper.rb +10 -4
- data/vendor/rails/actionpack/lib/action_view/helpers/number_helper.rb +1 -1
- data/vendor/rails/actionpack/lib/action_view/helpers/prototype_helper.rb +7 -7
- data/vendor/rails/actionpack/lib/action_view/helpers/scriptaculous_helper.rb +5 -5
- data/vendor/rails/actionpack/lib/action_view/helpers/tag_helper.rb +1 -1
- data/vendor/rails/actionpack/lib/action_view/helpers/text_helper.rb +23 -14
- data/vendor/rails/actionpack/lib/action_view/helpers/url_helper.rb +2 -2
- data/vendor/rails/actionpack/lib/action_view/locale/en.yml +4 -0
- data/vendor/rails/actionpack/lib/action_view/paths.rb +1 -1
- data/vendor/rails/actionpack/lib/action_view/template.rb +22 -33
- data/vendor/rails/actionpack/test/abstract_unit.rb +17 -1
- data/vendor/rails/actionpack/test/activerecord/active_record_store_test.rb +3 -3
- data/vendor/rails/actionpack/test/controller/action_pack_assertions_test.rb +27 -0
- data/vendor/rails/actionpack/test/controller/caching_test.rb +40 -1
- data/vendor/rails/actionpack/test/controller/cookie_test.rb +16 -0
- data/vendor/rails/actionpack/test/controller/dispatcher_test.rb +59 -18
- data/vendor/rails/actionpack/test/controller/failsafe_test.rb +60 -0
- data/vendor/rails/actionpack/test/controller/filter_params_test.rb +3 -1
- data/vendor/rails/actionpack/test/controller/flash_test.rb +6 -1
- data/vendor/rails/actionpack/test/controller/http_basic_authentication_test.rb +25 -0
- data/vendor/rails/actionpack/test/controller/http_digest_authentication_test.rb +63 -9
- data/vendor/rails/actionpack/test/controller/integration_test.rb +31 -3
- data/vendor/rails/actionpack/test/controller/rack_test.rb +18 -1
- data/vendor/rails/actionpack/test/controller/redirect_test.rb +4 -1
- data/vendor/rails/actionpack/test/controller/reloader_test.rb +124 -0
- data/vendor/rails/actionpack/test/controller/render_test.rb +19 -9
- data/vendor/rails/actionpack/test/controller/request/json_params_parsing_test.rb +24 -4
- data/vendor/rails/actionpack/test/controller/request/multipart_params_parsing_test.rb +1 -62
- data/vendor/rails/actionpack/test/controller/request/test_request_test.rb +35 -0
- data/vendor/rails/actionpack/test/controller/request/url_encoded_params_parsing_test.rb +0 -38
- data/vendor/rails/actionpack/test/controller/request/xml_params_parsing_test.rb +15 -0
- data/vendor/rails/actionpack/test/controller/request_forgery_protection_test.rb +6 -5
- data/vendor/rails/actionpack/test/controller/request_test.rb +218 -230
- data/vendor/rails/actionpack/test/controller/resources_test.rb +52 -0
- data/vendor/rails/actionpack/test/controller/routing_test.rb +28 -2
- data/vendor/rails/actionpack/test/controller/send_file_test.rb +12 -2
- data/vendor/rails/actionpack/test/controller/session/cookie_store_test.rb +9 -32
- data/vendor/rails/actionpack/test/controller/test_test.rb +8 -0
- data/vendor/rails/actionpack/test/controller/url_rewriter_test.rb +29 -3
- data/vendor/rails/actionpack/test/fixtures/failsafe/500.html +1 -0
- data/vendor/rails/actionpack/test/fixtures/public/absolute/test.css +23 -0
- data/vendor/rails/actionpack/test/fixtures/public/absolute/test.js +63 -0
- data/vendor/rails/actionpack/test/template/active_record_helper_test.rb +1 -1
- data/vendor/rails/actionpack/test/template/asset_tag_helper_test.rb +46 -0
- data/vendor/rails/actionpack/test/template/atom_feed_helper_test.rb +29 -0
- data/vendor/rails/actionpack/test/template/form_helper_test.rb +143 -6
- data/vendor/rails/actionpack/test/template/form_options_helper_i18n_test.rb +27 -0
- data/vendor/rails/actionpack/test/template/form_options_helper_test.rb +56 -0
- data/vendor/rails/actionpack/test/template/form_tag_helper_test.rb +23 -6
- data/vendor/rails/actionpack/test/template/prototype_helper_test.rb +11 -11
- data/vendor/rails/actionpack/test/template/template_test.rb +32 -0
- data/vendor/rails/actionpack/test/template/text_helper_test.rb +23 -0
- data/vendor/rails/actionpack/test/template/url_helper_test.rb +8 -0
- data/vendor/rails/activerecord/CHANGELOG +18 -0
- data/vendor/rails/activerecord/Rakefile +26 -9
- data/vendor/rails/activerecord/examples/performance.rb +162 -0
- data/vendor/rails/activerecord/lib/active_record/associations.rb +104 -35
- data/vendor/rails/activerecord/lib/active_record/associations/association_collection.rb +10 -5
- data/vendor/rails/activerecord/lib/active_record/associations/association_proxy.rb +2 -2
- data/vendor/rails/activerecord/lib/active_record/associations/belongs_to_association.rb +22 -4
- data/vendor/rails/activerecord/lib/active_record/associations/belongs_to_polymorphic_association.rb +5 -1
- data/vendor/rails/activerecord/lib/active_record/associations/has_and_belongs_to_many_association.rb +16 -0
- data/vendor/rails/activerecord/lib/active_record/associations/has_many_association.rb +1 -0
- data/vendor/rails/activerecord/lib/active_record/associations/has_many_through_association.rb +13 -3
- data/vendor/rails/activerecord/lib/active_record/associations/has_one_through_association.rb +15 -9
- data/vendor/rails/activerecord/lib/active_record/autosave_association.rb +15 -9
- data/vendor/rails/activerecord/lib/active_record/base.rb +34 -31
- data/vendor/rails/activerecord/lib/active_record/batches.rb +23 -15
- data/vendor/rails/activerecord/lib/active_record/calculations.rb +7 -13
- data/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb +16 -2
- data/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb +2 -2
- data/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb +7 -0
- data/vendor/rails/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb +17 -8
- data/vendor/rails/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb +98 -35
- data/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb +15 -0
- data/vendor/rails/activerecord/lib/active_record/dirty.rb +1 -1
- data/vendor/rails/activerecord/lib/active_record/fixtures.rb +14 -11
- data/vendor/rails/activerecord/lib/active_record/i18n_interpolation_deprecation.rb +1 -1
- data/vendor/rails/activerecord/lib/active_record/locale/en.yml +4 -0
- data/vendor/rails/activerecord/lib/active_record/named_scope.rb +3 -8
- data/vendor/rails/activerecord/lib/active_record/reflection.rb +1 -1
- data/vendor/rails/activerecord/lib/active_record/schema_dumper.rb +6 -3
- data/vendor/rails/activerecord/lib/active_record/serialization.rb +3 -2
- data/vendor/rails/activerecord/lib/active_record/serializers/json_serializer.rb +10 -18
- data/vendor/rails/activerecord/lib/active_record/serializers/xml_serializer.rb +6 -2
- data/vendor/rails/activerecord/lib/active_record/session_store.rb +9 -1
- data/vendor/rails/activerecord/lib/active_record/timestamp.rb +39 -9
- data/vendor/rails/activerecord/lib/active_record/validations.rb +149 -80
- data/vendor/rails/activerecord/lib/active_record/version.rb +1 -1
- data/vendor/rails/activerecord/test/cases/adapter_test.rb +12 -0
- data/vendor/rails/activerecord/test/cases/associations/belongs_to_associations_test.rb +102 -22
- data/vendor/rails/activerecord/test/cases/associations/eager_load_nested_include_test.rb +5 -5
- data/vendor/rails/activerecord/test/cases/associations/eager_test.rb +12 -0
- data/vendor/rails/activerecord/test/cases/associations/habtm_join_table_test.rb +56 -0
- data/vendor/rails/activerecord/test/cases/associations/has_many_associations_test.rb +62 -2
- data/vendor/rails/activerecord/test/cases/associations/has_many_through_associations_test.rb +46 -1
- data/vendor/rails/activerecord/test/cases/associations/has_one_through_associations_test.rb +18 -1
- data/vendor/rails/activerecord/test/cases/associations/inner_join_association_test.rb +5 -0
- data/vendor/rails/activerecord/test/cases/associations/join_model_test.rb +4 -4
- data/vendor/rails/activerecord/test/cases/autosave_association_test.rb +22 -0
- data/vendor/rails/activerecord/test/cases/base_test.rb +51 -6
- data/vendor/rails/activerecord/test/cases/calculations_test.rb +14 -14
- data/vendor/rails/activerecord/test/cases/column_definition_test.rb +34 -0
- data/vendor/rails/activerecord/test/cases/copy_table_test_sqlite.rb +5 -5
- data/vendor/rails/activerecord/test/cases/dirty_test.rb +10 -0
- data/vendor/rails/activerecord/test/cases/finder_test.rb +21 -50
- data/vendor/rails/activerecord/test/cases/fixtures_test.rb +6 -1
- data/vendor/rails/activerecord/test/cases/helper.rb +1 -2
- data/vendor/rails/activerecord/test/cases/i18n_test.rb +5 -0
- data/vendor/rails/activerecord/test/cases/json_serialization_test.rb +57 -57
- data/vendor/rails/activerecord/test/cases/method_scoping_test.rb +14 -4
- data/vendor/rails/activerecord/test/cases/migration_test.rb +39 -11
- data/vendor/rails/activerecord/test/cases/modules_test.rb +42 -0
- data/vendor/rails/activerecord/test/cases/named_scope_test.rb +6 -4
- data/vendor/rails/activerecord/test/cases/pk_test.rb +18 -0
- data/vendor/rails/activerecord/test/cases/reflection_test.rb +7 -7
- data/vendor/rails/activerecord/test/cases/schema_dumper_test.rb +35 -7
- data/vendor/rails/activerecord/test/cases/schema_test_postgresql.rb +76 -0
- data/vendor/rails/activerecord/test/cases/timestamp_test.rb +75 -0
- data/vendor/rails/activerecord/test/cases/validations_i18n_test.rb +656 -624
- data/vendor/rails/activerecord/test/cases/validations_test.rb +12 -2
- data/vendor/rails/activerecord/test/cases/xml_serialization_test.rb +20 -0
- data/vendor/rails/activerecord/test/fixtures/fixture_database.sqlite +0 -0
- data/vendor/rails/activerecord/test/fixtures/fixture_database.sqlite3 +0 -0
- data/vendor/rails/activerecord/test/fixtures/fixture_database_2.sqlite +0 -0
- data/vendor/rails/activerecord/test/fixtures/fixture_database_2.sqlite3 +0 -0
- data/vendor/rails/activerecord/test/fixtures/posts.yml +3 -0
- data/vendor/rails/activerecord/test/models/author.rb +5 -0
- data/vendor/rails/activerecord/test/models/comment.rb +5 -1
- data/vendor/rails/activerecord/test/models/company.rb +9 -7
- data/vendor/rails/activerecord/test/models/company_in_module.rb +1 -1
- data/vendor/rails/activerecord/test/models/contract.rb +5 -0
- data/vendor/rails/activerecord/test/models/developer.rb +10 -0
- data/vendor/rails/activerecord/test/models/essay.rb +3 -0
- data/vendor/rails/activerecord/test/models/organization.rb +2 -0
- data/vendor/rails/activerecord/test/models/pet.rb +1 -1
- data/vendor/rails/activerecord/test/models/project.rb +1 -1
- data/vendor/rails/activerecord/test/models/reply.rb +2 -1
- data/vendor/rails/activerecord/test/models/topic.rb +1 -2
- data/vendor/rails/activerecord/test/models/toy.rb +2 -0
- data/vendor/rails/activerecord/test/schema/postgresql_specific_schema.rb +13 -2
- data/vendor/rails/activerecord/test/schema/schema.rb +19 -0
- data/vendor/rails/activeresource/CHANGELOG +16 -0
- data/vendor/rails/activeresource/Rakefile +3 -2
- data/vendor/rails/activeresource/lib/active_resource/base.rb +89 -9
- data/vendor/rails/activeresource/lib/active_resource/connection.rb +73 -8
- data/vendor/rails/activeresource/lib/active_resource/exceptions.rb +66 -0
- data/vendor/rails/activeresource/lib/active_resource/formats/json_format.rb +2 -2
- data/vendor/rails/activeresource/lib/active_resource/validations.rb +20 -4
- data/vendor/rails/activeresource/lib/active_resource/version.rb +1 -1
- data/vendor/rails/activeresource/test/abstract_unit.rb +1 -3
- data/vendor/rails/activeresource/test/base/load_test.rb +16 -1
- data/vendor/rails/activeresource/test/base_errors_test.rb +56 -19
- data/vendor/rails/activeresource/test/base_test.rb +147 -0
- data/vendor/rails/activeresource/test/connection_test.rb +42 -0
- data/vendor/rails/activeresource/test/debug.log +7974 -0
- data/vendor/rails/activeresource/test/fixtures/proxy.rb +4 -0
- data/vendor/rails/activesupport/CHANGELOG +13 -0
- data/vendor/rails/activesupport/lib/active_support/all.rb +8 -0
- data/vendor/rails/activesupport/lib/active_support/cache.rb +14 -1
- data/vendor/rails/activesupport/lib/active_support/cache/mem_cache_store.rb +16 -10
- data/vendor/rails/activesupport/lib/active_support/cache/strategy/local_cache.rb +1 -1
- data/vendor/rails/activesupport/lib/active_support/core_ext/array/conversions.rb +1 -0
- data/vendor/rails/activesupport/lib/active_support/core_ext/date/calculations.rb +2 -1
- data/vendor/rails/activesupport/lib/active_support/core_ext/enumerable.rb +2 -4
- data/vendor/rails/activesupport/lib/active_support/core_ext/hash/conversions.rb +14 -4
- data/vendor/rails/activesupport/lib/active_support/core_ext/kernel/debugger.rb +4 -2
- data/vendor/rails/activesupport/lib/active_support/core_ext/module/attribute_accessors.rb +2 -0
- data/vendor/rails/activesupport/lib/active_support/core_ext/module/delegation.rb +19 -5
- data/vendor/rails/activesupport/lib/active_support/core_ext/module/model_naming.rb +8 -6
- data/vendor/rails/activesupport/lib/active_support/core_ext/numeric/bytes.rb +15 -9
- data/vendor/rails/activesupport/lib/active_support/core_ext/string.rb +1 -0
- data/vendor/rails/activesupport/lib/active_support/core_ext/string/access.rb +29 -5
- data/vendor/rails/activesupport/lib/active_support/core_ext/string/bytesize.rb +5 -0
- data/vendor/rails/activesupport/lib/active_support/core_ext/time/calculations.rb +7 -7
- data/vendor/rails/activesupport/lib/active_support/deprecation.rb +9 -9
- data/vendor/rails/activesupport/lib/active_support/duration.rb +4 -2
- data/vendor/rails/activesupport/lib/active_support/json.rb +1 -22
- data/vendor/rails/activesupport/lib/active_support/json/backends/jsongem.rb +38 -0
- data/vendor/rails/activesupport/lib/active_support/json/backends/yaml.rb +88 -0
- data/vendor/rails/activesupport/lib/active_support/json/decoding.rb +23 -72
- data/vendor/rails/activesupport/lib/active_support/json/encoders/date.rb +9 -8
- data/vendor/rails/activesupport/lib/active_support/json/encoders/date_time.rb +9 -8
- data/vendor/rails/activesupport/lib/active_support/json/encoders/enumerable.rb +14 -9
- data/vendor/rails/activesupport/lib/active_support/json/encoders/false_class.rb +4 -2
- data/vendor/rails/activesupport/lib/active_support/json/encoders/hash.rb +21 -11
- data/vendor/rails/activesupport/lib/active_support/json/encoders/nil_class.rb +4 -2
- data/vendor/rails/activesupport/lib/active_support/json/encoders/numeric.rb +16 -0
- data/vendor/rails/activesupport/lib/active_support/json/encoders/object.rb +6 -2
- data/vendor/rails/activesupport/lib/active_support/json/encoders/regexp.rb +4 -0
- data/vendor/rails/activesupport/lib/active_support/json/encoders/string.rb +5 -32
- data/vendor/rails/activesupport/lib/active_support/json/encoders/symbol.rb +2 -2
- data/vendor/rails/activesupport/lib/active_support/json/encoders/time.rb +9 -8
- data/vendor/rails/activesupport/lib/active_support/json/encoders/true_class.rb +4 -2
- data/vendor/rails/activesupport/lib/active_support/json/encoding.rb +80 -9
- data/vendor/rails/activesupport/lib/active_support/memoizable.rb +1 -1
- data/vendor/rails/activesupport/lib/active_support/message_verifier.rb +16 -3
- data/vendor/rails/activesupport/lib/active_support/multibyte.rb +30 -6
- data/vendor/rails/activesupport/lib/active_support/multibyte/chars.rb +23 -17
- data/vendor/rails/activesupport/lib/active_support/multibyte/utils.rb +61 -0
- data/vendor/rails/activesupport/lib/active_support/ordered_hash.rb +28 -0
- data/vendor/rails/activesupport/lib/active_support/test_case.rb +9 -8
- data/vendor/rails/activesupport/lib/active_support/testing/deprecation.rb +2 -0
- data/vendor/rails/activesupport/lib/active_support/time_with_zone.rb +9 -8
- data/vendor/rails/activesupport/lib/active_support/vendor.rb +6 -7
- data/vendor/rails/activesupport/lib/active_support/vendor/i18n-0.1.3/test/i18n_exceptions_test.rb +0 -1
- data/vendor/rails/activesupport/lib/active_support/vendor/i18n-0.1.3/test/i18n_test.rb +0 -1
- data/vendor/rails/activesupport/lib/active_support/vendor/i18n-0.1.3/test/simple_backend_test.rb +0 -1
- data/vendor/rails/activesupport/lib/active_support/vendor/{memcache-client-1.6.5 → memcache-client-1.7.4}/memcache.rb +242 -70
- data/vendor/rails/activesupport/lib/active_support/version.rb +1 -1
- data/vendor/rails/activesupport/lib/active_support/xml_mini/jdom.rb +162 -0
- data/vendor/rails/railties/CHANGELOG +10 -0
- data/vendor/rails/railties/Rakefile +13 -9
- data/vendor/rails/railties/bin/about +2 -2
- data/vendor/rails/railties/bin/console +1 -1
- data/vendor/rails/railties/bin/dbconsole +1 -1
- data/vendor/rails/railties/bin/destroy +1 -1
- data/vendor/rails/railties/bin/generate +1 -1
- data/vendor/rails/railties/bin/performance/benchmarker +1 -1
- data/vendor/rails/railties/bin/performance/profiler +1 -1
- data/vendor/rails/railties/bin/plugin +1 -1
- 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 +4 -2
- data/vendor/rails/railties/configs/initializers/new_rails_defaults.rb +2 -0
- data/vendor/rails/railties/configs/routes.rb +1 -1
- data/vendor/rails/railties/configs/seeds.rb +7 -0
- data/vendor/rails/railties/environments/boot.rb +1 -1
- data/vendor/rails/railties/guides/files/javascripts/code_highlighter.js +188 -0
- data/vendor/rails/railties/guides/files/javascripts/guides.js +8 -0
- data/vendor/rails/railties/guides/files/javascripts/highlighters.js +90 -0
- data/vendor/rails/railties/guides/files/stylesheets/main.css +441 -0
- data/vendor/rails/railties/guides/files/stylesheets/print.css +52 -0
- data/vendor/rails/railties/guides/files/stylesheets/reset.css +43 -0
- data/vendor/rails/railties/guides/files/stylesheets/style.css +13 -0
- data/vendor/rails/railties/guides/files/stylesheets/syntax.css +31 -0
- data/vendor/rails/railties/guides/images/belongs_to.png +0 -0
- data/vendor/rails/railties/guides/images/book_icon.gif +0 -0
- data/vendor/rails/railties/guides/images/bullet.gif +0 -0
- data/vendor/rails/railties/guides/images/chapters_icon.gif +0 -0
- data/vendor/rails/railties/guides/images/check_bullet.gif +0 -0
- data/vendor/rails/railties/guides/images/credits_pic_blank.gif +0 -0
- data/vendor/rails/railties/guides/images/csrf.png +0 -0
- data/vendor/rails/railties/guides/images/customized_error_messages.png +0 -0
- data/vendor/rails/railties/guides/images/error_messages.png +0 -0
- data/vendor/rails/railties/guides/images/feature_tile.gif +0 -0
- data/vendor/rails/railties/guides/images/footer_tile.gif +0 -0
- data/vendor/rails/railties/guides/images/fxn.jpg +0 -0
- data/vendor/rails/railties/guides/images/grey_bullet.gif +0 -0
- data/vendor/rails/railties/guides/images/habtm.png +0 -0
- data/vendor/rails/railties/guides/images/has_many.png +0 -0
- data/vendor/rails/railties/guides/images/has_many_through.png +0 -0
- data/vendor/rails/railties/guides/images/has_one.png +0 -0
- data/vendor/rails/railties/guides/images/has_one_through.png +0 -0
- data/vendor/rails/railties/guides/images/header_backdrop.png +0 -0
- data/vendor/rails/railties/guides/images/header_tile.gif +0 -0
- data/vendor/rails/railties/guides/images/i18n/demo_localized_pirate.png +0 -0
- data/vendor/rails/railties/guides/images/i18n/demo_translated_en.png +0 -0
- data/vendor/rails/railties/guides/images/i18n/demo_translated_pirate.png +0 -0
- data/vendor/rails/railties/guides/images/i18n/demo_translation_missing.png +0 -0
- data/vendor/rails/railties/guides/images/i18n/demo_untranslated.png +0 -0
- data/vendor/rails/railties/guides/images/icons/README +5 -0
- data/vendor/rails/railties/guides/images/icons/callouts/1.png +0 -0
- data/vendor/rails/railties/guides/images/icons/callouts/10.png +0 -0
- data/vendor/rails/railties/guides/images/icons/callouts/11.png +0 -0
- data/vendor/rails/railties/guides/images/icons/callouts/12.png +0 -0
- data/vendor/rails/railties/guides/images/icons/callouts/13.png +0 -0
- data/vendor/rails/railties/guides/images/icons/callouts/14.png +0 -0
- data/vendor/rails/railties/guides/images/icons/callouts/15.png +0 -0
- data/vendor/rails/railties/guides/images/icons/callouts/2.png +0 -0
- data/vendor/rails/railties/guides/images/icons/callouts/3.png +0 -0
- data/vendor/rails/railties/guides/images/icons/callouts/4.png +0 -0
- data/vendor/rails/railties/guides/images/icons/callouts/5.png +0 -0
- data/vendor/rails/railties/guides/images/icons/callouts/6.png +0 -0
- data/vendor/rails/railties/guides/images/icons/callouts/7.png +0 -0
- data/vendor/rails/railties/guides/images/icons/callouts/8.png +0 -0
- data/vendor/rails/railties/guides/images/icons/callouts/9.png +0 -0
- data/vendor/rails/railties/guides/images/icons/caution.png +0 -0
- data/vendor/rails/railties/guides/images/icons/example.png +0 -0
- data/vendor/rails/railties/guides/images/icons/home.png +0 -0
- data/vendor/rails/railties/guides/images/icons/important.png +0 -0
- data/vendor/rails/railties/guides/images/icons/next.png +0 -0
- data/vendor/rails/railties/guides/images/icons/note.png +0 -0
- data/vendor/rails/railties/guides/images/icons/prev.png +0 -0
- data/vendor/rails/railties/guides/images/icons/tip.png +0 -0
- data/vendor/rails/railties/guides/images/icons/up.png +0 -0
- data/vendor/rails/railties/guides/images/icons/warning.png +0 -0
- data/vendor/rails/railties/guides/images/nav_arrow.gif +0 -0
- data/vendor/rails/railties/guides/images/polymorphic.png +0 -0
- data/vendor/rails/railties/guides/images/posts_index.png +0 -0
- data/vendor/rails/railties/guides/images/rails_guides_logo.gif +0 -0
- data/vendor/rails/railties/guides/images/rails_logo_remix.gif +0 -0
- data/vendor/rails/railties/guides/images/rails_welcome.png +0 -0
- data/vendor/rails/railties/guides/images/session_fixation.png +0 -0
- data/vendor/rails/railties/guides/images/tab_grey.gif +0 -0
- data/vendor/rails/railties/guides/images/tab_info.gif +0 -0
- data/vendor/rails/railties/guides/images/tab_note.gif +0 -0
- data/vendor/rails/railties/guides/images/tab_red.gif +0 -0
- data/vendor/rails/railties/guides/images/tab_yellow.gif +0 -0
- data/vendor/rails/railties/guides/images/tab_yellow.png +0 -0
- data/vendor/rails/railties/guides/images/validation_error_messages.png +0 -0
- data/vendor/rails/railties/guides/rails_guides.rb +42 -0
- data/vendor/rails/railties/guides/rails_guides/generator.rb +138 -0
- data/vendor/rails/railties/guides/rails_guides/helpers.rb +34 -0
- data/vendor/rails/railties/guides/rails_guides/indexer.rb +55 -0
- data/vendor/rails/railties/guides/rails_guides/textile_extensions.rb +41 -0
- data/vendor/rails/railties/guides/source/2_2_release_notes.textile +422 -0
- data/vendor/rails/railties/guides/source/2_3_release_notes.textile +610 -0
- data/vendor/rails/railties/guides/source/action_controller_overview.textile +776 -0
- data/vendor/rails/railties/guides/source/action_mailer_basics.textile +424 -0
- data/vendor/rails/railties/guides/source/active_record_basics.textile +135 -0
- data/vendor/rails/railties/guides/source/active_record_querying.textile +969 -0
- data/vendor/rails/railties/guides/source/activerecord_validations_callbacks.textile +1086 -0
- data/vendor/rails/railties/guides/source/association_basics.textile +1781 -0
- data/vendor/rails/railties/guides/source/caching_with_rails.textile +524 -0
- data/vendor/rails/railties/guides/source/command_line.textile +589 -0
- data/vendor/rails/railties/guides/source/configuring.textile +234 -0
- data/vendor/rails/railties/guides/source/contribute.textile +71 -0
- data/vendor/rails/railties/guides/source/contributing_to_rails.textile +239 -0
- data/vendor/rails/railties/guides/source/credits.erb.textile +52 -0
- data/vendor/rails/railties/guides/source/debugging_rails_applications.textile +709 -0
- data/vendor/rails/railties/guides/source/form_helpers.textile +766 -0
- data/vendor/rails/railties/guides/source/getting_started.textile +1297 -0
- data/vendor/rails/railties/guides/source/i18n.textile +912 -0
- data/vendor/rails/railties/guides/source/index.erb.textile +124 -0
- data/vendor/rails/railties/guides/source/layout.html.erb +103 -0
- data/vendor/rails/railties/guides/source/layouts_and_rendering.textile +979 -0
- data/vendor/rails/railties/guides/source/migrations.textile +591 -0
- data/vendor/rails/railties/guides/source/nested_model_forms.textile +222 -0
- data/vendor/rails/railties/guides/source/performance_testing.textile +531 -0
- data/vendor/rails/railties/guides/source/plugins.textile +1512 -0
- data/vendor/rails/railties/guides/source/rails_on_rack.textile +309 -0
- data/vendor/rails/railties/guides/source/routing.textile +903 -0
- data/vendor/rails/railties/guides/source/security.textile +986 -0
- data/vendor/rails/railties/guides/source/testing.textile +951 -0
- data/vendor/rails/railties/lib/commands/dbconsole.rb +8 -4
- data/vendor/rails/railties/lib/commands/performance/profiler.rb +1 -1
- data/vendor/rails/railties/lib/initializer.rb +27 -4
- data/vendor/rails/railties/lib/rails/gem_dependency.rb +35 -6
- data/vendor/rails/railties/lib/rails/plugin.rb +12 -0
- data/vendor/rails/railties/lib/rails/plugin/loader.rb +7 -0
- data/vendor/rails/railties/lib/rails/rack/metal.rb +1 -1
- data/vendor/rails/railties/lib/rails/version.rb +1 -1
- data/vendor/rails/railties/lib/rails_generator/base.rb +1 -1
- data/vendor/rails/railties/lib/rails_generator/generators/applications/app/app_generator.rb +5 -0
- data/vendor/rails/railties/lib/rails_generator/generators/applications/app/template_runner.rb +1 -1
- data/vendor/rails/railties/lib/rails_generator/generators/components/model/model_generator.rb +9 -2
- data/vendor/rails/railties/lib/rails_generator/generators/components/scaffold/scaffold_generator.rb +1 -0
- data/vendor/rails/railties/lib/tasks/databases.rake +17 -4
- data/vendor/rails/railties/lib/tasks/gems.rake +19 -6
- data/vendor/rails/railties/lib/tasks/routes.rake +4 -3
- data/vendor/rails/railties/lib/test_help.rb +4 -1
- metadata +158 -58
- data/spec/lib/local_time_spec.rb +0 -40
- data/vendor/rails/actionpack/lib/action_controller/rewindable_input.rb +0 -28
- data/vendor/rails/actionpack/lib/action_controller/vendor/rack-1.0/rack.rb +0 -89
- data/vendor/rails/actionpack/lib/action_controller/vendor/rack-1.0/rack/adapter/camping.rb +0 -22
- data/vendor/rails/actionpack/lib/action_controller/vendor/rack-1.0/rack/auth/abstract/handler.rb +0 -37
- data/vendor/rails/actionpack/lib/action_controller/vendor/rack-1.0/rack/auth/abstract/request.rb +0 -37
- data/vendor/rails/actionpack/lib/action_controller/vendor/rack-1.0/rack/auth/basic.rb +0 -58
- data/vendor/rails/actionpack/lib/action_controller/vendor/rack-1.0/rack/auth/digest/md5.rb +0 -124
- data/vendor/rails/actionpack/lib/action_controller/vendor/rack-1.0/rack/auth/digest/nonce.rb +0 -51
- data/vendor/rails/actionpack/lib/action_controller/vendor/rack-1.0/rack/auth/digest/params.rb +0 -55
- data/vendor/rails/actionpack/lib/action_controller/vendor/rack-1.0/rack/auth/digest/request.rb +0 -40
- data/vendor/rails/actionpack/lib/action_controller/vendor/rack-1.0/rack/auth/openid.rb +0 -480
- data/vendor/rails/actionpack/lib/action_controller/vendor/rack-1.0/rack/builder.rb +0 -63
- data/vendor/rails/actionpack/lib/action_controller/vendor/rack-1.0/rack/cascade.rb +0 -36
- data/vendor/rails/actionpack/lib/action_controller/vendor/rack-1.0/rack/chunked.rb +0 -49
- data/vendor/rails/actionpack/lib/action_controller/vendor/rack-1.0/rack/commonlogger.rb +0 -61
- data/vendor/rails/actionpack/lib/action_controller/vendor/rack-1.0/rack/conditionalget.rb +0 -45
- data/vendor/rails/actionpack/lib/action_controller/vendor/rack-1.0/rack/content_length.rb +0 -29
- data/vendor/rails/actionpack/lib/action_controller/vendor/rack-1.0/rack/content_type.rb +0 -23
- data/vendor/rails/actionpack/lib/action_controller/vendor/rack-1.0/rack/deflater.rb +0 -85
- data/vendor/rails/actionpack/lib/action_controller/vendor/rack-1.0/rack/directory.rb +0 -153
- data/vendor/rails/actionpack/lib/action_controller/vendor/rack-1.0/rack/file.rb +0 -88
- data/vendor/rails/actionpack/lib/action_controller/vendor/rack-1.0/rack/handler.rb +0 -48
- data/vendor/rails/actionpack/lib/action_controller/vendor/rack-1.0/rack/handler/cgi.rb +0 -61
- data/vendor/rails/actionpack/lib/action_controller/vendor/rack-1.0/rack/handler/evented_mongrel.rb +0 -8
- data/vendor/rails/actionpack/lib/action_controller/vendor/rack-1.0/rack/handler/fastcgi.rb +0 -89
- data/vendor/rails/actionpack/lib/action_controller/vendor/rack-1.0/rack/handler/lsws.rb +0 -55
- data/vendor/rails/actionpack/lib/action_controller/vendor/rack-1.0/rack/handler/mongrel.rb +0 -84
- data/vendor/rails/actionpack/lib/action_controller/vendor/rack-1.0/rack/handler/scgi.rb +0 -59
- data/vendor/rails/actionpack/lib/action_controller/vendor/rack-1.0/rack/handler/swiftiplied_mongrel.rb +0 -8
- data/vendor/rails/actionpack/lib/action_controller/vendor/rack-1.0/rack/handler/thin.rb +0 -18
- data/vendor/rails/actionpack/lib/action_controller/vendor/rack-1.0/rack/handler/webrick.rb +0 -67
- data/vendor/rails/actionpack/lib/action_controller/vendor/rack-1.0/rack/head.rb +0 -19
- data/vendor/rails/actionpack/lib/action_controller/vendor/rack-1.0/rack/lint.rb +0 -462
- data/vendor/rails/actionpack/lib/action_controller/vendor/rack-1.0/rack/lobster.rb +0 -65
- data/vendor/rails/actionpack/lib/action_controller/vendor/rack-1.0/rack/lock.rb +0 -16
- data/vendor/rails/actionpack/lib/action_controller/vendor/rack-1.0/rack/methodoverride.rb +0 -27
- data/vendor/rails/actionpack/lib/action_controller/vendor/rack-1.0/rack/mime.rb +0 -204
- data/vendor/rails/actionpack/lib/action_controller/vendor/rack-1.0/rack/mock.rb +0 -160
- data/vendor/rails/actionpack/lib/action_controller/vendor/rack-1.0/rack/recursive.rb +0 -57
- data/vendor/rails/actionpack/lib/action_controller/vendor/rack-1.0/rack/reloader.rb +0 -64
- data/vendor/rails/actionpack/lib/action_controller/vendor/rack-1.0/rack/request.rb +0 -241
- data/vendor/rails/actionpack/lib/action_controller/vendor/rack-1.0/rack/response.rb +0 -179
- data/vendor/rails/actionpack/lib/action_controller/vendor/rack-1.0/rack/session/abstract/id.rb +0 -142
- data/vendor/rails/actionpack/lib/action_controller/vendor/rack-1.0/rack/session/cookie.rb +0 -91
- data/vendor/rails/actionpack/lib/action_controller/vendor/rack-1.0/rack/session/memcache.rb +0 -109
- data/vendor/rails/actionpack/lib/action_controller/vendor/rack-1.0/rack/session/pool.rb +0 -100
- data/vendor/rails/actionpack/lib/action_controller/vendor/rack-1.0/rack/showexceptions.rb +0 -349
- data/vendor/rails/actionpack/lib/action_controller/vendor/rack-1.0/rack/showstatus.rb +0 -106
- data/vendor/rails/actionpack/lib/action_controller/vendor/rack-1.0/rack/static.rb +0 -38
- data/vendor/rails/actionpack/lib/action_controller/vendor/rack-1.0/rack/urlmap.rb +0 -55
- data/vendor/rails/actionpack/lib/action_controller/vendor/rack-1.0/rack/utils.rb +0 -392
@@ -345,13 +345,13 @@ class ValidationsTest < ActiveRecord::TestCase
|
|
345
345
|
def test_validate_uniqueness
|
346
346
|
Topic.validates_uniqueness_of(:title)
|
347
347
|
|
348
|
-
t = Topic.new("title" => "I'm
|
348
|
+
t = Topic.new("title" => "I'm uniqué!")
|
349
349
|
assert t.save, "Should save t as unique"
|
350
350
|
|
351
351
|
t.content = "Remaining unique"
|
352
352
|
assert t.save, "Should still save t as unique"
|
353
353
|
|
354
|
-
t2 = Topic.new("title" => "I'm
|
354
|
+
t2 = Topic.new("title" => "I'm uniqué!")
|
355
355
|
assert !t2.valid?, "Shouldn't be valid"
|
356
356
|
assert !t2.save, "Shouldn't save t2 as unique"
|
357
357
|
assert_equal "has already been taken", t2.errors.on(:title)
|
@@ -539,6 +539,16 @@ class ValidationsTest < ActiveRecord::TestCase
|
|
539
539
|
assert !e2.valid?, "Created an event whose title, with limit taken into account, is not unique"
|
540
540
|
end
|
541
541
|
|
542
|
+
def test_validate_uniqueness_with_limit_and_utf8
|
543
|
+
with_kcode('UTF8') do
|
544
|
+
# Event.title is limited to 5 characters
|
545
|
+
e1 = Event.create(:title => "一二三四五")
|
546
|
+
assert e1.valid?, "Could not create an event with a unique, 5 character title"
|
547
|
+
e2 = Event.create(:title => "一二三四五六七八")
|
548
|
+
assert !e2.valid?, "Created an event whose title, with limit taken into account, is not unique"
|
549
|
+
end
|
550
|
+
end
|
551
|
+
|
542
552
|
def test_validate_straight_inheritance_uniqueness
|
543
553
|
w1 = IneptWizard.create(:name => "Rincewind", :city => "Ankh-Morpork")
|
544
554
|
assert w1.valid?, "Saving w1"
|
@@ -4,6 +4,7 @@ require 'models/post'
|
|
4
4
|
require 'models/author'
|
5
5
|
require 'models/tagging'
|
6
6
|
require 'models/comment'
|
7
|
+
require 'models/company_in_module'
|
7
8
|
|
8
9
|
class XmlSerializationTest < ActiveRecord::TestCase
|
9
10
|
def test_should_serialize_default_root
|
@@ -129,6 +130,25 @@ class NilXmlSerializationTest < ActiveRecord::TestCase
|
|
129
130
|
end
|
130
131
|
end
|
131
132
|
|
133
|
+
class DatabaseConnectedXmlModuleSerializationTest < ActiveRecord::TestCase
|
134
|
+
|
135
|
+
fixtures :projects, :developers, :developers_projects
|
136
|
+
|
137
|
+
def test_module
|
138
|
+
project = MyApplication::Business::Project.find :first
|
139
|
+
xml = project.to_xml
|
140
|
+
assert_match %r{<my-application-business-project>}, xml
|
141
|
+
assert_match %r{</my-application-business-project>}, xml
|
142
|
+
end
|
143
|
+
|
144
|
+
def test_module_with_include
|
145
|
+
project = MyApplication::Business::Project.find :first
|
146
|
+
xml = project.to_xml :include => :developers
|
147
|
+
assert_match %r{<developer type="MyApplication::Business::Developer">}, xml
|
148
|
+
assert_match %r{</developer>}, xml
|
149
|
+
end
|
150
|
+
end
|
151
|
+
|
132
152
|
class DatabaseConnectedXmlSerializationTest < ActiveRecord::TestCase
|
133
153
|
fixtures :authors, :posts
|
134
154
|
# to_xml used to mess with the hash the user provided which
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -4,6 +4,7 @@ welcome:
|
|
4
4
|
title: Welcome to the weblog
|
5
5
|
body: Such a lovely day
|
6
6
|
comments_count: 2
|
7
|
+
taggings_count: 1
|
7
8
|
type: Post
|
8
9
|
|
9
10
|
thinking:
|
@@ -11,6 +12,8 @@ thinking:
|
|
11
12
|
author_id: 1
|
12
13
|
title: So I was thinking
|
13
14
|
body: Like I hopefully always am
|
15
|
+
comments_count: 1
|
16
|
+
taggings_count: 1
|
14
17
|
type: SpecialPost
|
15
18
|
|
16
19
|
authorless:
|
@@ -1,5 +1,6 @@
|
|
1
1
|
class Author < ActiveRecord::Base
|
2
2
|
has_many :posts
|
3
|
+
has_many :very_special_comments, :through => :posts
|
3
4
|
has_many :posts_with_comments, :include => :comments, :class_name => "Post"
|
4
5
|
has_many :popular_grouped_posts, :include => :comments, :class_name => "Post", :group => "type", :having => "SUM(comments_count) > 1", :select => "type"
|
5
6
|
has_many :posts_with_comments_sorted_by_comment_id, :include => :comments, :class_name => "Post", :order => 'comments.id'
|
@@ -25,6 +26,8 @@ class Author < ActiveRecord::Base
|
|
25
26
|
has_many :comments_with_order_and_conditions, :through => :posts, :source => :comments, :order => 'comments.body', :conditions => "comments.body like 'Thank%'"
|
26
27
|
has_many :comments_with_include, :through => :posts, :source => :comments, :include => :post
|
27
28
|
|
29
|
+
has_many :thinking_posts, :class_name => 'Post', :conditions => { :title => 'So I was thinking' }, :dependent => :delete_all
|
30
|
+
has_many :welcome_posts, :class_name => 'Post', :conditions => { :title => 'Welcome to the weblog' }
|
28
31
|
|
29
32
|
has_many :comments_desc, :through => :posts, :source => :comments, :order => 'comments.id DESC'
|
30
33
|
has_many :limited_comments, :through => :posts, :source => :comments, :limit => 1
|
@@ -85,6 +88,8 @@ class Author < ActiveRecord::Base
|
|
85
88
|
has_many :tags, :through => :posts # through has_many :through
|
86
89
|
has_many :post_categories, :through => :posts, :source => :categories
|
87
90
|
|
91
|
+
has_one :essay, :primary_key => :name, :as => :writer
|
92
|
+
|
88
93
|
belongs_to :author_address, :dependent => :destroy
|
89
94
|
belongs_to :author_address_extra, :dependent => :delete, :class_name => "AuthorAddress"
|
90
95
|
|
@@ -1,6 +1,10 @@
|
|
1
1
|
class Comment < ActiveRecord::Base
|
2
2
|
named_scope :containing_the_letter_e, :conditions => "comments.body LIKE '%e%'"
|
3
|
-
|
3
|
+
named_scope :for_first_post, :conditions => { :post_id => 1 }
|
4
|
+
named_scope :for_first_author,
|
5
|
+
:joins => :post,
|
6
|
+
:conditions => { "posts.author_id" => 1 }
|
7
|
+
|
4
8
|
belongs_to :post, :counter_cache => true
|
5
9
|
|
6
10
|
def self.what_are_you
|
@@ -9,6 +9,8 @@ class Company < AbstractCompany
|
|
9
9
|
validates_presence_of :name
|
10
10
|
|
11
11
|
has_one :dummy_account, :foreign_key => "firm_id", :class_name => "Account"
|
12
|
+
has_many :contracts
|
13
|
+
has_many :developers, :through => :contracts
|
12
14
|
|
13
15
|
def arbitrary_method
|
14
16
|
"I am Jack's profound disappointment"
|
@@ -78,19 +80,13 @@ class DependentFirm < Company
|
|
78
80
|
has_many :companies, :foreign_key => 'client_of', :order => "id", :dependent => :nullify
|
79
81
|
end
|
80
82
|
|
81
|
-
class ExclusivelyDependentFirm < Company
|
82
|
-
has_one :account, :foreign_key => "firm_id", :dependent => :delete
|
83
|
-
has_many :dependent_sanitized_conditional_clients_of_firm, :foreign_key => "client_of", :class_name => "Client", :order => "id", :dependent => :delete_all, :conditions => "name = 'BigShot Inc.'"
|
84
|
-
has_many :dependent_conditional_clients_of_firm, :foreign_key => "client_of", :class_name => "Client", :order => "id", :dependent => :delete_all, :conditions => ["name = ?", 'BigShot Inc.']
|
85
|
-
has_many :dependent_hash_conditional_clients_of_firm, :foreign_key => "client_of", :class_name => "Client", :order => "id", :dependent => :delete_all, :conditions => {:name => 'BigShot Inc.'}
|
86
|
-
end
|
87
|
-
|
88
83
|
class Client < Company
|
89
84
|
belongs_to :firm, :foreign_key => "client_of"
|
90
85
|
belongs_to :firm_with_basic_id, :class_name => "Firm", :foreign_key => "firm_id"
|
91
86
|
belongs_to :firm_with_select, :class_name => "Firm", :foreign_key => "firm_id", :select => "id"
|
92
87
|
belongs_to :firm_with_other_name, :class_name => "Firm", :foreign_key => "client_of"
|
93
88
|
belongs_to :firm_with_condition, :class_name => "Firm", :foreign_key => "client_of", :conditions => ["1 = ?", 1]
|
89
|
+
belongs_to :firm_with_primary_key, :class_name => "Firm", :primary_key => "name", :foreign_key => "firm_name"
|
94
90
|
belongs_to :readonly_firm, :class_name => "Firm", :foreign_key => "firm_id", :readonly => true
|
95
91
|
|
96
92
|
# Record destruction so we can test whether firm.clients.clear has
|
@@ -125,6 +121,12 @@ class Client < Company
|
|
125
121
|
end
|
126
122
|
end
|
127
123
|
|
124
|
+
class ExclusivelyDependentFirm < Company
|
125
|
+
has_one :account, :foreign_key => "firm_id", :dependent => :delete
|
126
|
+
has_many :dependent_sanitized_conditional_clients_of_firm, :foreign_key => "client_of", :class_name => "Client", :order => "id", :dependent => :delete_all, :conditions => "name = 'BigShot Inc.'"
|
127
|
+
has_many :dependent_conditional_clients_of_firm, :foreign_key => "client_of", :class_name => "Client", :order => "id", :dependent => :delete_all, :conditions => ["name = ?", 'BigShot Inc.']
|
128
|
+
has_many :dependent_hash_conditional_clients_of_firm, :foreign_key => "client_of", :class_name => "Client", :order => "id", :dependent => :delete_all, :conditions => {:name => 'BigShot Inc.'}
|
129
|
+
end
|
128
130
|
|
129
131
|
class SpecialClient < Client
|
130
132
|
end
|
@@ -11,7 +11,7 @@ module MyApplication
|
|
11
11
|
has_many :clients_like_ms, :conditions => "name = 'Microsoft'", :class_name => "Client", :order => "id"
|
12
12
|
has_many :clients_using_sql, :class_name => "Client", :finder_sql => 'SELECT * FROM companies WHERE client_of = #{id}'
|
13
13
|
|
14
|
-
has_one :account, :dependent => :destroy
|
14
|
+
has_one :account, :class_name => 'MyApplication::Billing::Account', :dependent => :destroy
|
15
15
|
end
|
16
16
|
|
17
17
|
class Client < Company
|
@@ -89,3 +89,13 @@ class DeveloperOrderedBySalary < ActiveRecord::Base
|
|
89
89
|
end
|
90
90
|
end
|
91
91
|
end
|
92
|
+
|
93
|
+
class DeveloperCalledDavid < ActiveRecord::Base
|
94
|
+
self.table_name = 'developers'
|
95
|
+
default_scope :conditions => "name = 'David'"
|
96
|
+
end
|
97
|
+
|
98
|
+
class DeveloperCalledJamis < ActiveRecord::Base
|
99
|
+
self.table_name = 'developers'
|
100
|
+
default_scope :conditions => { :name => 'Jamis' }
|
101
|
+
end
|
@@ -13,7 +13,7 @@ class Project < ActiveRecord::Base
|
|
13
13
|
:after_add => Proc.new {|o, r| o.developers_log << "after_adding#{r.id || '<new>'}"},
|
14
14
|
:before_remove => Proc.new {|o, r| o.developers_log << "before_removing#{r.id}"},
|
15
15
|
:after_remove => Proc.new {|o, r| o.developers_log << "after_removing#{r.id}"}
|
16
|
-
has_and_belongs_to_many :well_payed_salary_groups, :class_name => "Developer", :group => "salary", :having => "SUM(salary) > 10000", :select => "SUM(salary) as salary"
|
16
|
+
has_and_belongs_to_many :well_payed_salary_groups, :class_name => "Developer", :group => "developers.salary", :having => "SUM(salary) > 10000", :select => "SUM(salary) as salary"
|
17
17
|
|
18
18
|
attr_accessor :developers_log
|
19
19
|
|
@@ -4,12 +4,13 @@ class Reply < Topic
|
|
4
4
|
named_scope :base
|
5
5
|
|
6
6
|
belongs_to :topic, :foreign_key => "parent_id", :counter_cache => true
|
7
|
+
belongs_to :topic_with_primary_key, :class_name => "Topic", :primary_key => "title", :foreign_key => "parent_title", :counter_cache => "replies_count"
|
7
8
|
has_many :replies, :class_name => "SillyReply", :dependent => :destroy, :foreign_key => "parent_id"
|
8
9
|
|
9
10
|
validate :errors_on_empty_content
|
10
11
|
validate_on_create :title_is_wrong_create
|
11
12
|
|
12
|
-
attr_accessible :title, :author_name, :author_email_address, :written_on, :content, :last_read
|
13
|
+
attr_accessible :title, :author_name, :author_email_address, :written_on, :content, :last_read, :parent_title
|
13
14
|
|
14
15
|
def validate
|
15
16
|
errors.add("title", "Empty") unless attribute_present? "title"
|
@@ -35,10 +35,9 @@ class Topic < ActiveRecord::Base
|
|
35
35
|
end
|
36
36
|
named_scope :named_extension, :extend => NamedExtension
|
37
37
|
named_scope :multiple_extensions, :extend => [MultipleExtensionTwo, MultipleExtensionOne]
|
38
|
-
|
39
|
-
named_scope :by_rejected_ids, lambda {{ :conditions => { :id => all(:conditions => {:approved => false}).map(&:id) } }}
|
40
38
|
|
41
39
|
has_many :replies, :dependent => :destroy, :foreign_key => "parent_id"
|
40
|
+
has_many :replies_with_primary_key, :class_name => "Reply", :dependent => :destroy, :primary_key => "title", :foreign_key => "parent_title"
|
42
41
|
serialize :content
|
43
42
|
|
44
43
|
before_create :default_written_on
|
@@ -1,7 +1,7 @@
|
|
1
1
|
ActiveRecord::Schema.define do
|
2
2
|
|
3
3
|
%w(postgresql_arrays postgresql_moneys postgresql_numbers postgresql_times postgresql_network_addresses postgresql_bit_strings
|
4
|
-
postgresql_oids defaults geometrics).each do |table_name|
|
4
|
+
postgresql_oids postgresql_xml_data_type defaults geometrics).each do |table_name|
|
5
5
|
execute "DROP TABLE IF EXISTS #{quote_table_name table_name}"
|
6
6
|
end
|
7
7
|
|
@@ -100,4 +100,15 @@ _SQL
|
|
100
100
|
obj_id OID
|
101
101
|
);
|
102
102
|
_SQL
|
103
|
-
|
103
|
+
|
104
|
+
begin
|
105
|
+
execute <<_SQL
|
106
|
+
CREATE TABLE postgresql_xml_data_type (
|
107
|
+
id SERIAL PRIMARY KEY,
|
108
|
+
data xml
|
109
|
+
);
|
110
|
+
_SQL
|
111
|
+
rescue #This version of PostgreSQL either has no XML support or is was not compiled with XML support: skipping table
|
112
|
+
end
|
113
|
+
end
|
114
|
+
|
@@ -68,6 +68,10 @@ ActiveRecord::Schema.define do
|
|
68
68
|
t.boolean :value
|
69
69
|
end
|
70
70
|
|
71
|
+
create_table "CamelCase", :force => true do |t|
|
72
|
+
t.string :name
|
73
|
+
end
|
74
|
+
|
71
75
|
create_table :categories, :force => true do |t|
|
72
76
|
t.string :name, :null => false
|
73
77
|
t.string :type
|
@@ -114,11 +118,17 @@ ActiveRecord::Schema.define do
|
|
114
118
|
t.integer :rating, :default => 1
|
115
119
|
end
|
116
120
|
|
121
|
+
add_index :companies, [:firm_id, :type, :rating, :ruby_type], :name => "company_index"
|
122
|
+
|
117
123
|
create_table :computers, :force => true do |t|
|
118
124
|
t.integer :developer, :null => false
|
119
125
|
t.integer :extendedWarranty, :null => false
|
120
126
|
end
|
121
127
|
|
128
|
+
create_table :contracts, :force => true do |t|
|
129
|
+
t.integer :developer_id
|
130
|
+
t.integer :company_id
|
131
|
+
end
|
122
132
|
|
123
133
|
create_table :customers, :force => true do |t|
|
124
134
|
t.string :name
|
@@ -155,6 +165,12 @@ ActiveRecord::Schema.define do
|
|
155
165
|
t.integer :course_id, :null => false
|
156
166
|
end
|
157
167
|
|
168
|
+
create_table :essays, :force => true do |t|
|
169
|
+
t.string :name
|
170
|
+
t.string :writer_id
|
171
|
+
t.string :writer_type
|
172
|
+
end
|
173
|
+
|
158
174
|
create_table :events, :force => true do |t|
|
159
175
|
t.string :title, :limit => 5
|
160
176
|
end
|
@@ -281,6 +297,8 @@ ActiveRecord::Schema.define do
|
|
281
297
|
|
282
298
|
create_table :owners, :primary_key => :owner_id ,:force => true do |t|
|
283
299
|
t.string :name
|
300
|
+
t.column :updated_at, :datetime
|
301
|
+
t.column :happy_at, :datetime
|
284
302
|
end
|
285
303
|
|
286
304
|
|
@@ -410,6 +428,7 @@ ActiveRecord::Schema.define do
|
|
410
428
|
t.boolean :approved, :default => true
|
411
429
|
t.integer :replies_count, :default => 0
|
412
430
|
t.integer :parent_id
|
431
|
+
t.string :parent_title
|
413
432
|
t.string :type
|
414
433
|
end
|
415
434
|
|
@@ -1,3 +1,19 @@
|
|
1
|
+
*2.3.4 (September 4, 2009)*
|
2
|
+
|
3
|
+
* Add support for errors in JSON format. #1956 [Fabien Jakimowicz]
|
4
|
+
|
5
|
+
* Recognizes 410 as Resource Gone. #2316 [Jordan Brough, Jatinder Singh]
|
6
|
+
|
7
|
+
* More thorough SSL support. #2370 [Roy Nicholson]
|
8
|
+
|
9
|
+
* HTTP proxy support. #2133 [Marshall Huss, Sébastien Dabet]
|
10
|
+
|
11
|
+
|
12
|
+
*2.3.3 (July 12, 2009)*
|
13
|
+
|
14
|
+
* No changes, just a version bump.
|
15
|
+
|
16
|
+
|
1
17
|
*2.3.2 [Final] (March 15, 2009)*
|
2
18
|
|
3
19
|
* Nothing new, just included in 2.3.2
|
@@ -4,7 +4,6 @@ require 'rake/testtask'
|
|
4
4
|
require 'rake/rdoctask'
|
5
5
|
require 'rake/packagetask'
|
6
6
|
require 'rake/gempackagetask'
|
7
|
-
require 'rake/contrib/sshpublisher'
|
8
7
|
|
9
8
|
require File.join(File.dirname(__FILE__), 'lib', 'active_resource', 'version')
|
10
9
|
|
@@ -67,7 +66,7 @@ spec = Gem::Specification.new do |s|
|
|
67
66
|
s.files = s.files + Dir.glob( "#{dir}/**/*" ).delete_if { |item| item.include?( "\.svn" ) }
|
68
67
|
end
|
69
68
|
|
70
|
-
s.add_dependency('activesupport', '= 2.3.
|
69
|
+
s.add_dependency('activesupport', '= 2.3.4' + PKG_BUILD)
|
71
70
|
|
72
71
|
s.require_path = 'lib'
|
73
72
|
s.autorequire = 'active_resource'
|
@@ -117,12 +116,14 @@ end
|
|
117
116
|
|
118
117
|
desc "Publish the beta gem"
|
119
118
|
task :pgem => [:package] do
|
119
|
+
require 'rake/contrib/sshpublisher'
|
120
120
|
Rake::SshFilePublisher.new("gems.rubyonrails.org", "/u/sites/gems/gems", "pkg", "#{PKG_FILE_NAME}.gem").upload
|
121
121
|
`ssh gems.rubyonrails.org '/u/sites/gems/gemupdate.sh'`
|
122
122
|
end
|
123
123
|
|
124
124
|
desc "Publish the API documentation"
|
125
125
|
task :pdoc => [:rdoc] do
|
126
|
+
require 'rake/contrib/sshpublisher'
|
126
127
|
Rake::SshDirPublisher.new("wrath.rubyonrails.org", "public_html/ar", "doc").upload
|
127
128
|
end
|
128
129
|
|
@@ -93,6 +93,8 @@ module ActiveResource
|
|
93
93
|
#
|
94
94
|
# Many REST APIs will require authentication, usually in the form of basic
|
95
95
|
# HTTP authentication. Authentication can be specified by:
|
96
|
+
#
|
97
|
+
# === HTTP Basic Authentication
|
96
98
|
# * putting the credentials in the URL for the +site+ variable.
|
97
99
|
#
|
98
100
|
# class Person < ActiveResource::Base
|
@@ -112,6 +114,19 @@ module ActiveResource
|
|
112
114
|
#
|
113
115
|
# Note: Some values cannot be provided in the URL passed to site. e.g. email addresses
|
114
116
|
# as usernames. In those situations you should use the separate user and password option.
|
117
|
+
#
|
118
|
+
# === Certificate Authentication
|
119
|
+
#
|
120
|
+
# * End point uses an X509 certificate for authentication. <tt>See ssl_options=</tt> for all options.
|
121
|
+
#
|
122
|
+
# class Person < ActiveResource::Base
|
123
|
+
# self.site = "https://secure.api.people.com/"
|
124
|
+
# self.ssl_options = {:cert => OpenSSL::X509::Certificate.new(File.open(pem_file))
|
125
|
+
# :key => OpenSSL::PKey::RSA.new(File.open(pem_file)),
|
126
|
+
# :ca_path => "/path/to/OpenSSL/formatted/CA_Certs",
|
127
|
+
# :verify_mode => OpenSSL::SSL::VERIFY_PEER}
|
128
|
+
# end
|
129
|
+
#
|
115
130
|
# == Errors & Validation
|
116
131
|
#
|
117
132
|
# Error handling and validation is handled in much the same manner as you're used to seeing in
|
@@ -138,6 +153,7 @@ module ActiveResource
|
|
138
153
|
# * 404 - ActiveResource::ResourceNotFound
|
139
154
|
# * 405 - ActiveResource::MethodNotAllowed
|
140
155
|
# * 409 - ActiveResource::ResourceConflict
|
156
|
+
# * 410 - ActiveResource::ResourceGone
|
141
157
|
# * 422 - ActiveResource::ResourceInvalid (rescued by save as validation errors)
|
142
158
|
# * 401..499 - ActiveResource::ClientError
|
143
159
|
# * 500..599 - ActiveResource::ServerError
|
@@ -158,7 +174,7 @@ module ActiveResource
|
|
158
174
|
#
|
159
175
|
# Active Resource supports validations on resources and will return errors if any these validations fail
|
160
176
|
# (e.g., "First name can not be blank" and so on). These types of errors are denoted in the response by
|
161
|
-
# a response code of <tt>422</tt> and an XML representation of the validation errors. The save operation will
|
177
|
+
# a response code of <tt>422</tt> and an XML or JSON representation of the validation errors. The save operation will
|
162
178
|
# then fail (with a <tt>false</tt> return value) and the validation errors can be accessed on the resource in question.
|
163
179
|
#
|
164
180
|
# ryan = Person.find(1)
|
@@ -167,10 +183,14 @@ module ActiveResource
|
|
167
183
|
#
|
168
184
|
# # When
|
169
185
|
# # PUT http://api.people.com:3000/people/1.xml
|
186
|
+
# # or
|
187
|
+
# # PUT http://api.people.com:3000/people/1.json
|
170
188
|
# # is requested with invalid values, the response is:
|
171
189
|
# #
|
172
190
|
# # Response (422):
|
173
191
|
# # <errors type="array"><error>First cannot be empty</error></errors>
|
192
|
+
# # or
|
193
|
+
# # {"errors":["First cannot be empty"]}
|
174
194
|
# #
|
175
195
|
#
|
176
196
|
# ryan.errors.invalid?(:first) # => true
|
@@ -246,6 +266,22 @@ module ActiveResource
|
|
246
266
|
end
|
247
267
|
end
|
248
268
|
|
269
|
+
# Gets the \proxy variable if a proxy is required
|
270
|
+
def proxy
|
271
|
+
# Not using superclass_delegating_reader. See +site+ for explanation
|
272
|
+
if defined?(@proxy)
|
273
|
+
@proxy
|
274
|
+
elsif superclass != Object && superclass.proxy
|
275
|
+
superclass.proxy.dup.freeze
|
276
|
+
end
|
277
|
+
end
|
278
|
+
|
279
|
+
# Sets the URI of the http proxy to the value in the +proxy+ argument.
|
280
|
+
def proxy=(proxy)
|
281
|
+
@connection = nil
|
282
|
+
@proxy = proxy.nil? ? nil : create_proxy_uri_from(proxy)
|
283
|
+
end
|
284
|
+
|
249
285
|
# Gets the \user for REST HTTP authentication.
|
250
286
|
def user
|
251
287
|
# Not using superclass_delegating_reader. See +site+ for explanation
|
@@ -315,15 +351,42 @@ module ActiveResource
|
|
315
351
|
end
|
316
352
|
end
|
317
353
|
|
354
|
+
# Options that will get applied to an SSL connection.
|
355
|
+
#
|
356
|
+
# * <tt>:key</tt> - An OpenSSL::PKey::RSA or OpenSSL::PKey::DSA object.
|
357
|
+
# * <tt>:cert</tt> - An OpenSSL::X509::Certificate object as client certificate
|
358
|
+
# * <tt>:ca_file</tt> - Path to a CA certification file in PEM format. The file can contrain several CA certificates.
|
359
|
+
# * <tt>:ca_path</tt> - Path of a CA certification directory containing certifications in PEM format.
|
360
|
+
# * <tt>:verify_mode</tt> - Flags for server the certification verification at begining of SSL/TLS session. (OpenSSL::SSL::VERIFY_NONE or OpenSSL::SSL::VERIFY_PEER is acceptable)
|
361
|
+
# * <tt>:verify_callback</tt> - The verify callback for the server certification verification.
|
362
|
+
# * <tt>:verify_depth</tt> - The maximum depth for the certificate chain verification.
|
363
|
+
# * <tt>:cert_store</tt> - OpenSSL::X509::Store to verify peer certificate.
|
364
|
+
# * <tt>:ssl_timeout</tt> -The SSL timeout in seconds.
|
365
|
+
def ssl_options=(opts={})
|
366
|
+
@connection = nil
|
367
|
+
@ssl_options = opts
|
368
|
+
end
|
369
|
+
|
370
|
+
# Returns the SSL options hash.
|
371
|
+
def ssl_options
|
372
|
+
if defined?(@ssl_options)
|
373
|
+
@ssl_options
|
374
|
+
elsif superclass != Object && superclass.ssl_options
|
375
|
+
superclass.ssl_options
|
376
|
+
end
|
377
|
+
end
|
378
|
+
|
318
379
|
# An instance of ActiveResource::Connection that is the base \connection to the remote service.
|
319
380
|
# The +refresh+ parameter toggles whether or not the \connection is refreshed at every request
|
320
381
|
# or not (defaults to <tt>false</tt>).
|
321
382
|
def connection(refresh = false)
|
322
383
|
if defined?(@connection) || superclass == Object
|
323
384
|
@connection = Connection.new(site, format) if refresh || @connection.nil?
|
385
|
+
@connection.proxy = proxy if proxy
|
324
386
|
@connection.user = user if user
|
325
387
|
@connection.password = password if password
|
326
388
|
@connection.timeout = timeout if timeout
|
389
|
+
@connection.ssl_options = ssl_options if ssl_options
|
327
390
|
@connection
|
328
391
|
else
|
329
392
|
superclass.connection
|
@@ -557,7 +620,7 @@ module ActiveResource
|
|
557
620
|
response.code.to_i == 200
|
558
621
|
end
|
559
622
|
# id && !find_single(id, options).nil?
|
560
|
-
rescue ActiveResource::ResourceNotFound
|
623
|
+
rescue ActiveResource::ResourceNotFound, ActiveResource::ResourceGone
|
561
624
|
false
|
562
625
|
end
|
563
626
|
|
@@ -611,6 +674,11 @@ module ActiveResource
|
|
611
674
|
site.is_a?(URI) ? site.dup : URI.parse(site)
|
612
675
|
end
|
613
676
|
|
677
|
+
# Accepts a URI and creates the proxy URI from that.
|
678
|
+
def create_proxy_uri_from(proxy)
|
679
|
+
proxy.is_a?(URI) ? proxy.dup : URI.parse(proxy)
|
680
|
+
end
|
681
|
+
|
614
682
|
# contains a set of the current prefix parameters.
|
615
683
|
def prefix_parameters
|
616
684
|
@prefix_parameters ||= prefix_source.scan(/:\w+/).map { |key| key[1..-1].to_sym }.to_set
|
@@ -832,7 +900,7 @@ module ActiveResource
|
|
832
900
|
!new? && self.class.exists?(to_param, :params => prefix_options)
|
833
901
|
end
|
834
902
|
|
835
|
-
|
903
|
+
# Converts the resource to an XML string representation.
|
836
904
|
#
|
837
905
|
# ==== Options
|
838
906
|
# The +options+ parameter is handed off to the +to_xml+ method on each
|
@@ -841,7 +909,14 @@ module ActiveResource
|
|
841
909
|
#
|
842
910
|
# * <tt>:indent</tt> - Set the indent level for the XML output (default is +2+).
|
843
911
|
# * <tt>:dasherize</tt> - Boolean option to determine whether or not element names should
|
844
|
-
# replace underscores with dashes
|
912
|
+
# replace underscores with dashes. Default is <tt>true</tt>. The default can be set to <tt>false</tt>
|
913
|
+
# by setting the module attribute <tt>ActiveSupport.dasherize_xml = false</tt> in an initializer. Because save
|
914
|
+
# uses this method, and there are no options on save, then you will have to set the default if you don't
|
915
|
+
# want underscores in element names to become dashes when the resource is saved. This is important when
|
916
|
+
# integrating with non-Rails applications.
|
917
|
+
# * <tt>:camelize</tt> - Boolean option to determine whether or not element names should be converted
|
918
|
+
# to camel case, e.g some_name to SomeName. Default is <tt>false</tt>. Like <tt>:dasherize</tt> you can
|
919
|
+
# change the default by setting the module attribute <tt>ActiveSupport.camelise_xml = true</tt> in an initializer.
|
845
920
|
# * <tt>:skip_instruct</tt> - Toggle skipping the +instruct!+ call on the XML builder
|
846
921
|
# that generates the XML declaration (default is <tt>false</tt>).
|
847
922
|
#
|
@@ -861,8 +936,7 @@ module ActiveResource
|
|
861
936
|
attributes.to_xml({:root => self.class.element_name}.merge(options))
|
862
937
|
end
|
863
938
|
|
864
|
-
#
|
865
|
-
# available through +options+.
|
939
|
+
# Coerces to a hash for JSON encoding.
|
866
940
|
#
|
867
941
|
# ==== Options
|
868
942
|
# The +options+ are passed to the +to_json+ method on each
|
@@ -886,8 +960,8 @@ module ActiveResource
|
|
886
960
|
#
|
887
961
|
# person.to_json(:except => ["first_name"])
|
888
962
|
# # => {"last_name": "Smith"}
|
889
|
-
def
|
890
|
-
attributes.
|
963
|
+
def as_json(options = nil)
|
964
|
+
attributes.as_json(options)
|
891
965
|
end
|
892
966
|
|
893
967
|
# Returns the serialized string representation of the resource in the configured
|
@@ -946,7 +1020,13 @@ module ActiveResource
|
|
946
1020
|
case value
|
947
1021
|
when Array
|
948
1022
|
resource = find_or_create_resource_for_collection(key)
|
949
|
-
value.map
|
1023
|
+
value.map do |attrs|
|
1024
|
+
if attrs.is_a?(String) || attrs.is_a?(Numeric)
|
1025
|
+
attrs.duplicable? ? attrs.dup : attrs
|
1026
|
+
else
|
1027
|
+
resource.new(attrs)
|
1028
|
+
end
|
1029
|
+
end
|
950
1030
|
when Hash
|
951
1031
|
resource = find_or_create_resource_for(key)
|
952
1032
|
resource.new(value)
|