From 95b0f6305e31800df7be66ab1c4cbcdaa2a4a528 Mon Sep 17 00:00:00 2001 From: Vijay Dev Date: Sat, 23 Jun 2012 19:54:52 +0530 Subject: format the 4.0 release notes [ci skip] --- guides/source/4_0_release_notes.textile | 97 +++++++++++++++------------------ 1 file changed, 45 insertions(+), 52 deletions(-) diff --git a/guides/source/4_0_release_notes.textile b/guides/source/4_0_release_notes.textile index 1ed6006b6b..23c5220c24 100644 --- a/guides/source/4_0_release_notes.textile +++ b/guides/source/4_0_release_notes.textile @@ -70,7 +70,7 @@ h3. Railties * Improved +rake routes+ output for redirects. -* Load all environments available in config.paths["config/environments"]. +* Load all environments available in config.paths["config/environments"]. * The application generator generates public/humans.txt with some basic data. @@ -92,12 +92,11 @@ console do end -* Add convenience hide! method to Rails generators to hide current generator - namespace from showing when running rails generate. +* Add a convenience method hide! to Rails generators to hide the current generator namespace from showing when running rails generate. * Scaffold now uses +content_tag_for+ in index.html.erb. -* Rails::Plugin is removed. Instead of adding plugins to vendor/plugins use gems or bundler with path or git dependencies. +* Rails::Plugin is removed. Instead of adding plugins to vendor/plugins, use gems or bundler with path or git dependencies. h4(#railties_deprecations). Deprecations @@ -117,15 +116,15 @@ h4. Action Controller * +respond_to+ and +respond_with+ now raise ActionController::UnknownFormat instead of directly returning head 406. The exception is rescued and converted to 406 in the exception handling middleware. -* JSONP now uses mimetype application/javascript instead of application/json. +* JSONP now uses application/javascript instead of application/json as the MIME type. * Session arguments passed to process calls in functional tests are now merged into the existing session, whereas previously they would replace the existing session. This change may break some existing tests if they are asserting the exact contents of the session but should not break existing tests that only assert individual keys. -* Forms of persisted records use always PATCH (via the _method hack). +* Forms of persisted records use always PATCH (via the +_method+ hack). -* For resources, both PATCH and PUT are routed to the update action. +* For resources, both PATCH and PUT are routed to the +update+ action. -* Don't ignore +force_ssl+ in development. This is a change of behavior - use a :if condition to recreate the old behavior. +* Don't ignore +force_ssl+ in development. This is a change of behavior - use an :if condition to recreate the old behavior. class AccountsController < ApplicationController @@ -139,52 +138,46 @@ end h5(#actioncontroller_deprecations). Deprecations -* Deprecated ActionController::Integration in favour of ActionDispatch::Integration +* Deprecated ActionController::Integration in favour of ActionDispatch::Integration. -* Deprecated ActionController::IntegrationTest in favour of ActionDispatch::IntegrationTest +* Deprecated ActionController::IntegrationTest in favour of ActionDispatch::IntegrationTest. -* Deprecated ActionController::PerformanceTest in favour of ActionDispatch::PerformanceTest +* Deprecated ActionController::PerformanceTest in favour of ActionDispatch::PerformanceTest. -* Deprecated ActionController::AbstractRequest in favour of ActionDispatch::Request +* Deprecated ActionController::AbstractRequest in favour of ActionDispatch::Request. -* Deprecated ActionController::Request in favour of ActionDispatch::Request +* Deprecated ActionController::Request in favour of ActionDispatch::Request. -* Deprecated ActionController::AbstractResponse in favour of ActionDispatch::Response +* Deprecated ActionController::AbstractResponse in favour of ActionDispatch::Response. -* Deprecated ActionController::Response in favour of ActionDispatch::Response +* Deprecated ActionController::Response in favour of ActionDispatch::Response. -* Deprecated ActionController::Routing in favour of ActionDispatch::Routing +* Deprecated ActionController::Routing in favour of ActionDispatch::Routing. h4. Action Dispatch * Added ActionDispatch::SSL middleware that when included force all the requests to be under HTTPS protocol. -* Copy literal route constraints to defaults so that url generation know about them. The copied constraints are :protocol, :subdomain, :domain, :host and :port. +* Copy literal route constraints to defaults so that url generation know about them. The copied constraints are :protocol, :subdomain, :domain, :host and :port. * Allows +assert_redirected_to+ to match against a regular expression. -* Add backtrace to development routing error page. +* Adds a backtrace to the routing error page in development. * +assert_generates+, +assert_recognizes+, and +assert_routing+ all raise +Assertion+ instead of +RoutingError+. * Allows the route helper root to take a string argument. For example, root 'pages#main' as a shortcut for root to: 'pages#main'. -* Adds support for the PATCH verb: - Request objects respond to patch?. - Routes have a new patch method, and understand :patch in the - existing places where a verb is configured, like :via. - New method patch available in functional tests. - If :patch is the default verb for updates, edits are - tunneled as PATCH rather than as PUT, and routing acts accordingly. - New method patch_via_redirect available in integration tests. +* Adds support for the PATCH verb: Request objects respond to patch?. Routes now have a new +patch+ method, and understand +:patch+ in the existing places where a verb is configured, like :via. Functional tests have a new method +patch+ and integration tests have a new method +patch_via_redirect+. +If :patch is the default verb for updates, edits are tunneled as PATCH rather than as PUT and routing acts accordingly. * Integration tests support the OPTIONS method. -* +expires_in+ accepts a +must_revalidate+ flag. If true, "must-revalidate" is added to the Cache-Control header. +* +expires_in+ accepts a +must_revalidate+ flag. If true, "must-revalidate" is added to the Cache-Control header. -* Default responder will now always use your overridden block in respond_with to render your response. +* Default responder will now always use your overridden block in respond_with to render your response. -* Turn off verbose mode of rack-cache, we still have X-Rack-Cache to check that info. +* Turn off verbose mode of rack-cache, we still have X-Rack-Cache to check that info. * Include mounted_helpers (helpers for accessing mounted engines) in ActionDispatch::IntegrationTest by default. @@ -192,9 +185,9 @@ h5(#actiondispatch_deprecations). Deprecations h4. Action View -* Make current object and counter (when it applies) variables accessible when rendering templates with :object / :collection. +* Make current object and counter (when it applies) variables accessible when rendering templates with :object or :collection. -* Allow to lazy load +default_form_builder+ by passing a String instead of a constant. +* Allow to lazy load +default_form_builder+ by passing a string instead of a constant. * Add index method to +FormBuilder+ class. @@ -204,9 +197,9 @@ h4. Action View * Remove :mouseover option from +image_tag+ helper. -* Templates without a handler extension now raises a deprecation warning but still defaults to ERb. In future releases, it will simply return the template content. +* Templates without a handler extension now raises a deprecation warning but still defaults to +ERb+. In future releases, it will simply return the template content. -* Add divider option to +grouped_options_for_select+ to generate a separator optgroup automatically, and deprecate prompt as third argument, in favor of using an options hash. +* Add a +divider+ option to +grouped_options_for_select+ to generate a separator optgroup automatically, and deprecate prompt as third argument, in favor of using an options hash. * Add +time_field+ and +time_field_tag+ helpers which render an input[type="time"] tag. @@ -237,9 +230,9 @@ h4. Action View * Remove +button_to_function+ and +link_to_function+ helpers. -* truncate now always returns an escaped HTML-safe string. The option :escape can be used as false to not escape the result. +* +truncate+ now always returns an escaped HTML-safe string. The option :escape can be used as +false+ to not escape the result. -* truncate now accepts a block to show extra content when the text is truncated. +* +truncate+ now accepts a block to show extra content when the text is truncated. * Add +week_field+, +week_field_tag+, +month_field+, +month_field_tag+, +datetime_local_field+, +datetime_local_field_tag+, +datetime_field+ and +datetime_field_tag+ helpers. @@ -253,7 +246,7 @@ h4. Action View * Adds +image_url+, +javascript_url+, +stylesheet_url+, +audio_url+, +video_url+, and +font_url+ to assets tag helper. These URL helpers will return the full path to your assets. This is useful when you are going to reference this asset from external host. -* Allow +value_method+ and +text_method+ arguments from +collection_select+ and +options_from_collection_for_select+ to receive an object that responds to :call, such as a proc, to evaluate the option in the current element context. This works the same way with +collection_radio_buttons+ and +collection_check_boxes+. +* Allow +value_method+ and +text_method+ arguments from +collection_select+ and +options_from_collection_for_select+ to receive an object that responds to :call such as a proc, to evaluate the option in the current element context. This works the same way with +collection_radio_buttons+ and +collection_check_boxes+. * Add +date_field+ and +date_field_tag+ helpers which render an input[type="date"] tag. @@ -271,7 +264,7 @@ collection_check_boxes :post, :author_ids, Author.all, :id, :name The label/check_box pairs can be customized with a block. -* Add +collection_radio_buttons+ form helper, similar to collection_select: +* Add +collection_radio_buttons+ form helper, similar to +collection_select+: collection_radio_buttons :post, :author_id, Author.all, :id, :name @@ -284,15 +277,15 @@ collection_radio_buttons :post, :author_id, Author.all, :id, :name The label/radio_button pairs can be customized with a block. -* +check_box+ with :form HTML5 attribute will now replicate the :form attribute to the hidden field as well. +* +check_box+ with an HTML5 attribute +:form+ will now replicate the +:form+ attribute to the hidden field as well. -* label form helper accepts :for => nil to not generate the attribute. +* label form helper accepts :for => nil to not generate the attribute. -* Add :format option to +number_to_percentage+. +* Add :format option to +number_to_percentage+. -* Add config.action_view.logger to configure logger for Action View. +* Add config.action_view.logger to configure logger for +Action View+. -* +check_box+ helper with :disabled => true will generate a disabled hidden field to conform with the HTML convention where disabled fields are not submitted with the form. This is a behavior change, previously the hidden tag had a value of the disabled checkbox. +* +check_box+ helper with :disabled => true will generate a +disabled+ hidden field to conform with the HTML convention where disabled fields are not submitted with the form. This is a behavior change, previously the hidden tag had a value of the disabled checkbox. * +favicon_link_tag+ helper will now use the favicon in app/assets by default. @@ -308,7 +301,7 @@ h3. Active Record * Allow blocks for count with ActiveRecord::Relation, to work similar as Array#count: Person.where("age > 26").count { |person| person.gender == 'female' } -* Added support to CollectionAssociation#delete for passing fixnum or string values as record ids. This finds the records responding to the id and executes delete on them. +* Added support to CollectionAssociation#delete for passing fixnum or string values as record ids. This finds the records responding to the ids and deletes them. class Person < ActiveRecord::Base @@ -327,11 +320,11 @@ person.pets.delete(2, 3) # => [#, #] store :settings, accessors: [ :color, :homepage ], coder: JSON -* mysql and mysql2 connections will set SQL_MODE=STRICT_ALL_TABLES by default to avoid silent data loss. This can be disabled by specifying strict: false in your database.yml. +* +mysql+ and +mysql2+ connections will set SQL_MODE=STRICT_ALL_TABLES by default to avoid silent data loss. This can be disabled by specifying strict: false in config/database.yml. -* Added default order to first to assure consistent results among diferent database engines. Introduced take as a replacement to the old behavior of first. +* Added default order to ActiveRecord::Base#first to assure consistent results among diferent database engines. Introduced ActiveRecord::Base#take as a replacement to the old behavior. -* Added an :index option to automatically create indexes for references and belongs_to statements in migrations. The references and belongs_to methods now support an index option that receives either a boolean value or an options hash that is identical to options available to the add_index method: +* Added an :index option to automatically create indexes for +references+ and +belongs_to+ statements in migrations. This can be either a boolean or a hash that is identical to options available to the +add_index+ method: create_table :messages do |t| @@ -352,7 +345,7 @@ Generators have also been updated to use the new syntax. * Added bang methods for mutating ActiveRecord::Relation objects. For example, while foo.where(:bar) will return a new object leaving foo unchanged, foo.where!(:bar) will mutate the foo object. -* Added #find_by and #find_by! to mirror the functionality provided by dynamic finders in a way that allows dynamic input more easily: +* Added #find_by and #find_by! to mirror the functionality provided by dynamic finders in a way that allows dynamic input more easily: Post.find_by name: 'Spartacus', rating: 4 @@ -364,7 +357,7 @@ Post.find_by! name: 'Spartacus' * Remove IdentityMap - IdentityMap has never graduated to be an "enabled-by-default" feature, due to some inconsistencies with associations, as described in this commit: https://github.com/rails/rails/commit/302c912bf6bcd0fa200d964ec2dc4a44abe328a6. Hence the removal from the codebase, until such issues are fixed. -* Added a feature to dump/load internal state of SchemaCache instance because we want to boot rails more quickly when we have many models. +* Added a feature to dump/load internal state of +SchemaCache+ instance because we want to boot more quickly when we have many models. # execute rake task. @@ -382,14 +375,14 @@ RAILS_ENV=production bundle exec rake db:schema:cache:clear => remove db/schema_cache.dump -* Added support for partial indices to PostgreSQL adapter. +* Added support for partial indices to +PostgreSQL+ adapter. * The +add_index+ method now supports a +where+ option that receives a string with the partial index criteria. -* Implemented ActiveRecord::Relation#none method which returns a chainable relation with zero records (an instance of the NullRelation class). Any subsequent condition chained to the returned relation will continue generating an empty relation and will not fire any query to the database. - * Added the ActiveRecord::NullRelation class implementing the null object pattern for the Relation class. +* Implemented ActiveRecord::Relation#none method which returns a chainable relation with zero records (an instance of the +NullRelation+ class). Any subsequent condition chained to the returned relation will continue generating an empty relation and will not fire any query to the database. + * Added +create_join_table+ migration helper to create HABTM join tables. @@ -401,7 +394,7 @@ create_join_table :products, :categories # end -* The primary key is always initialized in the @attributes hash to nil (unless another value has been specified). +* The primary key is always initialized in the +@attributes+ hash to nil (unless another value has been specified). * In previous releases, the following would generate a single query with an OUTER JOIN comments, rather than two separate queries: -- cgit v1.2.3