diff options
31 files changed, 868 insertions, 118 deletions
diff --git a/actionmailer/CHANGELOG.md b/actionmailer/CHANGELOG.md index 57af4ee6a4..da5d5c4086 100644 --- a/actionmailer/CHANGELOG.md +++ b/actionmailer/CHANGELOG.md @@ -1,14 +1,66 @@ +## Rails 4.0.0 (unreleased) ## + +* No changes + + +## Rails 3.2.1 (January 26, 2012) ## + +* No changes. + + +## Rails 3.2.0 (January 20, 2012) ## + +* Upgrade mail version to 2.4.0 *ML* + +* Remove Old ActionMailer API *Josh Kalderimis* + + +## Rails 3.1.3 (November 20, 2011) ## + +* No changes + + +## Rails 3.1.2 (November 18, 2011) ## + +* No changes + + +## Rails 3.1.1 (October 7, 2011) ## + +* No changes + + ## Rails 3.1.0 (August 30, 2011) ## * No changes +## Rails 3.0.11 (November 18, 2011) ## + +* No changes. + + +## Rails 3.0.10 (August 16, 2011) ## + +* No changes. + + +## Rails 3.0.9 (June 16, 2011) ## + +* No changes. + + +## Rails 3.0.8 (June 7, 2011) ## + +* Mail dependency increased to 2.2.19 + + ## Rails 3.0.7 (April 18, 2011) ## * remove AM delegating register_observer and register_interceptor to Mail *Josh Kalderimis* -* Rails 3.0.6 (April 5, 2011) +## Rails 3.0.6 (April 5, 2011) ## * Don't allow i18n to change the minor version, version now set to ~> 0.5.0 *Santiago Pastorino* diff --git a/actionpack/CHANGELOG.md b/actionpack/CHANGELOG.md index 6c56a37340..74a8d9f78a 100644 --- a/actionpack/CHANGELOG.md +++ b/actionpack/CHANGELOG.md @@ -110,6 +110,29 @@ * `ActionView::Helpers::TextHelper#highlight` now defaults to the HTML5 `mark` element. *Brian Cardarella* + +## Rails 3.2.2 (unreleased) ## + +* Format lookup for partials is derived from the format in which the template is being rendered. Closes #5025 part 2 *Santiago Pastorino* + +* Use the right format when a partial is missing. Closes #5025. *Santiago Pastorino* + +* Default responder will now always use your overridden block in `respond_with` to render your response. *Prem Sichanugrist* + +* 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. + *Tadas Tamosauskas* + + +## Rails 3.2.1 (January 26, 2012) ## + +* Documentation improvements. + +* Allow `form.select` to accept ranges (regression). *Jeremy Walker* + +* `datetime_select` works with -/+ infinity dates. *Joe Van Dyk* + + ## Rails 3.2.0 (January 20, 2012) ## * Add `config.action_dispatch.default_charset` to configure default charset for ActionDispatch::Response. *Carlos Antonio da Silva* @@ -280,14 +303,24 @@ ## Rails 3.1.4 (unreleased) ## +* Skip assets group in Gemfile and all assets configurations options + when the application is generated with --skip-sprockets option. + + *Guillermo Iguaran* + +* Use ProcessedAsset#pathname in Sprockets helpers when debugging is on. Closes #3333 #3348 #3361. + + *Guillermo Iguaran* + * Allow to use asset_path on named_routes aliasing RailsHelper's asset_path to path_to_asset *Adrian Pike* -* Assets should use the request protocol by default or default to - relative if no request is available *Jonathan del Strother* +* Assets should use the request protocol by default or default to relative if no request is available *Jonathan del Strother* ## Rails 3.1.3 (November 20, 2011) ## +* Downgrade sprockets to ~> 2.0.3. Using 2.1.0 caused regressions. + * Fix using `translate` helper with a html translation which uses the `:count` option for pluralization. @@ -570,6 +603,96 @@ * Add Rack::Cache to the default stack. Create a Rails store that delegates to the Rails cache, so by default, whatever caching layer you are using will be used for HTTP caching. Note that Rack::Cache will be used if you use #expires_in, #fresh_when or #stale with :public => true. Otherwise, the caching rules will apply to the browser only. *Yehuda Katz, Carl Lerche* +## Rails 3.0.12 (unreleased) ## + +* Fix using `tranlate` helper with a html translation which uses the `:count` option for + pluralization. + + *Jon Leighton* + + +## Rails 3.0.11 (November 18, 2011) ## + +* Fix XSS security vulnerability in the `translate` helper method. When using interpolation + in combination with HTML-safe translations, the interpolated input would not get HTML + escaped. *GH 3664* + + Before: + + translate('foo_html', :something => '<script>') # => "...<script>..." + + After: + + translate('foo_html', :something => '<script>') # => "...<script>..." + + *Sergey Nartimov* + +* Implement a workaround for a bug in ruby-1.9.3p0 where an error would be + raised while attempting to convert a template from one encoding to another. + + Please see http://redmine.ruby-lang.org/issues/5564 for details of the bug. + + The workaround is to load all conversions into memory ahead of time, and will + only happen if the ruby version is exactly 1.9.3p0. The hope is obviously + that the underlying problem will be resolved in the next patchlevel release + of 1.9.3. + +* Fix assert_select_email to work on multipart and non-multipart emails as the method stopped working correctly in Rails 3.x due to changes in the new mail gem. + +* Fix url_for when passed a hash to prevent additional options (eg. :host, :protocol) from being added to the hash after calling it. + + +## Rails 3.0.10 (August 16, 2011) ## + +* Fixes an issue where cache sweepers with only after filters would have no + controller object, it would raise undefined method controller_name for nil [jeroenj] + +* Ensure status codes are logged when exceptions are raised. + +* Subclasses of OutputBuffer are respected. + +* Fixed ActionView::FormOptionsHelper#select with :multiple => false + +* Avoid extra call to Cache#read in case of a fragment cache hit + + +## Rails 3.0.9 (June 16, 2011) ## + +* json_escape will now return a SafeBuffer string if it receives SafeBuffer string [tenderlove] + +* Make sure escape_js returns SafeBuffer string if it receives SafeBuffer string [Prem Sichanugrist] + +* Fix text helpers to work correctly with the new SafeBuffer restriction [Paul Gallagher, Arun Agrawal, Prem Sichanugrist] + + +## Rails 3.0.8 (June 7, 2011) ## + +* It is prohibited to perform a in-place SafeBuffer mutation [tenderlove] + + The old behavior of SafeBuffer allowed you to mutate string in place via + method like `sub!`. These methods can add unsafe strings to a safe buffer, + and the safe buffer will continue to be marked as safe. + + An example problem would be something like this: + + <%= link_to('hello world', @user).sub!(/hello/, params[:xss]) %> + + In the above example, an untrusted string (`params[:xss]`) is added to the + safe buffer returned by `link_to`, and the untrusted content is successfully + sent to the client without being escaped. To prevent this from happening + `sub!` and other similar methods will now raise an exception when they are called on a safe buffer. + + In addition to the in-place versions, some of the versions of these methods which return a copy of the string will incorrectly mark strings as safe. For example: + + <%= link_to('hello world', @user).sub(/hello/, params[:xss]) %> + + The new versions will now ensure that *all* strings returned by these methods on safe buffers are marked unsafe. + + You can read more about this change in http://groups.google.com/group/rubyonrails-security/browse_thread/thread/2e516e7acc96c4fb + +* Fixed github issue #342 with asset paths and relative roots. + + ## Rails 3.0.7 (April 18, 2011) ## * No changes. diff --git a/actionpack/lib/abstract_controller/base.rb b/actionpack/lib/abstract_controller/base.rb index 3d915cf513..43cea3b79e 100644 --- a/actionpack/lib/abstract_controller/base.rb +++ b/actionpack/lib/abstract_controller/base.rb @@ -85,7 +85,7 @@ module AbstractController # Returns the full controller name, underscored, without the ending Controller. # For instance, MyApp::MyPostsController would return "my_app/my_posts" for - # controller_name. + # controller_path. # # ==== Returns # * <tt>string</tt> diff --git a/actionpack/lib/action_dispatch/routing/mapper.rb b/actionpack/lib/action_dispatch/routing/mapper.rb index 4f55537fe2..02a27110e4 100644 --- a/actionpack/lib/action_dispatch/routing/mapper.rb +++ b/actionpack/lib/action_dispatch/routing/mapper.rb @@ -328,7 +328,7 @@ module ActionDispatch # +call+ or a string representing a controller's action. # # match 'path', :to => 'controller#action' - # match 'path', :to => lambda { [200, {}, "Success!"] } + # match 'path', :to => lambda { |env| [200, {}, "Success!"] } # match 'path', :to => RackApp # # [:on] diff --git a/actionpack/lib/action_view/helpers/form_options_helper.rb b/actionpack/lib/action_view/helpers/form_options_helper.rb index abb548c276..5be3da9b94 100644 --- a/actionpack/lib/action_view/helpers/form_options_helper.rb +++ b/actionpack/lib/action_view/helpers/form_options_helper.rb @@ -506,23 +506,24 @@ module ActionView # NOTE: Only the option tags are returned, you have to wrap this call in # a regular HTML select tag. def time_zone_options_for_select(selected = nil, priority_zones = nil, model = ::ActiveSupport::TimeZone) - zone_options = "" + zone_options = "".html_safe zones = model.all convert_zones = lambda { |list| list.map { |z| [ z.to_s, z.name ] } } if priority_zones if priority_zones.is_a?(Regexp) - priority_zones = model.all.find_all {|z| z =~ priority_zones} + priority_zones = zones.select { |z| z =~ priority_zones } end - zone_options += options_for_select(convert_zones[priority_zones], selected) - zone_options += "<option value=\"\" disabled=\"disabled\">-------------</option>\n" - zones = zones.reject { |z| priority_zones.include?( z ) } + zone_options.safe_concat options_for_select(convert_zones[priority_zones], selected) + zone_options.safe_concat content_tag(:option, '-------------', :value => '', :disabled => 'disabled') + zone_options.safe_concat "\n" + + zones.reject! { |z| priority_zones.include?(z) } end - zone_options += options_for_select(convert_zones[zones], selected) - zone_options.html_safe + zone_options.safe_concat options_for_select(convert_zones[zones], selected) end # Returns radio button tags for the collection of existing return values @@ -577,9 +578,9 @@ module ActionView # b.label(:class => "radio_button") { b.radio_button(:class => "radio_button") } # end # - # There are also two special methods available: <tt>text</tt> and - # <tt>value</tt>, which are the current text and value methods for the - # item being rendered, respectively. You can use them like this: + # There are also three special methods available: <tt>object</tt>, <tt>text</tt> and + # <tt>value</tt>, which are the current item being rendered, its text and value methods, + # respectively. You can use them like this: # collection_radio_buttons(:post, :author_id, Author.all, :id, :name_with_initial) do |b| # b.label(:"data-value" => b.value) { b.radio_button + b.text } # end @@ -640,9 +641,9 @@ module ActionView # b.label(:class => "check_box") { b.check_box(:class => "check_box") } # end # - # There are also two special methods available: <tt>text</tt> and - # <tt>value</tt>, which are the current text and value methods for the - # item being rendered, respectively. You can use them like this: + # There are also three special methods available: <tt>object</tt>, <tt>text</tt> and + # <tt>value</tt>, which are the current item being rendered, its text and value methods, + # respectively. You can use them like this: # collection_check_boxes(:post, :author_ids, Author.all, :id, :name_with_initial) do |b| # b.label(:"data-value" => b.value) { b.check_box + b.text } # end @@ -659,11 +660,8 @@ module ActionView def option_text_and_value(option) # Options are [text, value] pairs or strings used for both. - case - when Array === option - option = option.reject { |e| Hash === e } - [option.first, option.last] - when !option.is_a?(String) && option.respond_to?(:first) && option.respond_to?(:last) + if !option.is_a?(String) && option.respond_to?(:first) && option.respond_to?(:last) + option = option.reject { |e| Hash === e } if Array === option [option.first, option.last] else [option, option] @@ -671,11 +669,7 @@ module ActionView end def option_value_selected?(value, selected) - if selected.respond_to?(:include?) && !selected.is_a?(String) - selected.include? value - else - value == selected - end + Array(selected).include? value end def extract_selected_and_disabled(selected) diff --git a/actionpack/lib/action_view/helpers/tags/base.rb b/actionpack/lib/action_view/helpers/tags/base.rb index d949ff5194..c9c891daa1 100644 --- a/actionpack/lib/action_view/helpers/tags/base.rb +++ b/actionpack/lib/action_view/helpers/tags/base.rb @@ -133,13 +133,14 @@ module ActionView def add_options(option_tags, options, value = nil) if options[:include_blank] - option_tags = "<option value=\"\">#{ERB::Util.html_escape(options[:include_blank]) if options[:include_blank].kind_of?(String)}</option>\n" + option_tags + include_blank = options[:include_blank] if options[:include_blank].kind_of?(String) + option_tags = content_tag(:option, include_blank, :value => '').safe_concat("\n").safe_concat(option_tags) end if value.blank? && options[:prompt] prompt = options[:prompt].kind_of?(String) ? options[:prompt] : I18n.translate('helpers.select.prompt', :default => 'Please select') - option_tags = "<option value=\"\">#{ERB::Util.html_escape(prompt)}</option>\n" + option_tags + option_tags = content_tag(:option, prompt, :value => '').safe_concat("\n").safe_concat(option_tags) end - option_tags.html_safe + option_tags end end end diff --git a/actionpack/lib/action_view/helpers/tags/collection_helpers.rb b/actionpack/lib/action_view/helpers/tags/collection_helpers.rb index 6f950e552a..6a1479069f 100644 --- a/actionpack/lib/action_view/helpers/tags/collection_helpers.rb +++ b/actionpack/lib/action_view/helpers/tags/collection_helpers.rb @@ -59,6 +59,7 @@ module ActionView end end + html_options[:object] = @object html_options end diff --git a/actionpack/test/controller/routing_test.rb b/actionpack/test/controller/routing_test.rb index 807905c7b5..843ae1a813 100644 --- a/actionpack/test/controller/routing_test.rb +++ b/actionpack/test/controller/routing_test.rb @@ -147,6 +147,31 @@ class LegacyRouteSetTests < ActiveSupport::TestCase def test_star_paths_are_greedy rs.draw do + match "/*path", :to => lambda { |env| + x = env["action_dispatch.request.path_parameters"][:path] + [200, {}, [x]] + }, :format => false + end + + u = URI('http://example.org/foo/bar.html') + assert_equal u.path.sub(/^\//, ''), get(u) + end + + def test_star_paths_are_greedy_but_not_too_much + rs.draw do + match "/*path", :to => lambda { |env| + x = JSON.dump env["action_dispatch.request.path_parameters"] + [200, {}, [x]] + } + end + + expected = { "path" => "foo/bar", "format" => "html" } + u = URI('http://example.org/foo/bar.html') + assert_equal expected, JSON.parse(get(u)) + end + + def test_optional_star_paths_are_greedy + rs.draw do match "/(*filters)", :to => lambda { |env| x = env["action_dispatch.request.path_parameters"][:filters] [200, {}, [x]] @@ -157,9 +182,9 @@ class LegacyRouteSetTests < ActiveSupport::TestCase assert_equal u.path.sub(/^\//, ''), get(u) end - def test_star_paths_are_greedy_but_not_too_much + def test_optional_star_paths_are_greedy_but_not_too_much rs.draw do - match "/(*filters).:format", :to => lambda { |env| + match "/(*filters)", :to => lambda { |env| x = JSON.dump env["action_dispatch.request.path_parameters"] [200, {}, [x]] } diff --git a/actionpack/test/template/form_helper_test.rb b/actionpack/test/template/form_helper_test.rb index 3546bd3bee..63970d0a89 100644 --- a/actionpack/test/template/form_helper_test.rb +++ b/actionpack/test/template/form_helper_test.rb @@ -771,6 +771,44 @@ class FormHelperTest < ActionView::TestCase assert_dom_equal expected, output_buffer end + def test_form_for_with_collection_radio_buttons + post = Post.new + def post.active; false; end + form_for(post) do |f| + concat f.collection_radio_buttons(:active, [true, false], :to_s, :to_s) + end + + expected = whole_form("/posts", "new_post" , "new_post") do + "<input id='post_active_true' name='post[active]' type='radio' value='true' />" + + "<label for='post_active_true'>true</label>" + + "<input checked='checked' id='post_active_false' name='post[active]' type='radio' value='false' />" + + "<label for='post_active_false'>false</label>" + end + + assert_dom_equal expected, output_buffer + end + + def test_form_for_with_collection_check_boxes + post = Post.new + def post.tag_ids; [1, 3]; end + collection = (1..3).map{|i| [i, "Tag #{i}"] } + form_for(post) do |f| + concat f.collection_check_boxes(:tag_ids, collection, :first, :last) + end + + expected = whole_form("/posts", "new_post" , "new_post") do + "<input checked='checked' id='post_tag_ids_1' name='post[tag_ids][]' type='checkbox' value='1' />" + + "<label for='post_tag_ids_1'>Tag 1</label>" + + "<input id='post_tag_ids_2' name='post[tag_ids][]' type='checkbox' value='2' />" + + "<label for='post_tag_ids_2'>Tag 2</label>" + + "<input checked='checked' id='post_tag_ids_3' name='post[tag_ids][]' type='checkbox' value='3' />" + + "<label for='post_tag_ids_3'>Tag 3</label>" + + "<input name='post[tag_ids][]' type='hidden' value='' />" + end + + assert_dom_equal expected, output_buffer + end + def test_form_for_with_file_field_generate_multipart Post.send :attr_accessor, :file @@ -1999,37 +2037,6 @@ class FormHelperTest < ActionView::TestCase assert_dom_equal expected, output_buffer end - def hidden_fields(method = nil) - txt = %{<div style="margin:0;padding:0;display:inline">} - txt << %{<input name="utf8" type="hidden" value="✓" />} - if method && !method.to_s.in?(['get', 'post']) - txt << %{<input name="_method" type="hidden" value="#{method}" />} - end - txt << %{</div>} - end - - def form_text(action = "/", id = nil, html_class = nil, remote = nil, multipart = nil, method = nil) - txt = %{<form accept-charset="UTF-8" action="#{action}"} - txt << %{ enctype="multipart/form-data"} if multipart - txt << %{ data-remote="true"} if remote - txt << %{ class="#{html_class}"} if html_class - txt << %{ id="#{id}"} if id - method = method.to_s == "get" ? "get" : "post" - txt << %{ method="#{method}">} - end - - def whole_form(action = "/", id = nil, html_class = nil, options = nil) - contents = block_given? ? yield : "" - - if options.is_a?(Hash) - method, remote, multipart = options.values_at(:method, :remote, :multipart) - else - method = options - end - - form_text(action, id, html_class, remote, multipart, method) + hidden_fields(method) + contents + "</form>" - end - def test_default_form_builder old_default_form_builder, ActionView::Base.default_form_builder = ActionView::Base.default_form_builder, LabelledFormBuilder @@ -2213,6 +2220,37 @@ class FormHelperTest < ActionView::TestCase protected + def hidden_fields(method = nil) + txt = %{<div style="margin:0;padding:0;display:inline">} + txt << %{<input name="utf8" type="hidden" value="✓" />} + if method && !method.to_s.in?(['get', 'post']) + txt << %{<input name="_method" type="hidden" value="#{method}" />} + end + txt << %{</div>} + end + + def form_text(action = "/", id = nil, html_class = nil, remote = nil, multipart = nil, method = nil) + txt = %{<form accept-charset="UTF-8" action="#{action}"} + txt << %{ enctype="multipart/form-data"} if multipart + txt << %{ data-remote="true"} if remote + txt << %{ class="#{html_class}"} if html_class + txt << %{ id="#{id}"} if id + method = method.to_s == "get" ? "get" : "post" + txt << %{ method="#{method}">} + end + + def whole_form(action = "/", id = nil, html_class = nil, options = nil) + contents = block_given? ? yield : "" + + if options.is_a?(Hash) + method, remote, multipart = options.values_at(:method, :remote, :multipart) + else + method = options + end + + form_text(action, id, html_class, remote, multipart, method) + hidden_fields(method) + contents + "</form>" + end + def protect_against_forgery? false end diff --git a/activemodel/CHANGELOG.md b/activemodel/CHANGELOG.md index e4779c90d8..0d70edd0ba 100644 --- a/activemodel/CHANGELOG.md +++ b/activemodel/CHANGELOG.md @@ -2,6 +2,10 @@ * Trim down Active Model API by removing `valid?` and `errors.full_messages` *José Valim* +## Rails 3.2.1 (January 26, 2012) ## + +* No changes. + ## Rails 3.2.0 (January 20, 2012) ## * Deprecated `define_attr_method` in `ActiveModel::AttributeMethods`, because this only existed to @@ -17,6 +21,23 @@ * Provide mass_assignment_sanitizer as an easy API to replace the sanitizer behavior. Also support both :logger (default) and :strict sanitizer behavior *Bogdan Gusiev* +## Rails 3.1.3 (November 20, 2011) ## + +* No changes + +## Rails 3.1.2 (November 18, 2011) ## + +* No changes + +## Rails 3.1.1 (October 7, 2011) ## + +* Remove hard dependency on bcrypt-ruby to avoid make ActiveModel dependent on a binary library. + You must add the gem explicitly to your Gemfile if you want use ActiveModel::SecurePassword: + + gem 'bcrypt-ruby', '~> 3.0.0' + + See GH #2687. *Guillermo Iguaran* + ## Rails 3.1.0 (August 30, 2011) ## * Alternate I18n namespace lookup is no longer supported. @@ -40,12 +61,37 @@ * Add support for selectively enabling/disabling observers *Myron Marston* +## Rails 3.0.12 (unreleased) ## + +* No changes. + + +## Rails 3.0.11 (November 18, 2011) ## + +* No changes. + + +## Rails 3.0.10 (August 16, 2011) ## + +* No changes. + + +## Rails 3.0.9 (June 16, 2011) ## + +* No changes. + + +## Rails 3.0.8 (June 7, 2011) ## + +* No changes. + + ## Rails 3.0.7 (April 18, 2011) ## * No changes. -* Rails 3.0.6 (April 5, 2011) +## Rails 3.0.6 (April 5, 2011) ## * Fix when database column name has some symbolic characters (e.g. Oracle CASE# VARCHAR2(20)) #5818 #6850 *Robert Pankowecki, Santiago Pastorino* diff --git a/activerecord/CHANGELOG.md b/activerecord/CHANGELOG.md index f69f803513..cea50aaa9d 100644 --- a/activerecord/CHANGELOG.md +++ b/activerecord/CHANGELOG.md @@ -134,8 +134,11 @@ * The threshold for auto EXPLAIN is ignored if there's no logger. *fxn* +* Call `to_s` on the value passed to `table_name=`, in particular symbols + are supported (regression). *Sergey Nartimov* + * Fix possible race condition when two threads try to define attribute - methods for the same class. + methods for the same class. *Jon Leighton* ## Rails 3.2.0 (January 20, 2012) ## @@ -317,7 +320,34 @@ *Aaron Christy* -## Rails 3.1.3 (November 20, 2011) ## + ## Rails 3.1.4 (unreleased) ## + + * Fix a custom primary key regression *GH 3987* + + *Jon Leighton* + + * Perf fix (second try): don't load records for `has many :dependent => + :delete_all` *GH 3672* + + *Jon Leighton* + + * Fix accessing `proxy_association` method from an association extension + where the calls are chained. *GH #3890* + + (E.g. `post.comments.where(bla).my_proxy_method`) + + *Jon Leighton* + + * Perf fix: MySQL primary key lookup was still slow for very large + tables. *GH 3678* + + *Kenny J* + + * Perf fix: If a table has no primary key, don't repeatedly ask the database for it. + + *Julius de Bruijn* + +### Rails 3.1.3 (November 20, 2011) ## * Perf fix: If we're deleting all records in an association, don't add a IN(..) clause to the query. *GH 3672* @@ -330,7 +360,7 @@ *Christos Zisopoulos and Kenny J* -## Rails 3.1.2 (November 18, 2011) ## +### Rails 3.1.2 (November 18, 2011) ## * Fix bug with PostgreSQLAdapter#indexes. When the search path has multiple schemas, spaces were not being stripped from the schema names after the first. @@ -749,6 +779,58 @@ *Aaron Patterson* +## Rails 3.0.12 (unreleased) ## + +* No changes. + + +## Rails 3.0.11 (November 18, 2011) ## + +* Exceptions from database adapters should not lose their backtrace. + +* Backport "ActiveRecord::Persistence#touch should not use default_scope" (GH #1519) + +* Psych errors with poor yaml formatting are proxied. Fixes GH #2645 and + GH #2731 + +* Fix ActiveRecord#exists? when passsed a nil value + + +## Rails 3.0.10 (August 16, 2011) ## + +* Magic encoding comment added to schema.rb files + +* schema.rb is written as UTF-8 by default. + +* Ensuring an established connection when running `rake db:schema:dump` + +* Association conditions will not clobber join conditions. + +* Destroying a record will destroy the HABTM record before destroying itself. + GH #402. + +* Make `ActiveRecord::Batches#find_each` to not return `self`. + +* Update `table_exists?` in PG to to always use current search_path or schema if explictly set. + + +## Rails 3.0.9 (June 16, 2011) ## + +* No changes. + + +## Rails 3.0.8 (June 7, 2011) ## + +* Fix various problems with using :primary_key and :foreign_key options in conjunction with + :through associations. [Jon Leighton] + +* Correctly handle inner joins on polymorphic relationships. + +* Fixed infinity and negative infinity cases in PG date columns. + +* Creating records with invalid associations via `create` or `save` will no longer raise exceptions. + + ## Rails 3.0.7 (April 18, 2011) ## * Destroying records via nested attributes works independent of reject_if LH #6006 *Durran Jordan* diff --git a/activerecord/lib/active_record/aggregations.rb b/activerecord/lib/active_record/aggregations.rb index 5a8addc4e4..c39284539c 100644 --- a/activerecord/lib/active_record/aggregations.rb +++ b/activerecord/lib/active_record/aggregations.rb @@ -46,7 +46,7 @@ module ActiveRecord # # def <=>(other_money) # if currency == other_money.currency - # amount <=> amount + # amount <=> other_money.amount # else # amount <=> other_money.exchange_to(currency).amount # end diff --git a/activerecord/lib/active_record/autosave_association.rb b/activerecord/lib/active_record/autosave_association.rb index d468663084..4bafadc666 100644 --- a/activerecord/lib/active_record/autosave_association.rb +++ b/activerecord/lib/active_record/autosave_association.rb @@ -78,7 +78,7 @@ module ActiveRecord # When <tt>:autosave</tt> is not declared new children are saved when their parent is saved: # # class Post - # has_many :comments # :autosave option is no declared + # has_many :comments # :autosave option is not declared # end # # post = Post.new(:title => 'ruby rocks') @@ -93,7 +93,8 @@ module ActiveRecord # post.comments.create(:body => 'hello world') # post.save # => saves both post and comment # - # When <tt>:autosave</tt> is true all children is saved, no matter whether they are new records: + # When <tt>:autosave</tt> is true all children are saved, no matter whether they + # are new records or not: # # class Post # has_many :comments, :autosave => true diff --git a/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb b/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb index eec7efadc2..e33903622b 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb @@ -484,15 +484,26 @@ module ActiveRecord # Maps logical Rails types to MySQL-specific data types. def type_to_sql(type, limit = nil, precision = nil, scale = nil) - return super unless type.to_s == 'integer' - - case limit - when 1; 'tinyint' - when 2; 'smallint' - when 3; 'mediumint' - when nil, 4, 11; 'int(11)' # compatibility with MySQL default - when 5..8; 'bigint' - else raise(ActiveRecordError, "No integer type has byte size #{limit}") + case type.to_s + when 'integer' + case limit + when 1; 'tinyint' + when 2; 'smallint' + when 3; 'mediumint' + when nil, 4, 11; 'int(11)' # compatibility with MySQL default + when 5..8; 'bigint' + else raise(ActiveRecordError, "No integer type has byte size #{limit}") + end + when 'text' + case limit + when 0..0xff; 'tinytext' + when nil, 0x100..0xffff; 'text' + when 0x10000..0xffffff; 'mediumtext' + when 0x1000000..0xffffffff; 'longtext' + else raise(ActiveRecordError, "No text type has character length #{limit}") + end + else + super end end diff --git a/activerecord/test/schema/mysql2_specific_schema.rb b/activerecord/test/schema/mysql2_specific_schema.rb index ab2c7ccc10..65b6f9f227 100644 --- a/activerecord/test/schema/mysql2_specific_schema.rb +++ b/activerecord/test/schema/mysql2_specific_schema.rb @@ -1,5 +1,5 @@ ActiveRecord::Schema.define do - create_table :binary_fields, :force => true, :options => 'CHARACTER SET latin1' do |t| + create_table :binary_fields, :force => true do |t| t.binary :tiny_blob, :limit => 255 t.binary :normal_blob, :limit => 65535 t.binary :medium_blob, :limit => 16777215 @@ -32,4 +32,4 @@ CREATE TABLE collation_tests ( ) CHARACTER SET utf8 COLLATE utf8_general_ci SQL -end
\ No newline at end of file +end diff --git a/activerecord/test/schema/mysql_specific_schema.rb b/activerecord/test/schema/mysql_specific_schema.rb index a0adfe3752..7d324f98c4 100644 --- a/activerecord/test/schema/mysql_specific_schema.rb +++ b/activerecord/test/schema/mysql_specific_schema.rb @@ -1,5 +1,5 @@ ActiveRecord::Schema.define do - create_table :binary_fields, :force => true, :options => 'CHARACTER SET latin1' do |t| + create_table :binary_fields, :force => true do |t| t.binary :tiny_blob, :limit => 255 t.binary :normal_blob, :limit => 65535 t.binary :medium_blob, :limit => 16777215 diff --git a/activeresource/CHANGELOG.md b/activeresource/CHANGELOG.md index 3634f75979..e092621a33 100644 --- a/activeresource/CHANGELOG.md +++ b/activeresource/CHANGELOG.md @@ -3,6 +3,11 @@ * Adds support for PATCH requests. *dlee* +## Rails 3.2.1 (January 26, 2012) ## + +* Documentation fixes. + + ## Rails 3.2.0 (January 20, 2012) ## * Redirect responses: 303 See Other and 307 Temporary Redirect now behave like @@ -11,6 +16,21 @@ *Jim Herz* +## Rails 3.1.4 (unreleased) ## + +* No changes + + +## Rails 3.1.3 (November 20, 2011) ## + +* No changes + + +## Rails 3.1.2 (November 18, 2011) ## + +* No changes + + ## Rails 3.1.1 (October 7, 2011) ## * No changes. @@ -23,12 +43,38 @@ class User < ActiveResource::Base self.format = :xml end + +## Rails 3.0.12 (unreleased) ## + +* No changes. + + +## Rails 3.0.11 (November 18, 2011) ## + +* No changes. + + +## Rails 3.0.10 (August 16, 2011) ## + +* No changes. + + +## Rails 3.0.9 (June 16, 2011) ## + +* No changes. + + +## Rails 3.0.8 (June 7, 2011) ## + +* No Changes + + ## Rails 3.0.7 (April 18, 2011) ## * No changes. -* Rails 3.0.6 (April 5, 2011) +## Rails 3.0.6 (April 5, 2011) ## * No changes. diff --git a/activesupport/CHANGELOG.md b/activesupport/CHANGELOG.md index 3ec81e05d6..3e40e08ca2 100644 --- a/activesupport/CHANGELOG.md +++ b/activesupport/CHANGELOG.md @@ -26,9 +26,22 @@ * Unicode database updated to 6.1.0. + +## Rails 3.2.1 (January 26, 2012) ## + +* Documentation fixes and improvements. + +* Update time zone offset information. *Ravil Bayramgalin* + +* The deprecated `ActiveSupport::Base64.decode64` calls `::Base64.decode64` + now. *Jonathan Viney* + +* Fixes uninitialized constant `ActiveSupport::TaggedLogging::ERROR`. *kennyj* + + ## Rails 3.2.0 (January 20, 2012) ## -* Add ActiveSupport::Cache::NullStore for use in development and testing. *Brian Durand* +* ActiveSupport::Base64 is deprecated in favor of ::Base64. *Sergey Nartimov* * Module#synchronize is deprecated with no replacement. Please use `monitor` from ruby's standard library. @@ -97,6 +110,37 @@ * ActiveSupport::BufferedLogger#flush is deprecated. Set sync on your filehandle, or tune your filesystem. + +## Rails 3.1.4 (unreleased) ## + +* No changes + + +## Rails 3.1.3 (November 20, 2011) ## + +* No changes + + +## Rails 3.1.2 (November 18, 2011) ## + +* No changes + + +## Rails 3.1.1 (October 7, 2011) ## + +* ruby193: String#prepend is also unsafe *Akira Matsuda* + +* Fix obviously breakage of Time.=== for Time subclasses *jeremyevans* + +* Added fix so that file store does not raise an exception when cache dir does + not exist yet. This can happen if a delete_matched is called before anything + is saved in the cache. *Philippe Huibonhoa* + +* Fixed performance issue where TimeZone lookups would require tzinfo each time *Tim Lucas* + +* ActiveSupport::OrderedHash is now marked as extractable when using Array#extract_options! *Prem Sichanugrist* + + ## Rails 3.1.0 (August 30, 2011) ## * ActiveSupport::Dependencies#load and ActiveSupport::Dependencies#require now @@ -139,12 +183,38 @@ * JSON decoding now uses the multi_json gem which also vendors a json engine called OkJson. The yaml backend has been removed in favor of OkJson as a default engine for 1.8.x, while the built in 1.9.x json implementation will be used by default. *Josh Kalderimis* +## Rails 3.0.12 (unreleased) ## + +* No changes. + + +## Rails 3.0.11 (November 18, 2011) ## + +* No changes. + + +## Rails 3.0.10 (August 16, 2011) ## + +* Delayed backtrace scrubbing in `load_missing_constant` until we actually + raise the exception + + +## Rails 3.0.9 (June 16, 2011) ## + +* No changes. + + +## Rails 3.0.8 (June 7, 2011) ## + +* No changes. + + ## Rails 3.0.7 (April 18, 2011) ## * Hash.from_xml no longer loses attributes on tags containing only whitespace *André Arko* -* Rails 3.0.6 (April 5, 2011) +## Rails 3.0.6 (April 5, 2011) ## * No changes. diff --git a/activesupport/lib/active_support/core_ext/file/atomic.rb b/activesupport/lib/active_support/core_ext/file/atomic.rb index 3645597301..fd1633ff45 100644 --- a/activesupport/lib/active_support/core_ext/file/atomic.rb +++ b/activesupport/lib/active_support/core_ext/file/atomic.rb @@ -16,7 +16,7 @@ class File require 'tempfile' unless defined?(Tempfile) require 'fileutils' unless defined?(FileUtils) - temp_file = Tempfile.new(basename(file_name), temp_dir) + temp_file = Tempfile.new(basename(file_name), temp_dir, :binmode => true) yield temp_file temp_file.close diff --git a/railties/CHANGELOG.md b/railties/CHANGELOG.md index a5f32d1a2c..f556ee210d 100644 --- a/railties/CHANGELOG.md +++ b/railties/CHANGELOG.md @@ -19,6 +19,15 @@ * Rails::Plugin has gone. Instead of adding plugins to vendor/plugins use gems or bundler with path or git dependencies. *Santiago Pastorino* + +## Rails 3.2.1 (January 26, 2012) ## + +* Documentation fixes. + +* Migration generation understands decimal{1.2} and decimal{1-2}, in + addition to decimal{1,2}. *José Valim* + + ## Rails 3.2.0 (January 20, 2012) ## * Turn gem has been removed from default Gemfile. We still looking for a best presentation for tests output. *Guillermo Iguaran* @@ -62,6 +71,22 @@ * Remove old 'config.paths.app.controller' API in favor of 'config.paths["app/controller"]' API *Guillermo Iguaran* +## Rails 3.1.4 (unreleased) ## + +* Setting config.force_ssl also marks the session cookie as secure. + + *José Valim* + +* Add therubyrhino to Gemfile in new applications when running under JRuby. + + *Guillermo Iguaran* + + +## Rails 3.1.3 (November 20, 2011) ## + +* New apps should be generated with a sass-rails dependency of 3.1.5, not 3.1.5.rc.2 + + ## Rails 3.1.2 (November 18, 2011) ## * Engines: don't blow up if db/seeds.rb is missing. @@ -178,12 +203,37 @@ * Include all helpers from plugins and shared engines in application *Piotr Sarnacki* +## Rails 3.0.12 (unreleased) ## + +* No changes. + + +## Rails 3.0.11 (November 18, 2011) ## + +* Updated Prototype UJS to lastest version fixing multiples errors in IE [Guillermo Iguaran] + + +## Rails 3.0.10 (August 16, 2011) ## + +* No changes. + + +## Rails 3.0.9 (June 16, 2011) ## + +* No changes. + + +## Rails 3.0.8 (June 7, 2011) ## + +* Fix Rake 0.9.0 support. + + ## Rails 3.0.7 (April 18, 2011) ## * No changes. -* Rails 3.0.6 (April 5, 2011) +## Rails 3.0.6 (April 5, 2011) ## * No changes. diff --git a/railties/guides/code/getting_started/config/database.yml b/railties/guides/code/getting_started/config/database.yml index 51a4dd459d..32a998ad72 100644 --- a/railties/guides/code/getting_started/config/database.yml +++ b/railties/guides/code/getting_started/config/database.yml @@ -6,7 +6,9 @@ development: adapter: sqlite3 database: db/development.sqlite3 - pool: 5 + # Maximum number of database connections available per process. Please + # increase this number in multithreaded applications. + pool: 1 timeout: 5000 # Warning: The database defined as "test" will be erased and @@ -15,11 +17,15 @@ development: test: adapter: sqlite3 database: db/test.sqlite3 - pool: 5 + # Maximum number of database connections available per process. Please + # increase this number in multithreaded applications. + pool: 1 timeout: 5000 production: adapter: sqlite3 database: db/production.sqlite3 - pool: 5 + # Maximum number of database connections available per process. Please + # increase this number in multithreaded applications. + pool: 1 timeout: 5000 diff --git a/railties/guides/source/command_line.textile b/railties/guides/source/command_line.textile index fe4a84dae9..8ae8c61ae6 100644 --- a/railties/guides/source/command_line.textile +++ b/railties/guides/source/command_line.textile @@ -521,7 +521,9 @@ development: adapter: postgresql encoding: unicode database: gitapp_development - pool: 5 + # Maximum number of database connections available per process. Please + # increase this number in multithreaded applications. + pool: 1 username: gitapp password: ... diff --git a/railties/guides/source/configuring.textile b/railties/guides/source/configuring.textile index 316a7e2bb6..e796f44606 100644 --- a/railties/guides/source/configuring.textile +++ b/railties/guides/source/configuring.textile @@ -649,3 +649,23 @@ The error occurred while evaluating nil.each *+set_routes_reloader+* Configures Action Dispatch to reload the routes file using +ActionDispatch::Callbacks.to_prepare+. *+disable_dependency_loading+* Disables the automatic dependency loading if the +config.cache_classes+ is set to true and +config.dependency_loading+ is set to false. + +h3. Database pooling + +Active Record database connections are managed by +ActiveRecord::ConnectionAdapters::ConnectionPool+ which ensures that a connection pool synchronizes the amount of thread access to a limited number of database connections. This limit defaults to 1 and can be configured in +database.yml+. + +<ruby> +development: + adapter: sqlite3 + database: db/development.sqlite3 + # Maximum number of database connections available per process. Please + # increase this number in multithreaded applications. + pool: 1 + timeout: 5000 +</ruby> + +Since the connection pooling is handled inside of Active Record by default, all application servers (Thin, Mongrel, Unicorn etc.) should behave the same. Initially, the database connection pool is empty and it will create additional connections as the demand for them increases, until it reaches the connection pool limit. + +Any one request will check out a connection the first time it requires access to the database, after which it will check the connection back in, at the end of the request, meaning that the additional connection slot will be available again for the next request in the queue. + +NOTE. If you have enabled +Rails.threadsafe!+ mode then there could be a chance that several threads may be accessing multiple connections simultaneously. So depending on your current request load, you could very well have multiple threads contending for a limited amount of connections. diff --git a/railties/guides/source/documents.yaml b/railties/guides/source/documents.yaml index 6a47959c3d..08aafda288 100644 --- a/railties/guides/source/documents.yaml +++ b/railties/guides/source/documents.yaml @@ -136,6 +136,11 @@ name: Release Notes documents: - + name: Upgrading Ruby on Rails + url: upgrading_ruby_on_rails.html + work_in_progress: true + description: This guide helps in upgrading applications to latest Ruby on Rails versions. + - name: Ruby on Rails 3.2 Release Notes url: 3_2_release_notes.html description: Release notes for Rails 3.2. diff --git a/railties/guides/source/getting_started.textile b/railties/guides/source/getting_started.textile index bed14ef6a8..d6f3c3e217 100644 --- a/railties/guides/source/getting_started.textile +++ b/railties/guides/source/getting_started.textile @@ -329,7 +329,9 @@ environment: development: adapter: sqlite3 database: db/development.sqlite3 - pool: 5 + # Maximum number of database connections available per process. Please + # increase this number in multithreaded applications. + pool: 1 timeout: 5000 </yaml> @@ -350,7 +352,9 @@ development: adapter: mysql2 encoding: utf8 database: blog_development - pool: 5 + # Maximum number of database connections available per process. Please + # increase this number in multithreaded applications. + pool: 1 username: root password: socket: /tmp/mysql.sock @@ -370,7 +374,9 @@ development: adapter: postgresql encoding: unicode database: blog_development - pool: 5 + # Maximum number of database connections available per process. Please + # increase this number in multithreaded applications. + pool: 1 username: blog password: </yaml> diff --git a/railties/guides/source/upgrading_ruby_on_rails.textile b/railties/guides/source/upgrading_ruby_on_rails.textile new file mode 100644 index 0000000000..3588a67196 --- /dev/null +++ b/railties/guides/source/upgrading_ruby_on_rails.textile @@ -0,0 +1,164 @@ +h2. A Guide for Upgrading Ruby on Rails + +This guide provides steps to be followed when you upgrade your applications to a newer version of Ruby on Rails. These steps are also available in individual release guides. + +endprologue. + +h3. Rails Upgrades + +When you're upgrading an existing application, it's always a great idea to have good test coverage before going in. Rails 3 and above 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.x will be the last branch to support 1.8.7 and Rails 4 (current edge) will support only Ruby 1.9.3. + +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. Upgrading from Rails 3.1 to Rails 3.2 + +We recommend that you 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. + +The following changes are meant for upgrading your application to Rails 3.2.1, the latest 3.2.x version of Rails. + +h4(#gemfile3_2). Gemfile + +Make the following changes to your +Gemfile+. + +<ruby> +gem 'rails', '= 3.2.1' + +group :assets do + gem 'sass-rails', '~> 3.2.3' + gem 'coffee-rails', '~> 3.2.1' + gem 'uglifier', '>= 1.0.3' +end +</ruby> + +h4(#config_dev3_2). config/environments/development.rb + +* There are a couple of new configuration changes you'd want to add: + +<ruby> +# Raise exception on mass assignment protection for Active Record models +config.active_record.mass_assignment_sanitizer = :strict + +# Log the query plan for queries taking more than this (works +# with SQLite, MySQL, and PostgreSQL) +config.active_record.auto_explain_threshold_in_seconds = 0.5 +</ruby> + +h4(#config_test3_2). config/environments/test.rb + +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(#plugins3_2). vendor/plugins + +* 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>. + +h3. Upgrading from Rails 3.0 to Rails 3.1 + +We recommend that you first upgrade to Rails 3.0 in case you haven't and make sure your application still runs as expected before attempting an update to Rails 3.1. + +The following changes are meant for upgrading your application to Rails 3.1.3, the latest 3.1.x version of Rails. + +h4(#gemfile3_1). 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> + +h4(#config_app3_1). config/application.rb + +* The asset pipeline requires the following additions: + +<ruby> +config.assets.enabled = true +config.assets.version = '1.0' +</ruby> + +* If your application is using the "/assets" route for a resource you may want change the prefix used for assets to avoid conflicts: + +<ruby> +# Defaults to '/assets' +config.assets.prefix = '/asset-files' +</ruby> + +h4(#config_dev3_1). 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> + +h4(#config_prod3_1). 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> + +h4(#config_test3_1). 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> + +h4(#config_wp3_1). 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> diff --git a/railties/lib/rails/generators/rails/app/templates/config/databases/mysql.yml b/railties/lib/rails/generators/rails/app/templates/config/databases/mysql.yml index c3349912aa..950016ad92 100644 --- a/railties/lib/rails/generators/rails/app/templates/config/databases/mysql.yml +++ b/railties/lib/rails/generators/rails/app/templates/config/databases/mysql.yml @@ -12,7 +12,9 @@ development: adapter: mysql2 encoding: utf8 database: <%= app_name %>_development - pool: 5 + # Maximum number of database connections available per process. Please + # increase this number in multithreaded applications. + pool: 1 username: root password: <% if mysql_socket -%> @@ -28,7 +30,9 @@ test: adapter: mysql2 encoding: utf8 database: <%= app_name %>_test - pool: 5 + # Maximum number of database connections available per process. Please + # increase this number in multithreaded applications. + pool: 1 username: root password: <% if mysql_socket -%> @@ -41,7 +45,9 @@ production: adapter: mysql2 encoding: utf8 database: <%= app_name %>_production - pool: 5 + # Maximum number of database connections available per process. Please + # increase this number in multithreaded applications. + pool: 1 username: root password: <% if mysql_socket -%> diff --git a/railties/lib/rails/generators/rails/app/templates/config/databases/postgresql.yml b/railties/lib/rails/generators/rails/app/templates/config/databases/postgresql.yml index f08f86aac3..a8ed15c2dc 100644 --- a/railties/lib/rails/generators/rails/app/templates/config/databases/postgresql.yml +++ b/railties/lib/rails/generators/rails/app/templates/config/databases/postgresql.yml @@ -16,7 +16,9 @@ development: adapter: postgresql encoding: unicode database: <%= app_name %>_development - pool: 5 + # Maximum number of database connections available per process. Please + # increase this number in multithreaded applications. + pool: 1 username: <%= app_name %> password: @@ -42,7 +44,9 @@ test: adapter: postgresql encoding: unicode database: <%= app_name %>_test - pool: 5 + # Maximum number of database connections available per process. Please + # increase this number in multithreaded applications. + pool: 1 username: <%= app_name %> password: @@ -50,6 +54,8 @@ production: adapter: postgresql encoding: unicode database: <%= app_name %>_production - pool: 5 + # Maximum number of database connections available per process. Please + # increase this number in multithreaded applications. + pool: 1 username: <%= app_name %> password: diff --git a/railties/lib/rails/generators/rails/app/templates/config/databases/sqlite3.yml b/railties/lib/rails/generators/rails/app/templates/config/databases/sqlite3.yml index 51a4dd459d..32a998ad72 100644 --- a/railties/lib/rails/generators/rails/app/templates/config/databases/sqlite3.yml +++ b/railties/lib/rails/generators/rails/app/templates/config/databases/sqlite3.yml @@ -6,7 +6,9 @@ development: adapter: sqlite3 database: db/development.sqlite3 - pool: 5 + # Maximum number of database connections available per process. Please + # increase this number in multithreaded applications. + pool: 1 timeout: 5000 # Warning: The database defined as "test" will be erased and @@ -15,11 +17,15 @@ development: test: adapter: sqlite3 database: db/test.sqlite3 - pool: 5 + # Maximum number of database connections available per process. Please + # increase this number in multithreaded applications. + pool: 1 timeout: 5000 production: adapter: sqlite3 database: db/production.sqlite3 - pool: 5 + # Maximum number of database connections available per process. Please + # increase this number in multithreaded applications. + pool: 1 timeout: 5000 diff --git a/railties/lib/rails/generators/rails/plugin_new/templates/Rakefile b/railties/lib/rails/generators/rails/plugin_new/templates/Rakefile index 6ed6adcf1b..b7bc69d2e5 100755 --- a/railties/lib/rails/generators/rails/plugin_new/templates/Rakefile +++ b/railties/lib/rails/generators/rails/plugin_new/templates/Rakefile @@ -4,13 +4,8 @@ begin rescue LoadError puts 'You must `gem install bundler` and `bundle install` to run rake tasks' end -begin - require 'rdoc/task' -rescue LoadError - require 'rdoc/rdoc' - require 'rake/rdoctask' - RDoc::Task = Rake::RDocTask -end + +require 'rdoc/task' RDoc::Task.new(:rdoc) do |rdoc| rdoc.rdoc_dir = 'rdoc' diff --git a/railties/lib/rails/tasks/documentation.rake b/railties/lib/rails/tasks/documentation.rake index e09379c8c2..cec346d86b 100644 --- a/railties/lib/rails/tasks/documentation.rake +++ b/railties/lib/rails/tasks/documentation.rake @@ -1,10 +1,4 @@ -begin - require 'rdoc/task' -rescue LoadError - require 'rdoc/rdoc' - require 'rake/rdoctask' - RDoc::Task = Rake::RDocTask -end +require 'rdoc/task' # Monkey-patch to remove redoc'ing and clobber descriptions to cut down on rake -T noise class RDocTaskWithoutDescriptions < RDoc::Task |