diff options
Diffstat (limited to 'railties/guides/source')
-rw-r--r-- | railties/guides/source/3_1_release_notes.textile | 100 | ||||
-rw-r--r-- | railties/guides/source/3_2_release_notes.textile | 38 | ||||
-rw-r--r-- | railties/guides/source/active_model_basics.textile | 2 | ||||
-rw-r--r-- | railties/guides/source/documents.yaml | 4 |
4 files changed, 125 insertions, 19 deletions
diff --git a/railties/guides/source/3_1_release_notes.textile b/railties/guides/source/3_1_release_notes.textile index c4da87dc34..27a5cff215 100644 --- a/railties/guides/source/3_1_release_notes.textile +++ b/railties/guides/source/3_1_release_notes.textile @@ -21,6 +21,106 @@ Rails 3.1 requires Ruby 1.8.7 or higher. Support for all of the previous Ruby ve TIP: Note that Ruby 1.8.7 p248 and p249 have marshaling bugs that crash Rails. Ruby Enterprise Edition have these fixed since release 1.8.7-2010.02 though. On the 1.9 front, Ruby 1.9.1 is not usable because it outright segfaults, so if you want to use 1.9.x jump on 1.9.2 for smooth sailing. +h4. What to update in your apps + +The following changes are meant for upgrading your application to Rails 3.1.3, the latest 3.1.x version of Rails. + +h5. Gemfile + +Make the following changes to your +Gemfile+. + +<ruby> +gem 'rails', '= 3.1.3' +gem 'mysql2' + +# Needed for the new asset pipeline +group :assets do + gem 'sass-rails', "~> 3.1.5" + gem 'coffee-rails', "~> 3.1.1" + gem 'uglifier', ">= 1.0.3" +end + +# jQuery is the default JavaScript library in Rails 3.1 +gem 'jquery-rails' +</ruby> + +h5. config/application.rb + +The asset pipeline requires the following additions: + +<ruby> +config.assets.enabled = true +config.assets.version = '1.0' +</ruby> + +h5. config/environments/development.rb + +* Remove the RJS setting <tt>config.action_view.debug_rjs = true</tt>. + +* Add the following, if you enable the asset pipeline. + +<ruby> +# Do not compress assets +config.assets.compress = false + +# Expands the lines which load the assets +config.assets.debug = true +</ruby> + +h5. config/environments/production.rb + +* Again, most of the changes below are for the asset pipeline. You can read more about these in the "Asset Pipeline":asset_pipeline.html guide. + +<ruby> +# Compress JavaScripts and CSS +config.assets.compress = true + +# Don't fallback to assets pipeline if a precompiled asset is missed +config.assets.compile = false + +# Generate digests for assets URLs +config.assets.digest = true + +# Defaults to Rails.root.join("public/assets") +# config.assets.manifest = YOUR_PATH + +# Precompile additional assets (application.js, application.css, and all non-JS/CSS are already added) +# config.assets.precompile += %w( search.js ) + + +# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies. +# config.force_ssl = true + +</ruby> + +h5. config/environments/test.rb + +<ruby> +# Configure static asset server for tests with Cache-Control for performance +config.serve_static_assets = true +config.static_cache_control = "public, max-age=3600" +</ruby> + +h5. config/initializers/wrap_parameters.rb + +* Add this file with the following contents, if you wish to wrap parameters into a nested hash. This is on by default in new applications. + +<ruby> +# Be sure to restart your server when you modify this file. +# This file contains settings for ActionController::ParamsWrapper which +# is enabled by default. + +# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array. +ActiveSupport.on_load(:action_controller) do + wrap_parameters :format => [:json] +end + +# Disable root element in JSON by default. +ActiveSupport.on_load(:active_record) do + self.include_root_in_json = false +end +</ruby> + h3. Creating a Rails 3.1 application <shell> diff --git a/railties/guides/source/3_2_release_notes.textile b/railties/guides/source/3_2_release_notes.textile index 0e58f2012e..b26ba2f3a6 100644 --- a/railties/guides/source/3_2_release_notes.textile +++ b/railties/guides/source/3_2_release_notes.textile @@ -15,13 +15,20 @@ h3. Upgrading to Rails 3.2 If you're upgrading an existing application, it's a great idea to have good test coverage before going in. You should also first upgrade to Rails 3.1 in case you haven't and make sure your application still runs as expected before attempting an update to Rails 3.2. Then take heed of the following changes: +h4. Rails 3.2 requires at least Ruby 1.8.7 + +Rails 3.2 requires Ruby 1.8.7 or higher. Support for all of the previous Ruby versions has been dropped officially and you should upgrade as early as possible. Rails 3.2 is also compatible with Ruby 1.9.2. + +TIP: Note that Ruby 1.8.7 p248 and p249 have marshaling bugs that crash Rails. Ruby Enterprise Edition has these fixed since the release of 1.8.7-2010.02. On the 1.9 front, Ruby 1.9.1 is not usable because it outright segfaults, so if you want to use 1.9.x, jump on to 1.9.2 or 1.9.3 for smooth sailing. + h4. What to update in your apps -* Update your Gemfile to depend on rails = 3.2.0 -* Update your Gemfile to depend on sass-rails ~> 3.2.3 -* Update your Gemfile to depend on coffee-rails ~> 3.2.1 +* Update your Gemfile to depend on +** <tt>rails = 3.2.0</tt> +** <tt>sass-rails ~> 3.2.3</tt> +** <tt>coffee-rails ~> 3.2.1</tt> -* Start moving any remaining Rails 2.3-style vendor/plugins/==*==. These have been finally deprecated and will be removed in Rails 4.0. Instead, extract your vendor/plugins to their own gems and bundle them in your Gemfile. If you think they're not worthy of being a gem, move them into lib/my_plugin/==*==. You'll also need to add an appropriate initializer in config/initializers/my_plugin.rb. +* Rails 3.2 deprecates <tt>vendor/plugins</tt> and Rails 4.0 will remove them completely. You can start replacing these plugins by extracting them as gems and adding them in your Gemfile. If you choose not to make them gems, you can move them into, say, <tt>lib/my_plugin/*</tt> and add an appropriate initializer in <tt>config/initializers/my_plugin.rb</tt>. * There are a couple of new configuration changes you'd want to add in <tt>config/environments/development.rb</tt>: @@ -34,19 +41,13 @@ config.active_record.mass_assignment_sanitizer = :strict config.active_record.auto_explain_threshold_in_seconds = 0.5 </ruby> -The last configuration from above also needs to be added in <tt>config/environments/test.rb</tt>: +The <tt>mass_assignment_sanitizer</tt> config also needs to be added in <tt>config/environments/test.rb</tt>: <ruby> # Raise exception on mass assignment protection for Active Record models config.active_record.mass_assignment_sanitizer = :strict </ruby> -h4. Rails 3.2 requires at least Ruby 1.8.7 - -Rails 3.2 requires Ruby 1.8.7 or higher. Support for all of the previous Ruby versions has been dropped officially and you should upgrade as early as possible. Rails 3.2 is also compatible with Ruby 1.9.2. - -TIP: Note that Ruby 1.8.7 p248 and p249 have marshaling bugs that crash Rails. Ruby Enterprise Edition has these fixed since the release of 1.8.7-2010.02. On the 1.9 front, Ruby 1.9.1 is not usable because it outright segfaults, so if you want to use 1.9.x, jump on to 1.9.2 or 1.9.3 for smooth sailing. - h3. Creating a Rails 3.2 application <shell> @@ -59,7 +60,7 @@ h4. Vendoring Gems Rails now uses a +Gemfile+ in the application root to determine the gems you require for your application to start. This +Gemfile+ is processed by the "Bundler":https://github.com/carlhuda/bundler gem, which then installs all your dependencies. It can even install all the dependencies locally to your application so that it doesn't depend on the system gems. -More information: - "Bundler homepage":http://gembundler.com +More information: "Bundler homepage":http://gembundler.com h4. Living on the Edge @@ -89,11 +90,10 @@ Queries that take more than half a second to run are *automatically* explained i h4. Tagged Logging -When running a multi-user, multi-account application, it's a great help to be able to filter the log by who did what. TaggedLogging in Active Support helps in doing exactly that by stamping log lines with subdomains, request ids, and anything else to aid debugging of such applications. +When running a multi-user, multi-account application, it's a great help to be able to filter the log by who did what. TaggedLogging in Active Support helps in doing exactly that by stamping log lines with subdomains, request ids, and anything else to aid debugging such applications. h3. Railties - * Speed up development by only reloading classes if dependencies files changed. This can be turned off by setting <tt>config.reload_classes_only_on_change</tt> to false. * New applications get a flag <tt>config.active_record.auto_explain_threshold_in_seconds</tt> in the environments configuration files. With a value of <tt>0.5</tt> in <tt>development.rb</tt> and commented out in <tt>production.rb</tt>. No mention in <tt>test.rb</tt>. @@ -112,7 +112,7 @@ config.railties_order = [Blog::Engine, :main_app, :all] * Scaffold returns 204 No Content for API requests without content. This makes scaffold work with jQuery out of the box. -* Update Rails::Rack::Logger middleware to apply any tags set in config.log_tags to the newly ActiveSupport::TaggedLogging Rails.logger. This makes it easy to tag log lines with debug information like subdomain and request id -- both very helpful in debugging multi-user production applications +* Update <tt>Rails::Rack::Logger</tt> middleware to apply any tags set in <tt>config.log_tags</tt> to <tt>ActiveSupport::TaggedLogging</tt>. This makes it easy to tag log lines with debug information like subdomain and request id -- both very helpful in debugging multi-user production applications. * Default options to +rails new+ can be set in <tt>~/.railsrc</tt>. @@ -225,7 +225,7 @@ h4. Action View <% end %> </ruby> -* Date helpers accept a new option <tt>:use_two_digit_numbers => true</tt>, that renders select boxes for months and days with a leading zero without changing the respective values. For example, this is useful for displaying ISO8601-style dates such as '2011-08-01'. +* Date helpers accept a new option <tt>:use_two_digit_numbers => true</tt>, that renders select boxes for months and days with a leading zero without changing the respective values. For example, this is useful for displaying ISO 8601-style dates such as '2011-08-01'. * You can provide a namespace for your form to ensure uniqueness of id attributes on form elements. The namespace attribute will be prefixed with underscore on the generated HTML id. @@ -264,11 +264,13 @@ h5. Deprecations h3. Active Record +* Boolean columns with 'on' and 'ON' values are type casted to true. + * Implemented <tt>ActiveRecord::Relation#explain</tt>. * Implements <tt>AR::Base.silence_auto_explain</tt> which allows the user to selectively disable automatic EXPLAINs within a block. -* Implements automatic EXPLAIN logging for slow queries. A new configuration parameter +config.active_record.auto_explain_threshold_in_seconds+ determines what's to be considered a slow query. Setting that to nil disables this feature. Defaults are 0.5 in development mode, and nil in test and production modes. As of this writing there's support for SQLite, MySQL (mysql2 adapter), and PostgreSQL. +* Implements automatic EXPLAIN logging for slow queries. A new configuration parameter +config.active_record.auto_explain_threshold_in_seconds+ determines what's to be considered a slow query. Setting that to nil disables this feature. Defaults are 0.5 in development mode, and nil in test and production modes. Rails 3.2 supports this feature in SQLite, MySQL (mysql2 adapter), and PostgreSQL. * Added <tt>ActiveRecord::Base.store</tt> for declaring simple single-column key/value stores. @@ -455,7 +457,7 @@ h4. Deprecations * Deprecated <tt>ActiveSupport::MessageEncryptor#encrypt</tt> and <tt>ActiveSupport::MessageEncryptor#decrypt</tt>. -* <tt>ActiveSupport::BufferedLogger#silence</tt> is deprecated. If you want to squelch logs for a certain block, change the log level for that block. +* <tt>ActiveSupport::BufferedLogger#silence</tt> is deprecated. If you want to squelch logs for a certain block, change the log level for that block. * <tt>ActiveSupport::BufferedLogger#open_log</tt> is deprecated. This method should not have been public in the first place. diff --git a/railties/guides/source/active_model_basics.textile b/railties/guides/source/active_model_basics.textile index 9c8ad24cee..98b3533000 100644 --- a/railties/guides/source/active_model_basics.textile +++ b/railties/guides/source/active_model_basics.textile @@ -56,7 +56,7 @@ class Person before_update :reset_me def update - _run_update_callbacks do + run_callbacks(:update) do # This will call when we are trying to call update on object. end end diff --git a/railties/guides/source/documents.yaml b/railties/guides/source/documents.yaml index 58713a08a8..6a47959c3d 100644 --- a/railties/guides/source/documents.yaml +++ b/railties/guides/source/documents.yaml @@ -136,6 +136,10 @@ name: Release Notes documents: - + name: Ruby on Rails 3.2 Release Notes + url: 3_2_release_notes.html + description: Release notes for Rails 3.2. + - name: Ruby on Rails 3.1 Release Notes url: 3_1_release_notes.html description: Release notes for Rails 3.1. |