From 8df7fe3f630e13da1585c151f6f2f986ea7dcdfd Mon Sep 17 00:00:00 2001 From: Alexey Vakhov Date: Mon, 3 Oct 2011 12:05:25 +0400 Subject: normalize arg for ActionView::TestCase tests method --- actionpack/lib/action_view/test_case.rb | 7 ++++++- actionpack/test/template/test_test.rb | 16 ++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) (limited to 'actionpack') diff --git a/actionpack/lib/action_view/test_case.rb b/actionpack/lib/action_view/test_case.rb index c4d51d7946..7df95b0cb0 100644 --- a/actionpack/lib/action_view/test_case.rb +++ b/actionpack/lib/action_view/test_case.rb @@ -50,7 +50,12 @@ module ActionView module ClassMethods def tests(helper_class) - self.helper_class = helper_class + case helper_class + when String, Symbol + self.helper_class = "#{helper_class.to_s.underscore}_helper".camelize.safe_constantize + when Module + self.helper_class = helper_class + end end def determine_default_helper_class(name) diff --git a/actionpack/test/template/test_test.rb b/actionpack/test/template/test_test.rb index bf789cd8b7..adcbf1447f 100644 --- a/actionpack/test/template/test_test.rb +++ b/actionpack/test/template/test_test.rb @@ -62,3 +62,19 @@ class CrazyHelperTest < ActionView::TestCase assert_equal PeopleHelper, self.class.helper_class end end + +class CrazySymbolHelperTest < ActionView::TestCase + tests :people + + def test_set_helper_class_using_symbol + assert_equal PeopleHelper, self.class.helper_class + end +end + +class CrazyStringHelperTest < ActionView::TestCase + tests 'people' + + def test_set_helper_class_using_string + assert_equal PeopleHelper, self.class.helper_class + end +end -- cgit v1.2.3 From fd8f0b297822ba36002084faa36bd0320d3be4a7 Mon Sep 17 00:00:00 2001 From: Santiago Pastorino Date: Wed, 5 Oct 2011 15:41:28 -0200 Subject: stylesheet_link_tag('/stylesheets/application') and similar helpers doesn't throw Sprockets::FileOutsidePaths exception anymore --- actionpack/lib/sprockets/helpers/rails_helper.rb | 2 ++ actionpack/test/template/sprockets_helper_test.rb | 5 +++++ 2 files changed, 7 insertions(+) (limited to 'actionpack') diff --git a/actionpack/lib/sprockets/helpers/rails_helper.rb b/actionpack/lib/sprockets/helpers/rails_helper.rb index f866bc626e..ddf9b08b54 100644 --- a/actionpack/lib/sprockets/helpers/rails_helper.rb +++ b/actionpack/lib/sprockets/helpers/rails_helper.rb @@ -123,6 +123,8 @@ module Sprockets return nil if is_uri?(source) source = rewrite_extension(source, nil, ext) asset_environment[source] + rescue Sprockets::FileOutsidePaths + nil end def digest_for(logical_path) diff --git a/actionpack/test/template/sprockets_helper_test.rb b/actionpack/test/template/sprockets_helper_test.rb index 08b66fec8b..db69f95130 100644 --- a/actionpack/test/template/sprockets_helper_test.rb +++ b/actionpack/test/template/sprockets_helper_test.rb @@ -219,6 +219,8 @@ class SprocketsHelperTest < ActionView::TestCase @config.assets.compile = true @config.assets.debug = true + assert_match %r{}, + javascript_include_tag('/javascripts/application') assert_match %r{\n}, javascript_include_tag(:application) end @@ -264,6 +266,9 @@ class SprocketsHelperTest < ActionView::TestCase @config.assets.compile = true @config.assets.debug = true + assert_match %r{}, + stylesheet_link_tag('/stylesheets/application') + assert_match %r{\n}, stylesheet_link_tag(:application) -- cgit v1.2.3 From d42d97d2e3f0bdef2163cc14daa181903e0b198d Mon Sep 17 00:00:00 2001 From: Alexey Vakhov Date: Thu, 6 Oct 2011 10:39:37 +0400 Subject: Fix comment in AbstractController callbacks --- actionpack/lib/abstract_controller/callbacks.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'actionpack') diff --git a/actionpack/lib/abstract_controller/callbacks.rb b/actionpack/lib/abstract_controller/callbacks.rb index 14c984e41f..7004e607a1 100644 --- a/actionpack/lib/abstract_controller/callbacks.rb +++ b/actionpack/lib/abstract_controller/callbacks.rb @@ -177,7 +177,7 @@ module AbstractController def prepend_#{filter}_filter(*names, &blk) # def prepend_before_filter(*names, &blk) _insert_callbacks(names, blk) do |name, options| # _insert_callbacks(names, blk) do |name, options| options[:if] = (Array.wrap(options[:if]) << "!halted") if #{filter == :after} # options[:if] = (Array.wrap(options[:if]) << "!halted") if false - set_callback(:process_action, :#{filter}, name, options.merge(:prepend => true)) # set_callback(:process_action, :#{filter}, name, options.merge(:prepend => true)) + set_callback(:process_action, :#{filter}, name, options.merge(:prepend => true)) # set_callback(:process_action, :before, name, options.merge(:prepend => true)) end # end end # end @@ -185,7 +185,7 @@ module AbstractController # for details on the allowed parameters. def skip_#{filter}_filter(*names, &blk) # def skip_before_filter(*names, &blk) _insert_callbacks(names, blk) do |name, options| # _insert_callbacks(names, blk) do |name, options| - skip_callback(:process_action, :#{filter}, name, options) # skip_callback(:process_action, :#{filter}, name, options) + skip_callback(:process_action, :#{filter}, name, options) # skip_callback(:process_action, :before, name, options) end # end end # end -- cgit v1.2.3 From 99888487b63b313ea4495edd24b666fc5a3c8fe0 Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Thu, 6 Oct 2011 11:06:38 -0700 Subject: fix require --- actionpack/lib/action_dispatch/routing/route_set.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'actionpack') diff --git a/actionpack/lib/action_dispatch/routing/route_set.rb b/actionpack/lib/action_dispatch/routing/route_set.rb index e921269331..bc956ef216 100644 --- a/actionpack/lib/action_dispatch/routing/route_set.rb +++ b/actionpack/lib/action_dispatch/routing/route_set.rb @@ -1,4 +1,4 @@ -require 'journey/router' +require 'journey' require 'forwardable' require 'active_support/core_ext/object/blank' require 'active_support/core_ext/object/to_query' -- cgit v1.2.3 From 0d3d9a150a4ba1084cf28fd26be2a154f4540952 Mon Sep 17 00:00:00 2001 From: Vijay Dev Date: Fri, 7 Oct 2011 23:53:12 +0530 Subject: closes #3241 - partial doc fix --- actionpack/lib/action_view/helpers/rendering_helper.rb | 4 ++-- actionpack/lib/action_view/renderer/partial_renderer.rb | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'actionpack') diff --git a/actionpack/lib/action_view/helpers/rendering_helper.rb b/actionpack/lib/action_view/helpers/rendering_helper.rb index 47efdded42..626e1a1ab7 100644 --- a/actionpack/lib/action_view/helpers/rendering_helper.rb +++ b/actionpack/lib/action_view/helpers/rendering_helper.rb @@ -8,7 +8,7 @@ module ActionView module RenderingHelper # Returns the result of a render that's dictated by the options hash. The primary options are: # - # * :partial - See ActionView::Partials. + # * :partial - See ActionView::PartialRenderer. # * :file - Renders an explicit template file (this used to be the old default), add :locals to pass in those. # * :inline - Renders an inline template similar to how it's done in the controller. # * :text - Renders the text passed in out. @@ -87,4 +87,4 @@ module ActionView end end end -end \ No newline at end of file +end diff --git a/actionpack/lib/action_view/renderer/partial_renderer.rb b/actionpack/lib/action_view/renderer/partial_renderer.rb index e808fa3415..15cb9d0f76 100644 --- a/actionpack/lib/action_view/renderer/partial_renderer.rb +++ b/actionpack/lib/action_view/renderer/partial_renderer.rb @@ -27,7 +27,7 @@ module ActionView # # == The :as and :object options # - # By default ActionView::Partials::PartialRenderer doesn't have any local variables. + # By default ActionView::PartialRenderer doesn't have any local variables. # The :object option can be used to pass an object to the partial. For instance: # # <%= render :partial => "account", :object => @buyer %> -- cgit v1.2.3 From 7f64e472772293a3a5bbf4a435d937dabd98ed92 Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Fri, 7 Oct 2011 16:56:18 -0700 Subject: just check to see that the first item in the list is an array --- actionpack/lib/action_view/helpers/form_options_helper.rb | 2 +- actionpack/test/template/form_options_helper_test.rb | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) (limited to 'actionpack') diff --git a/actionpack/lib/action_view/helpers/form_options_helper.rb b/actionpack/lib/action_view/helpers/form_options_helper.rb index c677257d60..d636702111 100644 --- a/actionpack/lib/action_view/helpers/form_options_helper.rb +++ b/actionpack/lib/action_view/helpers/form_options_helper.rb @@ -579,7 +579,7 @@ module ActionView def to_select_tag(choices, options, html_options) selected_value = options.has_key?(:selected) ? options[:selected] : value(object) - if !choices.empty? && choices.try(:first).try(:second).respond_to?(:each) + if !choices.empty? && Array === choices.first option_tags = grouped_options_for_select(choices, :selected => selected_value, :disabled => options[:disabled]) else option_tags = options_for_select(choices, :selected => selected_value, :disabled => options[:disabled]) diff --git a/actionpack/test/template/form_options_helper_test.rb b/actionpack/test/template/form_options_helper_test.rb index 6aea991f7c..d3e0cc41a9 100644 --- a/actionpack/test/template/form_options_helper_test.rb +++ b/actionpack/test/template/form_options_helper_test.rb @@ -587,6 +587,15 @@ class FormOptionsHelperTest < ActionView::TestCase ) end + def test_empty + @post = Post.new + @post.category = "" + assert_dom_equal( + "", + select("post", "category", [], :prompt => true, :include_blank => true) + ) + end + def test_select_with_selected_value @post = Post.new @post.category = "" -- cgit v1.2.3 From 22b6e829dc9f07036399e52f0d352e6723c1113b Mon Sep 17 00:00:00 2001 From: Alexey Vakhov Date: Sat, 8 Oct 2011 10:12:58 +0400 Subject: Fix params hash example in AC::Base comment --- actionpack/lib/action_controller/base.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'actionpack') diff --git a/actionpack/lib/action_controller/base.rb b/actionpack/lib/action_controller/base.rb index da93c988c4..98bfe72fef 100644 --- a/actionpack/lib/action_controller/base.rb +++ b/actionpack/lib/action_controller/base.rb @@ -50,7 +50,7 @@ module ActionController # # All request parameters, whether they come from a GET or POST request, or from the URL, are available through the params method # which returns a hash. For example, an action that was performed through /posts?category=All&limit=5 will include - # { "category" => "All", "limit" => 5 } in params. + # { "category" => "All", "limit" => "5" } in params. # # It's also possible to construct multi-dimensional parameter hashes by specifying keys using brackets, such as: # -- cgit v1.2.3 From a4515b60e316d52a6ac2902886b117588702e20b Mon Sep 17 00:00:00 2001 From: Alexey Vakhov Date: Sat, 8 Oct 2011 11:01:31 +0400 Subject: Remove unnecessary dup in expire_page --- actionpack/lib/action_controller/caching/pages.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'actionpack') diff --git a/actionpack/lib/action_controller/caching/pages.rb b/actionpack/lib/action_controller/caching/pages.rb index 496390402b..957bb7de6b 100644 --- a/actionpack/lib/action_controller/caching/pages.rb +++ b/actionpack/lib/action_controller/caching/pages.rb @@ -122,7 +122,7 @@ module ActionController #:nodoc: if options.is_a?(Hash) if options[:action].is_a?(Array) - options[:action].dup.each do |action| + options[:action].each do |action| self.class.expire_page(url_for(options.merge(:only_path => true, :action => action))) end else -- cgit v1.2.3 From d68f27e9b184a8e7e4ce71db11874a6b36ea1edc Mon Sep 17 00:00:00 2001 From: Ben Scheirman Date: Sat, 8 Oct 2011 18:38:02 -0500 Subject: accept optional :host parameter to force_ssl --- .../lib/action_controller/metal/force_ssl.rb | 7 +++++-- actionpack/test/controller/force_ssl_test.rb | 22 +++++++++++++++++++++- 2 files changed, 26 insertions(+), 3 deletions(-) (limited to 'actionpack') diff --git a/actionpack/lib/action_controller/metal/force_ssl.rb b/actionpack/lib/action_controller/metal/force_ssl.rb index ed693c5967..0fd42f9d8a 100644 --- a/actionpack/lib/action_controller/metal/force_ssl.rb +++ b/actionpack/lib/action_controller/metal/force_ssl.rb @@ -24,12 +24,15 @@ module ActionController # * only - The callback should be run only for this action # * except - The callback should be run for all actions except this action def force_ssl(options = {}) + host = options.delete(:host) before_filter(options) do if !request.ssl? && !Rails.env.development? - redirect_to :protocol => 'https://', :status => :moved_permanently + redirect_options = {:protocol => 'https://', :status => :moved_permanently} + redirect_options.merge!(:host => host) if host + redirect_to redirect_options end end end end end -end \ No newline at end of file +end diff --git a/actionpack/test/controller/force_ssl_test.rb b/actionpack/test/controller/force_ssl_test.rb index 3e723e20d9..43b20fdead 100644 --- a/actionpack/test/controller/force_ssl_test.rb +++ b/actionpack/test/controller/force_ssl_test.rb @@ -14,6 +14,10 @@ class ForceSSLControllerLevel < ForceSSLController force_ssl end +class ForceSSLCustomDomain < ForceSSLController + force_ssl :host => "secure.test.host" +end + class ForceSSLOnlyAction < ForceSSLController force_ssl :only => :cheeseburger end @@ -38,6 +42,22 @@ class ForceSSLControllerLevelTest < ActionController::TestCase end end +class ForceSSLCustomDomainTest < ActionController::TestCase + tests ForceSSLCustomDomain + + def test_banana_redirects_to_https_with_custom_host + get :banana + assert_response 301 + assert_equal "https://secure.test.host/force_ssl_custom_domain/banana", redirect_to_url + end + + def test_cheeseburger_redirects_to_https_with_custom_host + get :cheeseburger + assert_response 301 + assert_equal "https://secure.test.host/force_ssl_custom_domain/cheeseburger", redirect_to_url + end +end + class ForceSSLOnlyActionTest < ActionController::TestCase tests ForceSSLOnlyAction @@ -80,4 +100,4 @@ class ForceSSLExcludeDevelopmentTest < ActionController::TestCase get :banana assert_response 200 end -end \ No newline at end of file +end -- cgit v1.2.3 From 114218e4da9a2adf7b6ef4a27d2fa47e15881cf1 Mon Sep 17 00:00:00 2001 From: Liborio Cannici Date: Thu, 15 Sep 2011 00:35:53 +0200 Subject: Fixes an issue when creating a date select with too many options. Inspired by dlt https://github.com/dlt/rails/commit/9e615634745dc81598e7b880d52411338d3a7a93 Closes #239. Conflicts: actionpack/CHANGELOG --- actionpack/CHANGELOG | 6 ++++++ actionpack/lib/action_view/helpers/date_helper.rb | 15 ++++++++++----- actionpack/test/template/date_helper_test.rb | 9 +++++++++ 3 files changed, 25 insertions(+), 5 deletions(-) (limited to 'actionpack') diff --git a/actionpack/CHANGELOG b/actionpack/CHANGELOG index e8c619723f..29992a36b1 100644 --- a/actionpack/CHANGELOG +++ b/actionpack/CHANGELOG @@ -1,5 +1,11 @@ *Rails 3.2.0 (unreleased)* +* Limit the number of options for select_year to 1000. + + Pass the :max_years_allowed option to set your own limit. + + [Libo Cannici] + * Passing formats or handlers to render :template and friends is deprecated. For example: [Nick Sutterer & José Valim] render :template => "foo.html.erb" diff --git a/actionpack/lib/action_view/helpers/date_helper.rb b/actionpack/lib/action_view/helpers/date_helper.rb index e850c258ce..4deb87180c 100644 --- a/actionpack/lib/action_view/helpers/date_helper.rb +++ b/actionpack/lib/action_view/helpers/date_helper.rb @@ -765,11 +765,16 @@ module ActionView if @options[:use_hidden] || @options[:discard_year] build_hidden(:year, val) else - options = {} - options[:start] = @options[:start_year] || middle_year - 5 - options[:end] = @options[:end_year] || middle_year + 5 - options[:step] = options[:start] < options[:end] ? 1 : -1 - options[:leading_zeros] = false + options = {} + options[:start] = @options[:start_year] || middle_year - 5 + options[:end] = @options[:end_year] || middle_year + 5 + options[:step] = options[:start] < options[:end] ? 1 : -1 + options[:leading_zeros] = false + options[:max_years_allowed] = @options[:max_years_allowed] || 1000 + + if (options[:end] - options[:start]).abs > options[:max_years_allowed] + raise ArgumentError, "There're too many years options to be built. Are you sure you haven't mistyped something? You can provide the :max_years_allowed parameter" + end build_options_and_select(:year, val, options) end diff --git a/actionpack/test/template/date_helper_test.rb b/actionpack/test/template/date_helper_test.rb index 09c53a36f0..af30ec9892 100644 --- a/actionpack/test/template/date_helper_test.rb +++ b/actionpack/test/template/date_helper_test.rb @@ -664,6 +664,15 @@ class DateHelperTest < ActionView::TestCase assert_dom_equal expected, select_date(Time.mktime(2003, 8, 16), :start_year => 2003, :end_year => 2005, :prefix => "date[first]") end + def test_select_date_with_too_big_range_between_start_year_and_end_year + assert_raise(ArgumentError) { select_date(Time.mktime(2003, 8, 16), :start_year => 2000, :end_year => 20000, :prefix => "date[first]", :order => [:month, :day, :year]) } + assert_raise(ArgumentError) { select_date(Time.mktime(2003, 8, 16), :start_year => Date.today.year - 100.years, :end_year => 2000, :prefix => "date[first]", :order => [:month, :day, :year]) } + end + + def test_select_date_can_have_more_then_1000_years_interval_if_forced_via_parameter + assert_nothing_raised { select_date(Time.mktime(2003, 8, 16), :start_year => 2000, :end_year => 3100, :max_years_allowed => 2000) } + end + def test_select_date_with_order expected = %(\n\n\n\n", + select("post", "category", [["Number", "number"], ["Text", "text"], ["Yes/No", "boolean"]], :prompt => true, :include_blank => true) + ) + end + def test_select_with_selected_value @post = Post.new @post.category = "" -- cgit v1.2.3 From 80768b739ed7e2053d85a01dd5fa60bde67aad9a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Wed, 26 Oct 2011 09:31:56 +0200 Subject: Responders now return 204 No Content for API requests without a response body (as in the new scaffold) --- actionpack/CHANGELOG | 2 ++ .../lib/action_controller/metal/responder.rb | 22 +--------------------- actionpack/test/controller/mime_responds_test.rb | 20 ++++++++++---------- 3 files changed, 13 insertions(+), 31 deletions(-) (limited to 'actionpack') diff --git a/actionpack/CHANGELOG b/actionpack/CHANGELOG index e7886facb9..a7a47bf930 100644 --- a/actionpack/CHANGELOG +++ b/actionpack/CHANGELOG @@ -1,5 +1,7 @@ *Rails 3.2.0 (unreleased)* +* Responders now return 204 No Content for API requests without a response body (as in the new scaffold) [José Valim] + * Added ActionDispatch::RequestId middleware that'll make a unique X-Request-Id header available to the response and enables the ActionDispatch::Request#uuid method. This makes it easy to trace requests from end-to-end in the stack and to identify individual requests in mixed logs like Syslog [DHH] * Limit the number of options for select_year to 1000. diff --git a/actionpack/lib/action_controller/metal/responder.rb b/actionpack/lib/action_controller/metal/responder.rb index c7827309dd..b932302a60 100644 --- a/actionpack/lib/action_controller/metal/responder.rb +++ b/actionpack/lib/action_controller/metal/responder.rb @@ -202,10 +202,8 @@ module ActionController #:nodoc: display resource elsif post? display resource, :status => :created, :location => api_location - elsif has_empty_resource_definition? - display empty_resource, :status => :ok else - head :ok + head :no_content end end @@ -269,24 +267,6 @@ module ActionController #:nodoc: @action ||= ACTIONS_FOR_VERBS[request.request_method_symbol] end - # Check whether resource needs a specific definition of empty resource to be valid - # - def has_empty_resource_definition? - respond_to?("empty_#{format}_resource") - end - - # Delegate to proper empty resource method - # - def empty_resource - send("empty_#{format}_resource") - end - - # Return a valid empty JSON resource - # - def empty_json_resource - "{}" - end - def resource_errors respond_to?("#{format}_resource_errors") ? send("#{format}_resource_errors") : resource.errors end diff --git a/actionpack/test/controller/mime_responds_test.rb b/actionpack/test/controller/mime_responds_test.rb index e91e11a8a7..76a8c89e60 100644 --- a/actionpack/test/controller/mime_responds_test.rb +++ b/actionpack/test/controller/mime_responds_test.rb @@ -796,21 +796,21 @@ class RespondWithControllerTest < ActionController::TestCase end end - def test_using_resource_for_put_with_xml_yields_ok_on_success + def test_using_resource_for_put_with_xml_yields_no_content_on_success @request.accept = "application/xml" put :using_resource assert_equal "application/xml", @response.content_type - assert_equal 200, @response.status + assert_equal 204, @response.status assert_equal " ", @response.body end - def test_using_resource_for_put_with_json_yields_ok_on_success + def test_using_resource_for_put_with_json_yields_no_content_on_success Customer.any_instance.stubs(:to_json).returns('{"name": "David"}') @request.accept = "application/json" put :using_resource assert_equal "application/json", @response.content_type - assert_equal 200, @response.status - assert_equal "{}", @response.body + assert_equal 204, @response.status + assert_equal " ", @response.body end def test_using_resource_for_put_with_xml_yields_unprocessable_entity_on_failure @@ -846,23 +846,23 @@ class RespondWithControllerTest < ActionController::TestCase end end - def test_using_resource_for_delete_with_xml_yields_ok_on_success + def test_using_resource_for_delete_with_xml_yields_no_content_on_success Customer.any_instance.stubs(:destroyed?).returns(true) @request.accept = "application/xml" delete :using_resource assert_equal "application/xml", @response.content_type - assert_equal 200, @response.status + assert_equal 204, @response.status assert_equal " ", @response.body end - def test_using_resource_for_delete_with_json_yields_ok_on_success + def test_using_resource_for_delete_with_json_yields_no_content_on_success Customer.any_instance.stubs(:to_json).returns('{"name": "David"}') Customer.any_instance.stubs(:destroyed?).returns(true) @request.accept = "application/json" delete :using_resource assert_equal "application/json", @response.content_type - assert_equal 200, @response.status - assert_equal "{}", @response.body + assert_equal 204, @response.status + assert_equal " ", @response.body end def test_using_resource_for_delete_with_html_redirects_on_failure -- cgit v1.2.3 From 902764379838d0d2b98e262c4039b7069cada3f8 Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Wed, 26 Oct 2011 10:30:14 -0700 Subject: scumbag 1.8: strings are enumerable :'( --- actionpack/lib/action_view/helpers/form_options_helper.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'actionpack') diff --git a/actionpack/lib/action_view/helpers/form_options_helper.rb b/actionpack/lib/action_view/helpers/form_options_helper.rb index 1a6c3b9740..f895cad058 100644 --- a/actionpack/lib/action_view/helpers/form_options_helper.rb +++ b/actionpack/lib/action_view/helpers/form_options_helper.rb @@ -584,7 +584,7 @@ module ActionView # [nil, []] # { nil => [] } # - if !choices.empty? && choices.first.last.respond_to?(:each) + if !choices.empty? && Array === choices.first.last option_tags = grouped_options_for_select(choices, :selected => selected_value, :disabled => options[:disabled]) else option_tags = options_for_select(choices, :selected => selected_value, :disabled => options[:disabled]) -- cgit v1.2.3 From 07c4297282c9c2d0768922722ad2ab08dedf4d8d Mon Sep 17 00:00:00 2001 From: Paul McMahon Date: Fri, 28 Oct 2011 15:34:12 +0900 Subject: Add missing type to number_field_tag documentation --- actionpack/lib/action_view/helpers/form_tag_helper.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'actionpack') diff --git a/actionpack/lib/action_view/helpers/form_tag_helper.rb b/actionpack/lib/action_view/helpers/form_tag_helper.rb index 13b9dc8553..1424a3584d 100644 --- a/actionpack/lib/action_view/helpers/form_tag_helper.rb +++ b/actionpack/lib/action_view/helpers/form_tag_helper.rb @@ -582,7 +582,7 @@ module ActionView # # ==== Examples # number_field_tag 'quantity', nil, :in => 1...10 - # => + # => def number_field_tag(name, value = nil, options = {}) options = options.stringify_keys options["type"] ||= "number" -- cgit v1.2.3 From 0c7c1dbc41414c12799f339c87e1c04327e9def9 Mon Sep 17 00:00:00 2001 From: Arun Agrawal Date: Sat, 29 Oct 2011 12:34:08 +0530 Subject: ActiveRecord is no more in controller directory. --- actionpack/RUNNING_UNIT_TESTS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'actionpack') diff --git a/actionpack/RUNNING_UNIT_TESTS b/actionpack/RUNNING_UNIT_TESTS index 1e3ba7abe7..1b29abd2d1 100644 --- a/actionpack/RUNNING_UNIT_TESTS +++ b/actionpack/RUNNING_UNIT_TESTS @@ -18,7 +18,7 @@ which can be further narrowed down to one test: == Dependency on Active Record and database setup -Test cases in the test/controller/active_record/ directory depend on having +Test cases in the test/active_record/ directory depend on having activerecord and sqlite installed. If Active Record is not in actionpack/../activerecord directory, or the sqlite rubygem is not installed, these tests are skipped. -- cgit v1.2.3 From 6cbe4223a77d7ea364b4d2dc46cec6a0c58c9537 Mon Sep 17 00:00:00 2001 From: Christopher Meiklejohn Date: Sat, 30 Jul 2011 00:49:36 -0400 Subject: Ensure that the format isn't applied twice to the cache key, else it becomes impossible to target with expire_action. --- actionpack/lib/action_controller/caching/actions.rb | 2 +- actionpack/test/controller/caching_test.rb | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) (limited to 'actionpack') diff --git a/actionpack/lib/action_controller/caching/actions.rb b/actionpack/lib/action_controller/caching/actions.rb index 0031d2701f..f6b23e4efc 100644 --- a/actionpack/lib/action_controller/caching/actions.rb +++ b/actionpack/lib/action_controller/caching/actions.rb @@ -175,7 +175,7 @@ module ActionController #:nodoc: private def normalize!(path) path << 'index' if path[-1] == ?/ - path << ".#{extension}" if extension and !path.ends_with?(extension) + path << ".#{extension}" if extension and !path.split('?').first.try(:ends_with?, ".#{extension}") URI.parser.unescape(path) end end diff --git a/actionpack/test/controller/caching_test.rb b/actionpack/test/controller/caching_test.rb index 618e7b77b2..2364bbf3a3 100644 --- a/actionpack/test/controller/caching_test.rb +++ b/actionpack/test/controller/caching_test.rb @@ -194,6 +194,7 @@ class ActionCachingTestController < CachingController caches_action :show, :cache_path => 'http://test.host/custom/show' caches_action :edit, :cache_path => Proc.new { |c| c.params[:id] ? "http://test.host/#{c.params[:id]};edit" : "http://test.host/edit" } caches_action :with_layout + caches_action :with_format_and_http_param, :cache_path => Proc.new { |c| { :key => 'value' } } caches_action :layout_false, :layout => false caches_action :record_not_found, :four_oh_four, :simple_runtime_error @@ -219,6 +220,11 @@ class ActionCachingTestController < CachingController render :text => @cache_this, :layout => true end + def with_format_and_http_param + @cache_this = MockTime.now.to_f.to_s + render :text => @cache_this + end + def record_not_found raise ActiveRecord::RecordNotFound, "oops!" end @@ -359,6 +365,13 @@ class ActionCacheTest < ActionController::TestCase assert !fragment_exist?('hostname.com/action_caching_test') end + def test_action_cache_with_format_and_http_param + get :with_format_and_http_param, :format => 'json' + assert_response :success + assert !fragment_exist?('hostname.com/action_caching_test/with_format_and_http_param.json?key=value.json') + assert fragment_exist?('hostname.com/action_caching_test/with_format_and_http_param.json?key=value') + end + def test_action_cache_with_store_options MockTime.expects(:now).returns(12345).once @controller.expects(:read_fragment).with('hostname.com/action_caching_test', :expires_in => 1.hour).once -- cgit v1.2.3 From 62a86748ae8e6a43c20e917a963a614a02098a58 Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Mon, 31 Oct 2011 15:17:16 -0400 Subject: this should never return nil, so no use for "try" --- actionpack/lib/action_controller/caching/actions.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'actionpack') diff --git a/actionpack/lib/action_controller/caching/actions.rb b/actionpack/lib/action_controller/caching/actions.rb index f6b23e4efc..f988de39dd 100644 --- a/actionpack/lib/action_controller/caching/actions.rb +++ b/actionpack/lib/action_controller/caching/actions.rb @@ -175,7 +175,7 @@ module ActionController #:nodoc: private def normalize!(path) path << 'index' if path[-1] == ?/ - path << ".#{extension}" if extension and !path.split('?').first.try(:ends_with?, ".#{extension}") + path << ".#{extension}" if extension and !path.split('?').first.ends_with?(".#{extension}") URI.parser.unescape(path) end end -- cgit v1.2.3 From 5f4550889dcab7def4122d37a3379d57627f68e2 Mon Sep 17 00:00:00 2001 From: Alexey Vakhov Date: Tue, 1 Nov 2011 08:55:03 +0400 Subject: Fix typo in constraints method documentation --- actionpack/lib/action_dispatch/routing/mapper.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'actionpack') diff --git a/actionpack/lib/action_dispatch/routing/mapper.rb b/actionpack/lib/action_dispatch/routing/mapper.rb index 09a8c10043..e8bfe9bbd0 100644 --- a/actionpack/lib/action_dispatch/routing/mapper.rb +++ b/actionpack/lib/action_dispatch/routing/mapper.rb @@ -735,7 +735,7 @@ module ActionDispatch # if the user should be given access to that route, or +false+ if the user should not. # # class Iphone - # def self.matches(request) + # def self.matches?(request) # request.env["HTTP_USER_AGENT"] =~ /iPhone/ # end # end -- cgit v1.2.3 From 702aecb126712de9f996da74357cafe14f449d24 Mon Sep 17 00:00:00 2001 From: Aviv Ben-Yosef Date: Tue, 1 Nov 2011 08:59:20 +0200 Subject: Fix typo in Dispatcher#controller documentation --- actionpack/lib/action_dispatch/routing/route_set.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'actionpack') diff --git a/actionpack/lib/action_dispatch/routing/route_set.rb b/actionpack/lib/action_dispatch/routing/route_set.rb index e7bc431783..2bcde16110 100644 --- a/actionpack/lib/action_dispatch/routing/route_set.rb +++ b/actionpack/lib/action_dispatch/routing/route_set.rb @@ -37,7 +37,7 @@ module ActionDispatch # If this is a default_controller (i.e. a controller specified by the user) # we should raise an error in case it's not found, because it usually means - # an user error. However, if the controller was retrieved through a dynamic + # a user error. However, if the controller was retrieved through a dynamic # segment, as in :controller(/:action), we should simply return nil and # delegate the control back to Rack cascade. Besides, if this is not a default # controller, it means we should respect the @scope[:module] parameter. -- cgit v1.2.3 From 746331711585cfcb158dafcaf3ea5d60d9825ed2 Mon Sep 17 00:00:00 2001 From: Alexey Vakhov Date: Thu, 3 Nov 2011 08:43:28 +0400 Subject: Fix small typos in routing docs --- actionpack/lib/action_dispatch/routing/mapper.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'actionpack') diff --git a/actionpack/lib/action_dispatch/routing/mapper.rb b/actionpack/lib/action_dispatch/routing/mapper.rb index e8bfe9bbd0..970236a05a 100644 --- a/actionpack/lib/action_dispatch/routing/mapper.rb +++ b/actionpack/lib/action_dispatch/routing/mapper.rb @@ -285,7 +285,7 @@ module ActionDispatch # A pattern can also point to a +Rack+ endpoint i.e. anything that # responds to +call+: # - # match 'photos/:id' => lambda {|hash| [200, {}, "Coming soon" } + # match 'photos/:id' => lambda {|hash| [200, {}, "Coming soon"] } # match 'photos/:id' => PhotoRackApp # # Yes, controller actions are just rack endpoints # match 'photos/:id' => PhotosController.action(:show) @@ -1023,6 +1023,7 @@ module ActionDispatch # creates seven different routes in your application, all mapping to # the +Photos+ controller: # + # GET /photos # GET /photos/new # POST /photos # GET /photos/:id @@ -1038,6 +1039,7 @@ module ActionDispatch # # This generates the following comments routes: # + # GET /photos/:photo_id/comments # GET /photos/:photo_id/comments/new # POST /photos/:photo_id/comments # GET /photos/:photo_id/comments/:id -- cgit v1.2.3 From a8468731f7cbb0d8702e7fb0722559194dd930ad Mon Sep 17 00:00:00 2001 From: Alexey Vakhov Date: Thu, 3 Nov 2011 09:02:11 +0400 Subject: Fix javascript_include_tag examples in documentation --- .../action_view/helpers/asset_tag_helpers/javascript_tag_helpers.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'actionpack') diff --git a/actionpack/lib/action_view/helpers/asset_tag_helpers/javascript_tag_helpers.rb b/actionpack/lib/action_view/helpers/asset_tag_helpers/javascript_tag_helpers.rb index 09700bd0c5..d9f1f88ade 100644 --- a/actionpack/lib/action_view/helpers/asset_tag_helpers/javascript_tag_helpers.rb +++ b/actionpack/lib/action_view/helpers/asset_tag_helpers/javascript_tag_helpers.rb @@ -119,10 +119,10 @@ module ActionView # # # # javascript_include_tag "http://www.example.com/xmlhr" - # # => + # # => # # javascript_include_tag "http://www.example.com/xmlhr.js" - # # => + # # => # # javascript_include_tag :defaults # # => -- cgit v1.2.3 From a50f659e081785479b068b311862703584a589ca Mon Sep 17 00:00:00 2001 From: Olivier Lacan Date: Thu, 3 Nov 2011 10:01:32 -0400 Subject: CSS fix to prevent error output from being breaking out of body element. Using the white-space: pre-wrap adds extra line breaks to prevent the text from breaking out of the element's box. In this case single line output can be extremely long, breaking out the element. See for reference: http://www.quirksmode.org/css/whitespace.html Before: http://link.olivierlacan.com/BVU4 After: http://link.olivierlacan.com/BUfM --- actionpack/lib/action_dispatch/middleware/templates/rescues/layout.erb | 1 + 1 file changed, 1 insertion(+) (limited to 'actionpack') diff --git a/actionpack/lib/action_dispatch/middleware/templates/rescues/layout.erb b/actionpack/lib/action_dispatch/middleware/templates/rescues/layout.erb index 6e71fd7ddc..1a308707d1 100644 --- a/actionpack/lib/action_dispatch/middleware/templates/rescues/layout.erb +++ b/actionpack/lib/action_dispatch/middleware/templates/rescues/layout.erb @@ -16,6 +16,7 @@ background-color: #eee; padding: 10px; font-size: 11px; + white-space: pre-wrap; } a { color: #000; } -- cgit v1.2.3 From b5f908a7ad515215f164e306f82c3e6c506182cb Mon Sep 17 00:00:00 2001 From: Jon Leighton Date: Thu, 3 Nov 2011 16:09:57 +0000 Subject: Stub find_template so that when handle_render_error is called in ActionView::Template, we get to see the actual underlying error rather than a NoMethodError. This shows an encoding bug on Ruby 1.9.3. --- actionpack/test/template/template_test.rb | 3 +++ 1 file changed, 3 insertions(+) (limited to 'actionpack') diff --git a/actionpack/test/template/template_test.rb b/actionpack/test/template/template_test.rb index b0ca7de0b6..70ca876c67 100644 --- a/actionpack/test/template/template_test.rb +++ b/actionpack/test/template/template_test.rb @@ -8,6 +8,9 @@ class TestERBTemplate < ActiveSupport::TestCase def disable_cache yield end + + def find_template(*args) + end end class Context -- cgit v1.2.3 From 56207a3f0165650abb273594f1f54fbb92bbf177 Mon Sep 17 00:00:00 2001 From: Waseem Ahmad Date: Fri, 4 Nov 2011 15:03:02 +0530 Subject: Remove 'size' attribute from number_field form helper fixes #3454 f.number_field generates which is invalid HTML5. See: http://dev.w3.org/html5/spec/Overview.html#number-state --- actionpack/lib/action_view/helpers/form_helper.rb | 2 ++ actionpack/test/template/form_helper_test.rb | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'actionpack') diff --git a/actionpack/lib/action_view/helpers/form_helper.rb b/actionpack/lib/action_view/helpers/form_helper.rb index f22c466666..5c10b67586 100644 --- a/actionpack/lib/action_view/helpers/form_helper.rb +++ b/actionpack/lib/action_view/helpers/form_helper.rb @@ -1027,6 +1027,8 @@ module ActionView def to_number_field_tag(field_type, options = {}) options = options.stringify_keys + options['size'] ||= nil + if range = options.delete("in") || options.delete("within") options.update("min" => range.min, "max" => range.max) end diff --git a/actionpack/test/template/form_helper_test.rb b/actionpack/test/template/form_helper_test.rb index e36d032f6c..bd7b322fc9 100644 --- a/actionpack/test/template/form_helper_test.rb +++ b/actionpack/test/template/form_helper_test.rb @@ -438,12 +438,12 @@ class FormHelperTest < ActionView::TestCase end def test_number_field - expected = %{} + expected = %{} assert_dom_equal(expected, number_field("order", "quantity", :in => 1...10)) end def test_range_input - expected = %{} + expected = %{} assert_dom_equal(expected, range_field("hifi", "volume", :in => 0..11, :step => 0.1)) end -- cgit v1.2.3 From 281272ad36e29b49595c1758d56a82f338c21b1a Mon Sep 17 00:00:00 2001 From: Jon Leighton Date: Fri, 4 Nov 2011 12:55:17 +0000 Subject: Convert CHANGELOGs to Markdown format. Reasons: * Markdown reads well as plain text, but can also be formatted. * It will make it easier for people to read on the web as Github formats the Markdown nicely. * It will encourage a level of consistency when people are writing CHANGELOG entries. The script used to perform the conversion is at https://gist.github.com/1339263 --- actionpack/CHANGELOG | 5689 ----------------------------------------------- actionpack/CHANGELOG.md | 5663 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 5663 insertions(+), 5689 deletions(-) delete mode 100644 actionpack/CHANGELOG create mode 100644 actionpack/CHANGELOG.md (limited to 'actionpack') diff --git a/actionpack/CHANGELOG b/actionpack/CHANGELOG deleted file mode 100644 index a7a47bf930..0000000000 --- a/actionpack/CHANGELOG +++ /dev/null @@ -1,5689 +0,0 @@ -*Rails 3.2.0 (unreleased)* - -* Responders now return 204 No Content for API requests without a response body (as in the new scaffold) [José Valim] - -* Added ActionDispatch::RequestId middleware that'll make a unique X-Request-Id header available to the response and enables the ActionDispatch::Request#uuid method. This makes it easy to trace requests from end-to-end in the stack and to identify individual requests in mixed logs like Syslog [DHH] - -* Limit the number of options for select_year to 1000. - - Pass the :max_years_allowed option to set your own limit. - - [Libo Cannici] - -* Passing formats or handlers to render :template and friends is deprecated. For example: [Nick Sutterer & José Valim] - - render :template => "foo.html.erb" - - Instead, you can provide :handlers and :formats directly as option: - - render :template => "foo", :formats => [:html, :js], :handlers => :erb - -* Changed log level of warning for missing CSRF token from :debug to :warn. [Mike Dillon] - -* content_tag_for and div_for can now take the collection of records. It will also yield the record as the first argument if you set a receiving argument in your block [Prem Sichanugrist] - - So instead of having to do this: - - @items.each do |item| - content_tag_for(:li, item) do - Title: <%= item.title %> - end - end - - You can now do this: - - content_tag_for(:li, @items) do |item| - Title: <%= item.title %> - end - -* send_file now guess the mime type [Esad Hajdarevic] - -* Mime type entries for PDF, ZIP and other formats were added [Esad Hajdarevic] - -* Generate hidden input before select with :multiple option set to true. - This is useful when you rely on the fact that when no options is set, - the state of select will be sent to rails application. Without hidden field - nothing is sent according to HTML spec [Bogdan Gusiev] - -* Refactor ActionController::TestCase cookies [Andrew White] - - Assigning cookies for test cases should now use cookies[], e.g: - - cookies[:email] = 'user@example.com' - get :index - assert_equal 'user@example.com', cookies[:email] - - To clear the cookies, use clear, e.g: - - cookies.clear - get :index - assert_nil cookies[:email] - - We now no longer write out HTTP_COOKIE and the cookie jar is - persistent between requests so if you need to manipulate the environment - for your test you need to do it before the cookie jar is created. - - -*Rails 3.1.1 (unreleased)* - -* javascript_path and stylesheet_path now refer to /assets if asset pipelining -is on. [Santiago Pastorino] - -* button_to support form option. Now you're able to pass for example -'data-type' => 'json'. [ihower] - -* image_path and image_tag should use /assets if asset pipelining is turned -on. Closes #3126 [Santiago Pastorino and christos] - -* Avoid use of existing precompiled assets during rake assets:precompile run. -Closes #3119 [Guillermo Iguaran] - -* Copy assets to nondigested filenames too [Santiago Pastorino] - -* Give precedence to `config.digest = false` over the existence of -manifest.yml asset digests [christos] - -* escape options for the stylesheet_link_tag method [Alexey Vakhov] - -* Re-launch assets:precompile task using (Rake.)ruby instead of Kernel.exec so -it works on Windows [cablegram] - -* env var passed to process shouldn't be modified in process method. [Santiago -Pastorino] - -* `rake assets:precompile` loads the application but does not initialize -it. - - To the app developer, this means configuration add in - config/initializers/* will not be executed. - - Plugins developers need to special case their initializers that are - meant to be run in the assets group by adding :group => :assets. [José Valim] - -* Sprockets uses config.assets.prefix for asset_path [asee] - -* FileStore key_file_path properly limit filenames to 255 characters. [phuibonhoa] - -* Fix Hash#to_query edge case with html_safe strings. [brainopia] - -* Allow asset tag helper methods to accept :digest => false option in order to completely avoid the digest generation. -Useful for linking assets from static html files or from emails when the user -could probably look at an older html email with an older asset. [Santiago Pastorino] - -* Don't mount Sprockets server at config.assets.prefix if config.assets.compile is false. [Mark J. Titorenko] - -* Set relative url root in assets when controller isn't available for Sprockets (eg. Sass files using asset_path). Fixes #2435 [Guillermo Iguaran] - -* Fix basic auth credential generation to not make newlines. GH #2882 - -* Fixed the behavior of asset pipeline when config.assets.digest and config.assets.compile are false and requested asset isn't precompiled. - Before the requested asset were compiled anyway ignoring that the config.assets.compile flag is false. [Guillermo Iguaran] - -* CookieJar is now Enumerable. Fixes #2795 - -* Fixed AssetNotPrecompiled error raised when rake assets:precompile is compiling certain .erb files. See GH #2763 #2765 #2805 [Guillermo Iguaran] - -* Manifest is correctly placed in assets path when default assets prefix is changed. Fixes #2776 [Guillermo Iguaran] - -* Fixed stylesheet_link_tag and javascript_include_tag to respect additional options passed by the users when debug is on. [Guillermo Iguaran] - - -*Rails 3.1.0 (August 30, 2011)* - -* Param values are `paramified` in controller tests. [David Chelimsky] - -* x_sendfile_header now defaults to nil and config/environments/production.rb doesn't set a particular value for it. This allows servers to set it through X-Sendfile-Type. [Santiago Pastorino] - -* The submit form helper does not generate an id "object_name_id" anymore. [fbrusatti] - -* Make sure respond_with with :js tries to render a template in all cases [José Valim] - -* 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 escape_js to work correctly with the new SafeBuffer restriction [Paul Gallagher] - -* Brought back alternative convention for namespaced models in i18n [thoefer] - - Now the key can be either "namespace.model" or "namespace/model" until further deprecation. - -* 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 - -* Warn if we cannot verify CSRF token authenticity [José Valim] - -* Allow AM/PM format in datetime selectors [Aditya Sanghi] - -* Only show dump of regular env methods on exception screen (not all the rack crap) [DHH] - -* auto_link has been removed with no replacement. If you still use auto_link - please install the rails_autolink gem: - http://github.com/tenderlove/rails_autolink - - [tenderlove] - -* Added streaming support, you can enable it with: [José Valim] - - class PostsController < ActionController::Base - stream :only => :index - end - - Please read the docs at `ActionController::Streaming` for more information. - -* Added `ActionDispatch::Request.ignore_accept_header` to ignore accept headers and only consider the format given as parameter [José Valim] - -* Created `ActionView::Renderer` and specified an API for `ActionView::Context`, check those objects for more information [José Valim] - -* Added `ActionController::ParamsWrapper` to wrap parameters into a nested hash, and will be turned on for JSON request in new applications by default [Prem Sichanugrist] - - This can be customized by setting `ActionController::Base.wrap_parameters` in `config/initializer/wrap_parameters.rb` - -* RJS has been extracted out to a gem. [fxn] - -* Implicit actions named not_implemented can be rendered. [Santiago Pastorino] - -* Wildcard route will always match the optional format segment by default. [Prem Sichanugrist] - - For example if you have this route: - - match '*pages' => 'pages#show' - - by requesting '/foo/bar.json', your `params[:pages]` will be equals to "foo/bar" with the request format of JSON. If you want the old 3.0.x behavior back, you could supply `:format => false` like this: - - match '*pages' => 'pages#show', :format => false - -* Added Base.http_basic_authenticate_with to do simple http basic authentication with a single class method call [DHH] - - class PostsController < ApplicationController - USER_NAME, PASSWORD = "dhh", "secret" - - before_filter :authenticate, :except => [ :index ] - - def index - render :text => "Everyone can see me!" - end - - def edit - render :text => "I'm only accessible if you know the password" - end - - private - def authenticate - authenticate_or_request_with_http_basic do |user_name, password| - user_name == USER_NAME && password == PASSWORD - end - end - end - - ..can now be written as - - class PostsController < ApplicationController - http_basic_authenticate_with :name => "dhh", :password => "secret", :except => :index - - def index - render :text => "Everyone can see me!" - end - - def edit - render :text => "I'm only accessible if you know the password" - end - end - -* Allow you to add `force_ssl` into controller to force browser to transfer data via HTTPS protocol on that particular controller. You can also specify `:only` or `:except` to specific it to particular action. [DHH and Prem Sichanugrist] - -* Allow FormHelper#form_for to specify the :method as a direct option instead of through the :html hash [DHH] - - form_for(@post, remote: true, method: :delete) instead of form_for(@post, remote: true, html: { method: :delete }) - -* Make JavaScriptHelper#j() an alias for JavaScriptHelper#escape_javascript() -- note this then supersedes the Object#j() method that the JSON gem adds within templates using the JavaScriptHelper [DHH] - -* Sensitive query string parameters (specified in config.filter_parameters) will now be filtered out from the request paths in the log file. [Prem Sichanugrist, fxn] - -* URL parameters which return false for to_param now appear in the query string (previously they were removed) [Andrew White] - -* URL parameters which return nil for to_param are now removed from the query string [Andrew White] - -* ActionDispatch::MiddlewareStack now uses composition over inheritance. It is -no longer an array which means there may be methods missing that were not -tested. - -* Add an :authenticity_token option to form_tag for custom handling or to omit the token (pass :authenticity_token => false). [Jakub Kuźma, Igor Wiedler] - -* HTML5 button_tag helper. [Rizwan Reza] - -* Template lookup now searches further up in the inheritance chain. [Artemave] - -* Brought back config.action_view.cache_template_loading, which allows to decide whether templates should be cached or not. [Piotr Sarnacki] - -* url_for and named url helpers now accept :subdomain and :domain as options, [Josh Kalderimis] - -* The redirect route method now also accepts a hash of options which will only change the parts of the url in question, or an object which responds to call, allowing for redirects to be reused (check the documentation for examples). [Josh Kalderimis] - -* Added config.action_controller.include_all_helpers. By default 'helper :all' is done in ActionController::Base, which includes all the helpers by default. Setting include_all_helpers to false will result in including only application_helper and helper corresponding to controller (like foo_helper for foo_controller). [Piotr Sarnacki] - -* Added a convenience idiom to generate HTML5 data-* attributes in tag helpers from a :data hash of options: - - tag("div", :data => {:name => 'Stephen', :city_state => %w(Chicago IL)}) - # =>
- - Keys are dasherized. Values are JSON-encoded, except for strings and symbols. [Stephen Celis] - -* Deprecate old template handler API. The new API simply requires a template handler to respond to call. [José Valim] - -* :rhtml and :rxml were finally removed as template handlers. [José Valim] - -* Moved etag responsibility from ActionDispatch::Response to the middleware stack. [José Valim] - -* Rely on Rack::Session stores API for more compatibility across the Ruby world. This is backwards incompatible since Rack::Session expects #get_session to accept 4 arguments and requires #destroy_session instead of simply #destroy. [José Valim] - -* file_field automatically adds :multipart => true to the enclosing form. [Santiago Pastorino] - -* Renames csrf_meta_tag -> csrf_meta_tags, and aliases csrf_meta_tag for backwards compatibility. [fxn] - -* 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.7 (April 18, 2011)* - -*No changes. - - -*Rails 3.0.6 (April 5, 2011) - -* Fixed XSS vulnerability in `auto_link`. `auto_link` no longer marks input as - html safe. Please make sure that calls to auto_link() are wrapped in a - sanitize(), or a raw() depending on the type of input passed to auto_link(). - For example: - - <%= sanitize(auto_link(some_user_input)) %> - - Thanks to Torben Schulz for reporting this. The fix can be found here: - 61ee3449674c591747db95f9b3472c5c3bd9e84d - -* Fixes the output of `rake routes` to be correctly match to the behavior of the application, as the regular expression used to match the path is greedy and won't capture the format part by default [Prem Sichanugrist] - -* Fixes an issue with number_to_human when converting values which are less than 1 but greater than -1 [Josh Kalderimis] - -* Sensitive query string parameters (specified in config.filter_parameters) will now be filtered out from the request paths in the log file. [Prem Sichanugrist, fxn] - -* URL parameters which return nil for to_param are now removed from the query string [Andrew White] - -* Don't allow i18n to change the minor version, version now set to ~> 0.5.0 [Santiago Pastorino] - -* Make TranslationHelper#translate use the :rescue_format option in I18n 0.5.0 [Sven Fuchs] - -* Fix regression: javascript_include_tag shouldn't raise if you register an expansion key with nil or [] value [Santiago Pastorino] - -* Fix Action caching bug where an action that has a non-cacheable response always renders a nil response body. It now correctly renders the response body. [Cheah Chu Yeow] - - -*Rails 3.0.5 (February 26, 2011)* - -* No changes. - - -*Rails 3.0.4 (February 8, 2011)* - -* No changes. - - -*Rails 3.0.3 (November 16, 2010)* - -* When ActiveRecord::Base objects are sent to predicate methods, the id of the object should be sent to ARel, not the ActiveRecord::Base object. - -* :constraints routing should only do sanity checks against regular expressions. String arguments are OK. - - -*Rails 3.0.2 (November 15, 2010)* - -* The helper number_to_currency accepts a new :negative_format option to be able to configure how to render negative amounts. [Don Wilson] - - -*Rails 3.0.1 (October 15, 2010)* - -* No Changes, just a version bump. - - -*Rails 3.0.0 (August 29, 2010)* - -* password_field renders with nil value by default making the use of passwords secure by default, if you want to render you should do for instance f.password_field(:password, :value => @user.password) [Santiago Pastorino] - -* Symbols and strings in routes should yield the same behavior. Note this may break existing apps that were using symbols with the new routes API. [José Valim] - -* Add clear_helpers as a way to clean up all helpers added to this controller, maintaining just the helper with the same name as the controller. [José Valim] - -* Support routing constraints in functional tests. [Andrew White] - -* Add a header that tells Internet Explorer (all versions) to use the best available standards support. [Yehuda Katz] - -* Allow stylesheet/javascript extensions to be changed through railties. [Josh Kalderimis] - -* link_to, button_to, and tag/tag_options now rely on html_escape instead of escape_once. [fxn] - -* url_for returns always unescaped strings, and the :escape option is gone. [fxn] - -* Added accept-charset parameter and _snowman hidden field to force the contents - of Rails POSTed forms to be in UTF-8 [Yehuda Katz] - -* Upgrade to Rack 1.2.1 [Jeremy Kemper] - -* Allow :path to be given to match/get/post/put/delete instead of :path_names in the new router [Carlos Antônio da Silva] - -* Added resources_path_names to the new router DSL [José Valim] - -* Allow options to be given to the namespace method in the new router [Carlos Antônio da Silva] - -* Deprecate :name_prefix in the new router DSL [José Valim] - -* Add shallow routes back to the new router [Diego Carrion, Andrew White] - - resources :posts do - shallow do - resources :comments - end - end - - You can now use comment_path for /comments/1 instead of post_comment_path for /posts/1/comments/1. - -* Add support for multi-subdomain session by setting cookie host in session cookie so you can share session between www.example.com, example.com and user.example.com. #4818 [Guillermo Álvarez] - -* Removed textilize, textilize_without_paragraph and markdown helpers. [Santiago Pastorino] - -* Remove middleware laziness [José Valim] - -* Make session stores rely on request.cookie_jar and change set_session semantics to return the cookie value instead of a boolean. [José Valim] - -* OAuth 2: HTTP Token Authorization support to complement Basic and Digest Authorization. [Rick Olson] - -* Fixed inconsistencies in form builder and view helpers #4432 [Neeraj Singh] - -* Both :xml and :json renderers now forwards the given options to the model, allowing you to invoke them as render :xml => @projects, :include => :tasks [José Valim, Yehuda Katz] - -* Renamed the field error CSS class from fieldWithErrors to field_with_errors for consistency. [Jeremy Kemper] - -* Add support for shorthand routes like /projects/status(.:format) #4423 [Diego Carrion] - -* Changed translate helper so that it doesn’t mark every translation as safe HTML. Only keys with a "_html" suffix and keys named "html" are considered to be safe HTML. All other translations are left untouched. [Craig Davey] - -* New option :as added to form_for allows to change the object name. The old <% form_for :client, @post %> becomes <% form_for @post, :as => :client %> [spastorino] - -* Removed verify method in controllers. [JV] - It's now available as a plugin at http://github.com/rails/verification - -* Removed input, form, error_messages_for and error_message_on from views. [JV] - It's now available as a plugin at http://github.com/rails/dynamic_form - -* Routes can be scoped by controller module. [Jeremy Kemper] - - # /session => Auth::SessionsController - scope :module => 'auth' do - resource :session - end - -* Added #favicon_link_tag, it uses #image_path so in particular the favicon gets an asset ID [fxn] - -* Fixed that default locale templates should be used if the current locale template is missing [DHH] - -* Added all the new HTML5 form types as individual form tag methods (search, url, number, etc) #3646 [Stephen Celis] - -* Changed the object used in routing constraints to be an instance of - ActionDispatch::Request rather than Rack::Request [YK] - -* Changed ActionDispatch::Request#method to return a String, to be compatible - with Rack::Request. Added ActionDispatch::Request#method_symbol to - return a symbol form of the request method. [YK] - -* Changed ActionDispatch::Request#method to return the original - method and #request_method to return the overridden method in the - case of methodoverride being used (this means that #method returns - "HEAD" and #request_method returns "GET" in HEAD requests). This - is for compatibility with Rack::Request [YK] - -* #concat is now deprecated in favor of using <%= %> helpers [YK] - -* Block helpers now return Strings, so you can use <%= form_for @foo do |f| %>. - <% form_for do |f| %> still works with deprecation notices [YK] - -* Add a new #mount method on the router that does not anchor the PATH_INFO - at the end [YK & CL] - -* Create a new LookupContext object that is responsible for performantly - finding a template for a given pattern [JV] - -* Removed relative_url_for in favor of respecting SCRIPT_NAME [YK & CL] - -* Changed file streaming to use Rack::Sendfile middleware [YK] - -* ActionDispatch::Request#content_type returns a String to be compatible with - Rack::Request. Use #content_mime_type for the Mime::Type instance [YK] - -* Updated Prototype to 1.6.1 and Scriptaculous to 1.8.3 [ML] - -* Change the preferred way that URL helpers are included into a class[YK & CL] - - # for all helpers including named routes - include Rails.application.router.url_helpers - - # for just url_for - include Rails.application.router.url_for - -* Fixed that PrototypeHelper#update_page should return html_safe [DHH] - -* Fixed that much of DateHelper wouldn't return html_safe? strings [DHH] - -* Fixed that fragment caching should return a cache hit as html_safe (or it would all just get escaped) [DHH] - -* Added that ActionController::Base now does helper :all instead of relying on the default ApplicationController in Rails to do it [DHH] - -* Added ActionDispatch::Request#authorization to access the http authentication header regardless of its proxy hiding [DHH] - -* Added :alert, :notice, and :flash as options to ActionController::Base#redirect_to that'll automatically set the proper flash before the redirection [DHH]. Examples: - - flash[:notice] = 'Post was created' - redirect_to(@post) - - ...becomes: - - redirect_to(@post, :notice => 'Post was created') - -* Added ActionController::Base#notice/= and ActionController::Base#alert/= as a convenience accessors in both the controller and the view for flash[:notice]/= and flash[:alert]/= [DHH] - - -* Introduce grouped_collection_select helper. #1249 [Dan Codeape, Erik Ostrom] - -* Make sure javascript_include_tag/stylesheet_link_tag does not append ".js" or ".css" onto external urls. #1664 [Matthew Rudy Jacobs] - -* Ruby 1.9: fix Content-Length for multibyte send_data streaming. #2661 [Sava Chankov] - -* Ruby 1.9: ERB template encoding using a magic comment at the top of the file. [Jeremy Kemper] - <%# encoding: utf-8 %> - -* Change integration test helpers to accept Rack environment instead of just HTTP Headers [Pratik Naik] - - Before : get '/path', {}, 'Accept' => 'text/javascript' - After : get '/path', {}, 'HTTP_ACCEPT' => 'text/javascript' - -* Instead of checking Rails.env.test? in Failsafe middleware, check env["rails.raise_exceptions"] [Bryan Helmkamp] - -* Fixed that TestResponse.cookies was returning cookies unescaped #1867 [Doug McInnes] - - -*2.3.2 [Final] (March 15, 2009)* - -* Fixed that redirection would just log the options, not the final url (which lead to "Redirected to #") [DHH] - -* Don't check authenticity tokens for any AJAX requests [Ross Kaffenberger/Bryan Helmkamp] - -* Added ability to pass in :public => true to fresh_when, stale?, and expires_in to make the request proxy cachable #2095 [Gregg Pollack] - -* Fixed that passing a custom form builder would be forwarded to nested fields_for calls #2023 [Eloy Duran/Nate Wiger] - -* Form option helpers now support disabled option tags and the use of lambdas for selecting/disabling option tags from collections #837 [Tekin] - -* Added partial scoping to TranslationHelper#translate, so if you call translate(".foo") from the people/index.html.erb template, you'll actually be calling I18n.translate("people.index.foo") [DHH] - -* Fix a syntax error in current_page?() that was prevent matches against URL's with multiple query parameters #1385, #1868 [chris finne/Andrew White] - -* Added localized rescue template when I18n.locale is set (ex: public/404.da.html) #1835 [José Valim] - -* Make the form_for and fields_for helpers support the new Active Record nested update options. #1202 [Eloy Duran] - - <% form_for @person do |person_form| %> - ... - <% person_form.fields_for :projects do |project_fields| %> - <% if project_fields.object.active? %> - Name: <%= project_fields.text_field :name %> - <% end %> - <% end %> - <% end %> - - -* Added grouped_options_for_select helper method for wrapping option tags in optgroups. #977 [Jon Crawford] - -* Implement HTTP Digest authentication. #1230 [Gregg Kellogg, Pratik Naik] Example : - - class DummyDigestController < ActionController::Base - USERS = { "lifo" => 'world' } - - before_filter :authenticate - - def index - render :text => "Hello Secret" - end - - private - - def authenticate - authenticate_or_request_with_http_digest("Super Secret") do |username| - # Return the user's password - USERS[username] - end - end - end - -* Improved i18n support for the number_to_human_size helper. Changes the storage_units translation data; update your translations accordingly. #1634 [Yaroslav Markin] - storage_units: - # %u is the storage unit, %n is the number (default: 2 MB) - format: "%n %u" - units: - byte: - one: "Byte" - other: "Bytes" - kb: "KB" - mb: "MB" - gb: "GB" - tb: "TB" - -* Added :silence option to BenchmarkHelper#benchmark and turned log_level into a hash parameter and deprecated the old use [DHH] - -* Fixed the AssetTagHelper cache to use the computed asset host as part of the cache key instead of just assuming the its a string #1299 [DHH] - -* Make ActionController#render(string) work as a shortcut for render :file/:template/:action => string. [#1435] [Pratik Naik] Examples: - - # Instead of render(:action => 'other_action') - render('other_action') # argument has no '/' - render(:other_action) - - # Instead of render(:template => 'controller/action') - render('controller/action') # argument must not begin with a '/', but contain a '/' - - # Instead of render(:file => '/Users/lifo/home.html.erb') - render('/Users/lifo/home.html.erb') # argument must begin with a '/' - -* Add :prompt option to date/time select helpers. #561 [Sam Oliver] - -* Fixed that send_file shouldn't set an etag #1578 [Hongli Lai] - -* Allow users to opt out of the spoofing checks in Request#remote_ip. Useful for sites whose traffic regularly triggers false positives. [Darren Boyd] - -* Deprecated formatted_polymorphic_url. [Jeremy Kemper] - -* Added the option to declare an asset_host as an object that responds to call (see http://github.com/dhh/asset-hosting-with-minimum-ssl for an example) [David Heinemeier Hansson] - -* Added support for multiple routes.rb files (useful for plugin engines). This also means that draw will no longer clear the route set, you have to do that by hand (shouldn't make a difference to you unless you're doing some funky stuff) [David Heinemeier Hansson] - -* Dropped formatted_* routes in favor of just passing in :format as an option. This cuts resource routes generation in half #1359 [aaronbatalion] - -* Remove support for old double-encoded cookies from the cookie store. These values haven't been generated since before 2.1.0, and any users who have visited the app in the intervening 6 months will have had their cookie upgraded. [Michael Koziarski] - -* Allow helpers directory to be overridden via ActionController::Base.helpers_dir #1424 [Sam Pohlenz] - -* Remove deprecated ActionController::Base#assign_default_content_type_and_charset - -* Changed the default of ActionView#render to assume partials instead of files when not given an options hash [David Heinemeier Hansson]. Examples: - - # Instead of <%= render :partial => "account" %> - <%= render "account" %> - - # Instead of <%= render :partial => "account", :locals => { :account => @buyer } %> - <%= render "account", :account => @buyer %> - - # @account is an Account instance, so it uses the RecordIdentifier to replace - # <%= render :partial => "accounts/account", :locals => { :account => @account } %> - <%= render(@account) %> - - # @posts is an array of Post instances, so it uses the RecordIdentifier to replace - # <%= render :partial => "posts/post", :collection => @posts %> - <%= render(@posts) %> - -* Remove deprecated render_component. Please use the plugin from http://github.com/rails/render_component/tree/master [Pratik Naik] - -* Fixed RedCloth and BlueCloth shouldn't preload. Instead just assume that they're available if you want to use textilize and markdown and let autoload require them [David Heinemeier Hansson] - - -*2.2.2 (November 21st, 2008)* - -* I18n: translate number_to_human_size. Add storage_units: [Bytes, KB, MB, GB, TB] to your translations. #1448 [Yaroslav Markin] - -* Restore backwards compatible functionality for setting relative_url_root. Include deprecation - -* Switched the CSRF module to use the request content type to decide if the request is forgeable. #1145 [Jeff Cohen] - -* Added :only and :except to map.resources to let people cut down on the number of redundant routes in an application. Typically only useful for huge routesets. #1215 [Tom Stuart] - - map.resources :products, :only => :show do |product| - product.resources :images, :except => :destroy - end - -* Added render :js for people who want to render inline JavaScript replies without using RJS [David Heinemeier Hansson] - -* Fixed that polymorphic_url should compact given array #1317 [hiroshi] - -* Fixed the sanitize helper to avoid double escaping already properly escaped entities #683 [antonmos/Ryan McGeary] - -* Fixed that FormTagHelper generated illegal html if name contained square brackets #1238 [Vladimir Dobriakov] - -* Fix regression bug that made date_select and datetime_select raise a Null Pointer Exception when a nil date/datetime was passed and only month and year were displayed #1289 [Bernardo Padua/Tor Erik] - -* Simplified the logging format for parameters (don't include controller, action, and format as duplicates) [David Heinemeier Hansson] - -* Remove the logging of the Session ID when the session store is CookieStore [David Heinemeier Hansson] - -* Fixed regex in redirect_to to fully support URI schemes #1247 [Seth Fitzsimmons] - -* Fixed bug with asset timestamping when using relative_url_root #1265 [Joe Goldwasser] - - -*2.2.0 [RC1] (October 24th, 2008)* - -* Fix incorrect closing CDATA delimiter and that HTML::Node.parse would blow up on unclosed CDATA sections [packagethief] - -* Added stale? and fresh_when methods to provide a layer of abstraction above request.fresh? and friends [David Heinemeier Hansson]. Example: - - class ArticlesController < ApplicationController - def show_with_respond_to_block - @article = Article.find(params[:id]) - - - # If the request sends headers that differs from the options provided to stale?, then - # the request is indeed stale and the respond_to block is triggered (and the options - # to the stale? call is set on the response). - # - # If the request headers match, then the request is fresh and the respond_to block is - # not triggered. Instead the default render will occur, which will check the last-modified - # and etag headers and conclude that it only needs to send a "304 Not Modified" instead - # of rendering the template. - if stale?(:last_modified => @article.published_at.utc, :etag => @article) - respond_to do |wants| - # normal response processing - end - end - end - - def show_with_implied_render - @article = Article.find(params[:id]) - - # Sets the response headers and checks them against the request, if the request is stale - # (i.e. no match of either etag or last-modified), then the default render of the template happens. - # If the request is fresh, then the default render will return a "304 Not Modified" - # instead of rendering the template. - fresh_when(:last_modified => @article.published_at.utc, :etag => @article) - end - end - - -* Added inline builder yield to atom_feed_helper tags where appropriate [Sam Ruby]. Example: - - entry.summary :type => 'xhtml' do |xhtml| - xhtml.p pluralize(order.line_items.count, "line item") - xhtml.p "Shipped to #{order.address}" - xhtml.p "Paid by #{order.pay_type}" - end - -* Make PrototypeHelper#submit_to_remote a wrapper around PrototypeHelper#button_to_remote. [Tarmo Tänav] - -* Set HttpOnly for the cookie session store's cookie. #1046 - -* Added FormTagHelper#image_submit_tag confirm option #784 [Alastair Brunton] - -* Fixed FormTagHelper#submit_tag with :disable_with option wouldn't submit the button's value when was clicked #633 [Jose Fernandez] - -* Stopped logging template compiles as it only clogs up the log [David Heinemeier Hansson] - -* Changed the X-Runtime header to report in milliseconds [David Heinemeier Hansson] - -* Changed BenchmarkHelper#benchmark to report in milliseconds [David Heinemeier Hansson] - -* Changed logging format to be millisecond based and skip misleading stats [David Heinemeier Hansson]. Went from: - - Completed in 0.10000 (4 reqs/sec) | Rendering: 0.04000 (40%) | DB: 0.00400 (4%) | 200 OK [http://example.com] - - ...to: - - Completed in 100ms (View: 40, DB: 4) | 200 OK [http://example.com] - -* Add support for shallow nesting of routes. #838 [S. Brent Faulkner] - - Example : - - map.resources :users, :shallow => true do |user| - user.resources :posts - end - - - GET /users/1/posts (maps to PostsController#index action as usual) - named route "user_posts" is added as usual. - - - GET /posts/2 (maps to PostsController#show action as if it were not nested) - Additionally, named route "post" is added too. - -* Added button_to_remote helper. #3641 [Donald Piret, Tarmo Tänav] - -* Deprecate render_component. Please use render_component plugin from http://github.com/rails/render_component/tree/master [Pratik Naik] - -* Routes may be restricted to lists of HTTP methods instead of a single method or :any. #407 [Brennan Dunn, Gaius Centus Novus] - map.resource :posts, :collection => { :search => [:get, :post] } - map.session 'session', :requirements => { :method => [:get, :post, :delete] } - -* Deprecated implicit local assignments when rendering partials [Josh Peek] - -* Introduce current_cycle helper method to return the current value without bumping the cycle. #417 [Ken Collins] - -* Allow polymorphic_url helper to take url options. #880 [Tarmo Tänav] - -* Switched integration test runner to use Rack processor instead of CGI [Josh Peek] - -* Made AbstractRequest.if_modified_sense return nil if the header could not be parsed [Jamis Buck] - -* Added back ActionController::Base.allow_concurrency flag [Josh Peek] - -* AbstractRequest.relative_url_root is no longer automatically configured by a HTTP header. It can now be set in your configuration environment with config.action_controller.relative_url_root [Josh Peek] - -* Update Prototype to 1.6.0.2 #599 [Patrick Joyce] - -* Conditional GET utility methods. [Jeremy Kemper] - response.last_modified = @post.updated_at - response.etag = [:admin, @post, current_user] - - if request.fresh?(response) - head :not_modified - else - # render ... - end - -* All 2xx requests are considered successful [Josh Peek] - -* Fixed that AssetTagHelper#compute_public_path shouldn't cache the asset_host along with the source or per-request proc's won't run [David Heinemeier Hansson] - -* Removed config.action_view.cache_template_loading, use config.cache_classes instead [Josh Peek] - -* Get buffer for fragment cache from template's @output_buffer [Josh Peek] - -* Set config.action_view.warn_cache_misses = true to receive a warning if you perform an action that results in an expensive disk operation that could be cached [Josh Peek] - -* Refactor template preloading. New abstractions include Renderable mixins and a refactored Template class [Josh Peek] - -* Changed ActionView::TemplateHandler#render API method signature to render(template, local_assigns = {}) [Josh Peek] - -* Changed PrototypeHelper#submit_to_remote to PrototypeHelper#button_to_remote to stay consistent with link_to_remote (submit_to_remote still works as an alias) #8994 [clemens] - -* Add :recursive option to javascript_include_tag and stylesheet_link_tag to be used along with :all. #480 [Damian Janowski] - -* Allow users to disable the use of the Accept header [Michael Koziarski] - - The accept header is poorly implemented by browsers and causes strange - errors when used on public sites where crawlers make requests too. You - can use formatted urls (e.g. /people/1.xml) to support API clients in a - much simpler way. - - To disable the header you need to set: - - config.action_controller.use_accept_header = false - -* Do not stat template files in production mode before rendering. You will no longer be able to modify templates in production mode without restarting the server [Josh Peek] - -* Deprecated TemplateHandler line offset [Josh Peek] - -* Allow caches_action to accept cache store options. #416. [José Valim]. Example: - - caches_action :index, :redirected, :if => Proc.new { |c| !c.request.format.json? }, :expires_in => 1.hour - -* Remove define_javascript_functions, javascript_include_tag and friends are far superior. [Michael Koziarski] - -* Deprecate :use_full_path render option. The supplying the option no longer has an effect [Josh Peek] - -* Add :as option to render a collection of partials with a custom local variable name. #509 [Simon Jefford, Pratik Naik] - - render :partial => 'other_people', :collection => @people, :as => :person - - This will let you access objects of @people as 'person' local variable inside 'other_people' partial template. - -* time_zone_select: support for regexp matching of priority zones. Resolves #195 [Ernie Miller] - -* Made ActionView::Base#render_file private [Josh Peek] - -* Refactor and simplify the implementation of assert_redirected_to. Arguments are now normalised relative to the controller being tested, not the root of the application. [Michael Koziarski] - - This could cause some erroneous test failures if you were redirecting between controllers - in different namespaces and wrote your assertions relative to the root of the application. - -* Remove follow_redirect from controller functional tests. - - If you want to follow redirects you can use integration tests. The functional test - version was only useful if you were using redirect_to :id=>... - -* Fix polymorphic_url with singleton resources. #461 [Tammer Saleh] - -* Replaced TemplateFinder abstraction with ViewLoadPaths [Josh Peek] - -* Added block-call style to link_to [Sam Stephenson/David Heinemeier Hansson]. Example: - - <% link_to(@profile) do %> - <%= @profile.name %> -- Check it out!! - <% end %> - -* Performance: integration test benchmarking and profiling. [Jeremy Kemper] - -* Make caching more aware of mime types. Ensure request format is not considered while expiring cache. [Jonathan del Strother] - -* Drop ActionController::Base.allow_concurrency flag [Josh Peek] - -* More efficient concat and capture helpers. Remove ActionView::Base.erb_variable. [Jeremy Kemper] - -* Added page.reload functionality. Resolves #277. [Sean Huber] - -* Fixed Request#remote_ip to only raise hell if the HTTP_CLIENT_IP and HTTP_X_FORWARDED_FOR doesn't match (not just if they're both present) [Mark Imbriaco, Bradford Folkens] - -* Allow caches_action to accept a layout option [José Valim] - -* Added Rack processor [Ezra Zygmuntowicz, Josh Peek] - - -*2.1.0 (May 31st, 2008)* - -* InstanceTag#default_time_from_options overflows to DateTime [Geoff Buesing] - -* Fixed that forgery protection can be used without session tracking (Peter Jones) [#139] - -* Added session(:on) to turn session management back on in a controller subclass if the superclass turned it off (Peter Jones) [#136] - -* Change the request forgery protection to go by Content-Type instead of request.format so that you can't bypass it by POSTing to "#{request.uri}.xml" [Rick Olson] -* InstanceTag#default_time_from_options with hash args uses Time.current as default; respects hash settings when time falls in system local spring DST gap [Geoff Buesing] - -* select_date defaults to Time.zone.today when config.time_zone is set [Geoff Buesing] - -* Fixed that TextHelper#text_field would corrypt when raw HTML was used as the value (mchenryc, Kevin Glowacz) [#80] - -* Added ActionController::TestCase#rescue_action_in_public! to control whether the action under test should use the regular rescue_action path instead of simply raising the exception inline (great for error testing) [David Heinemeier Hansson] - -* Reduce number of instance variables being copied from controller to view. [Pratik Naik] - -* select_datetime and select_time default to Time.zone.now when config.time_zone is set [Geoff Buesing] - -* datetime_select defaults to Time.zone.now when config.time_zone is set [Geoff Buesing] - -* Remove ActionController::Base#view_controller_internals flag. [Pratik Naik] - -* Add conditional options to caches_page method. [Paul Horsfall] - -* Move missing template logic to ActionView. [Pratik Naik] - -* Introduce ActionView::InlineTemplate class. [Pratik Naik] - -* Automatically parse posted JSON content for Mime::JSON requests. [Rick Olson] - - POST /posts - {"post": {"title": "Breaking News"}} - - def create - @post = Post.create params[:post] - # ... - end - -* add json_escape ERB util to escape html entities in json strings that are output in HTML pages. [Rick Olson] - -* Provide a helper proxy to access helper methods from outside views. Closes #10839 [Josh Peek] - e.g. ApplicationController.helpers.simple_format(text) - -* Improve documentation. [Xavier Noria, leethal, jerome] - -* Ensure RJS redirect_to doesn't html-escapes string argument. Closes #8546 [Josh Peek, eventualbuddha, Pratik Naik] - -* Support render :partial => collection of heterogeneous elements. #11491 [Zach Dennis] - -* Avoid remote_ip spoofing. [Brian Candler] - -* Added support for regexp flags like ignoring case in the :requirements part of routes declarations #11421 [NeilW] - -* Fixed that ActionController::Base#read_multipart would fail if boundary was exactly 10240 bytes #10886 [ariejan] - -* Fixed HTML::Tokenizer (used in sanitize helper) didn't handle unclosed CDATA tags #10071 [esad, packagethief] - -* Improve documentation. [Ryan Bigg, Jan De Poorter, Cheah Chu Yeow, Xavier Shay, Jack Danger Canty, Emilio Tagua, Xavier Noria, Sunny Ripert] - -* Fixed that FormHelper#radio_button would produce invalid ids #11298 [harlancrystal] - -* Added :confirm option to submit_tag #11415 [Emilio Tagua] - -* Fixed NumberHelper#number_with_precision to properly round in a way that works equally on Mac, Windows, Linux (closes #11409, #8275, #10090, #8027) [zhangyuanyi] - -* Allow the #simple_format text_helper to take an html_options hash for each paragraph. #2448 [François Beausoleil, Chris O'Sullivan] - -* Fix regression from filter refactoring where re-adding a skipped filter resulted in it being called twice. [Rick Olson] - -* Refactor filters to use Active Support callbacks. #11235 [Josh Peek] - -* Fixed that polymorphic routes would modify the input array #11363 [thomas.lee] - -* Added :format option to NumberHelper#number_to_currency to enable better localization support #11149 [lylo] - -* Fixed that TextHelper#excerpt would include one character too many #11268 [Irfy] - -* Fix more obscure nested parameter hash parsing bug. #10797 [thomas.lee] - -* Added ActionView::Helpers::register_javascript/stylesheet_expansion to make it easier for plugin developers to inject multiple assets. #10350 [lotswholetime] - -* Fix nested parameter hash parsing bug. #10797 [thomas.lee] - -* Allow using named routes in ActionController::TestCase before any request has been made. Closes #11273 [Eloy Duran] - -* Fixed that sweepers defined by cache_sweeper will be added regardless of the perform_caching setting. Instead, control whether the sweeper should be run with the perform_caching setting. This makes testing easier when you want to turn perform_caching on/off [David Heinemeier Hansson] - -* Make MimeResponds::Responder#any work without explicit types. Closes #11140 [jaw6] - -* Better error message for type conflicts when parsing params. Closes #7962 [spicycode, matt] - -* Remove unused ActionController::Base.template_class. Closes #10787 [Pratik Naik] - -* Moved template handlers related code from ActionView::Base to ActionView::Template. [Pratik Naik] - -* Tests for div_for and content_tag_for helpers. Closes #11223 [Chris O'Sullivan] - -* Allow file uploads in Integration Tests. Closes #11091 [RubyRedRick] - -* Refactor partial rendering into a PartialTemplate class. [Pratik Naik] - -* Added that requests with JavaScript as the priority mime type in the accept header and no format extension in the parameters will be treated as though their format was :js when it comes to determining which template to render. This makes it possible for JS requests to automatically render action.js.rjs files without an explicit respond_to block [David Heinemeier Hansson] - -* Tests for distance_of_time_in_words with TimeWithZone instances. Closes #10914 [Ernesto Jimenez] - -* Remove support for multivalued (e.g., '&'-delimited) cookies. [Jamis Buck] - -* Fix problem with render :partial collections, records, and locals. #11057 [lotswholetime] - -* Added support for naming concrete classes in sweeper declarations [David Heinemeier Hansson] - -* Remove ERB trim variables from trace template in case ActionView::Base.erb_trim_mode is changed in the application. #10098 [Tim Pope, Chris Kampmeier] - -* Fix typo in form_helper documentation. #10650 [Xavier Shay, Chris Kampmeier] - -* Fix bug with setting Request#format= after the getter has cached the value. #10889 [cch1] - -* Correct inconsistencies in RequestForgeryProtection docs. #11032 [Mislav Marohnić] - -* Introduce a Template class to ActionView. #11024 [Pratik Naik] - -* Introduce the :index option for form_for and fields_for to simplify multi-model forms (see http://railscasts.com/episodes/75). #9883 [rmm5t] - -* Introduce map.resources :cards, :as => 'tarjetas' to use a custom resource name in the URL: cards_path == '/tarjetas'. #10578 [blj] - -* TestSession supports indifferent access. #7372 [tamc, Arsen7, mhackett, julik, jean.helou] - -* Make assert_routing aware of the HTTP method used. #8039 [mpalmer] - e.g. assert_routing({ :method => 'put', :path => '/product/321' }, { :controller => "product", :action => "update", :id => "321" }) - -* Make map.root accept a single symbol as an argument to declare an alias. #10818 [bscofield] - - e.g. map.dashboard '/dashboard', :controller=>'dashboard' - map.root :dashboard - -* Handle corner case with image_tag when passed 'messed up' image names. #9018 [Duncan Beevers, mpalmer] - -* Add label_tag helper for generating elements. #10802 [DefV] - -* Introduce TemplateFinder to handle view paths and lookups. #10800 [Pratik Naik] - -* Performance: optimize route recognition. Large speedup for apps with many resource routes. #10835 [oleganza] - -* Make render :partial recognise form builders and use the _form partial. #10814 [Damian Janowski] - -* Allow users to declare other namespaces when using the atom feed helpers. #10304 [david.calavera] - -* Introduce send_file :x_sendfile => true to send an X-Sendfile response header. [Jeremy Kemper] - -* Fixed ActionView::Helpers::ActiveRecordHelper::form for when protect_from_forgery is used #10739 [Jeremy Evans] - -* Provide nicer access to HTTP Headers. Instead of request.env["HTTP_REFERRER"] you can now use request.headers["Referrer"]. [Michael Koziarski] - -* UrlWriter respects relative_url_root. #10748 [Cheah Chu Yeow] - -* The asset_host block takes the controller request as an optional second argument. Example: use a single asset host for SSL requests. #10549 [Cheah Chu Yeow, Peter B, Tom Taylor] - -* Support render :text => nil. #6684 [tjennings, PotatoSalad, Cheah Chu Yeow] - -* assert_response failures include the exception message. #10688 [Seth Rasmussen] - -* All fragment cache keys are now by default prefixed with the "views/" namespace [David Heinemeier Hansson] - -* Moved the caching stores from ActionController::Caching::Fragments::* to ActiveSupport::Cache::*. If you're explicitly referring to a store, like ActionController::Caching::Fragments::MemoryStore, you need to update that reference with ActiveSupport::Cache::MemoryStore [David Heinemeier Hansson] - -* Deprecated ActionController::Base.fragment_cache_store for ActionController::Base.cache_store [David Heinemeier Hansson] - -* Made fragment caching in views work for rjs and builder as well #6642 [Dee Zsombor] - -* Fixed rendering of partials with layout when done from site layout #9209 [antramm] - -* Fix atom_feed_helper to comply with the atom spec. Closes #10672 [Xavier Shay] - - * The tags created do not contain a date (http://feedvalidator.org/docs/error/InvalidTAG.html) - * IDs are not guaranteed unique - * A default self link was not provided, contrary to the documentation - * NOTE: This changes tags for existing atom entries, but at least they validate now. - -* Correct indentation in tests. Closes #10671 [Luca Guidi] - -* Fix that auto_link looks for ='s in url paths (Amazon urls have them). Closes #10640 [Brad Greenlee] - -* Ensure that test case setup is run even if overridden. #10382 [Josh Peek] - -* Fix HTML Sanitizer to allow trailing spaces in CSS style attributes. Closes #10566 [wesley.moxam] - -* Add :default option to time_zone_select. #10590 [Matt Aimonetti] - - -*2.0.2* (December 16th, 2007) - -* Added delete_via_redirect and put_via_redirect to integration testing #10497 [philodespotos] - -* Allow headers['Accept'] to be set by hand when calling xml_http_request #10461 [BMorearty] - -* Added OPTIONS to list of default accepted HTTP methods #10449 [holoway] - -* Added option to pass proc to ActionController::Base.asset_host for maximum configurability #10521 [Cheah Chu Yeow]. Example: - - ActionController::Base.asset_host = Proc.new { |source| - if source.starts_with?('/images') - "http://images.example.com" - else - "http://assets.example.com" - end - } - -* Fixed that ActionView#file_exists? would be incorrect if @first_render is set #10569 [dbussink] - -* Added that Array#to_param calls to_param on all it's elements #10473 [brandon] - -* Ensure asset cache directories are automatically created. #10337 [Josh Peek, Cheah Chu Yeow] - -* render :xml and :json preserve custom content types. #10388 [jmettraux, Cheah Chu Yeow] - -* Refactor Action View template handlers. #10437, #10455 [Josh Peek] - -* Fix DoubleRenderError message and leave out mention of returning false from filters. Closes #10380 [Frederick Cheung] - -* Clean up some cruft around ActionController::Base#head. Closes #10417 [ssoroka] - - -*2.0.1* (December 7th, 2007) - -* Fixed send_file/binary_content for testing #8044 [tolsen] - -* When a NonInferrableControllerError is raised, make the proposed fix clearer in the error message. Closes #10199 [Jack Danger Canty] - -* Update Prototype to 1.6.0.1. [sam] - -* Update script.aculo.us to 1.8.0.1. [madrobby] - -* Add 'disabled' attribute to