From 934f98e4cf7c43f8c632496b02ac99492d6b3de1 Mon Sep 17 00:00:00 2001 From: Pratik Naik Date: Sun, 2 Nov 2008 23:19:44 +0530 Subject: Dont dup params twice when filter_parameters is present --- actionpack/lib/action_controller/base.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'actionpack/lib') diff --git a/actionpack/lib/action_controller/base.rb b/actionpack/lib/action_controller/base.rb index 087fdc35cd..61f9f354c3 100644 --- a/actionpack/lib/action_controller/base.rb +++ b/actionpack/lib/action_controller/base.rb @@ -1244,8 +1244,8 @@ module ActionController #:nodoc: end def log_processing_for_parameters - parameters = respond_to?(:filter_parameters) ? filter_parameters(params) : params - parameters = parameters.except(:controller, :action, :format) + parameters = respond_to?(:filter_parameters) ? filter_parameters(params) : params.dup + parameters = parameters.except!(:controller, :action, :format) logger.info " Parameters: #{parameters.inspect}" end -- cgit v1.2.3 From 18bf7b421d55c60029289edef1df409a58d021e4 Mon Sep 17 00:00:00 2001 From: Pratik Naik Date: Sun, 2 Nov 2008 23:23:19 +0530 Subject: Remove unused debug_routes --- actionpack/lib/action_controller/base.rb | 6 ------ 1 file changed, 6 deletions(-) (limited to 'actionpack/lib') diff --git a/actionpack/lib/action_controller/base.rb b/actionpack/lib/action_controller/base.rb index 61f9f354c3..b001b355dc 100644 --- a/actionpack/lib/action_controller/base.rb +++ b/actionpack/lib/action_controller/base.rb @@ -278,12 +278,6 @@ module ActionController #:nodoc: @@consider_all_requests_local = true cattr_accessor :consider_all_requests_local - # Enable or disable the collection of failure information for RoutingErrors. - # This information can be extremely useful when tweaking custom routes, but is - # pointless once routes have been tested and verified. - @@debug_routes = true - cattr_accessor :debug_routes - # Indicates whether to allow concurrent action processing. Your # controller actions and any other code they call must also behave well # when called from concurrent threads. Turned off by default. -- cgit v1.2.3 From b29f95ed9a4f09674a187b237acc143ac5f4ddde Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Tue, 4 Nov 2008 18:12:32 +0100 Subject: Dont log the _method attribute either. Its already available in the header --- actionpack/lib/action_controller/base.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'actionpack/lib') diff --git a/actionpack/lib/action_controller/base.rb b/actionpack/lib/action_controller/base.rb index 74c04147fb..fc59668107 100644 --- a/actionpack/lib/action_controller/base.rb +++ b/actionpack/lib/action_controller/base.rb @@ -1073,7 +1073,7 @@ module ActionController #:nodoc: status = 302 end - response.redirected_to= options + response.redirected_to = options logger.info("Redirected to #{options}") if logger && logger.info? case options @@ -1248,7 +1248,7 @@ module ActionController #:nodoc: def log_processing_for_parameters parameters = respond_to?(:filter_parameters) ? filter_parameters(params) : params - parameters = parameters.except(:controller, :action, :format) + parameters = parameters.except(:controller, :action, :format, :_method) logger.info " Parameters: #{parameters.inspect}" end -- cgit v1.2.3 From b2cd318c2e3f4d19813a5c62903319a6683aa561 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bernardo=20de=20P=C3=A1dua?= Date: Tue, 4 Nov 2008 00:28:17 -0200 Subject: 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 state:committed] Signed-off-by: David Heinemeier Hansson --- actionpack/lib/action_view/helpers/date_helper.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'actionpack/lib') diff --git a/actionpack/lib/action_view/helpers/date_helper.rb b/actionpack/lib/action_view/helpers/date_helper.rb index d4d2c6ef53..919c937444 100644 --- a/actionpack/lib/action_view/helpers/date_helper.rb +++ b/actionpack/lib/action_view/helpers/date_helper.rb @@ -539,7 +539,7 @@ module ActionView # If the day is hidden and the month is visible, the day should be set to the 1st so all month choices are # valid (otherwise it could be 31 and february wouldn't be a valid date) - if @options[:discard_day] && !@options[:discard_month] + if @datetime && @options[:discard_day] && !@options[:discard_month] @datetime = @datetime.change(:day => 1) end @@ -567,7 +567,7 @@ module ActionView # If the day is hidden and the month is visible, the day should be set to the 1st so all month choices are # valid (otherwise it could be 31 and february wouldn't be a valid date) - if @options[:discard_day] && !@options[:discard_month] + if @datetime && @options[:discard_day] && !@options[:discard_month] @datetime = @datetime.change(:day => 1) end end -- cgit v1.2.3 From 5fad229e43e2b2541ed39c6ef571975176e6a8d2 Mon Sep 17 00:00:00 2001 From: Vladimir Dobriakov Date: Tue, 4 Nov 2008 13:46:36 +0100 Subject: Fixed that FormTagHelper generates illegal html if name contains e.g. square brackets [#1238 state:committed] Signed-off-by: David Heinemeier Hansson --- actionpack/lib/action_view/helpers/form_tag_helper.rb | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'actionpack/lib') diff --git a/actionpack/lib/action_view/helpers/form_tag_helper.rb b/actionpack/lib/action_view/helpers/form_tag_helper.rb index 7492348c50..4646bc118b 100644 --- a/actionpack/lib/action_view/helpers/form_tag_helper.rb +++ b/actionpack/lib/action_view/helpers/form_tag_helper.rb @@ -78,7 +78,7 @@ module ActionView # # def select_tag(name, option_tags = nil, options = {}) html_name = (options[:multiple] == true && !name.to_s.ends_with?("[]")) ? "#{name}[]" : name - content_tag :select, option_tags, { "name" => html_name, "id" => name }.update(options.stringify_keys) + content_tag :select, option_tags, { "name" => html_name, "id" => sanitize_to_id(name) }.update(options.stringify_keys) end # Creates a standard text field; use these text fields to input smaller chunks of text like a username @@ -112,7 +112,7 @@ module ActionView # text_field_tag 'ip', '0.0.0.0', :maxlength => 15, :size => 20, :class => "ip-input" # # => def text_field_tag(name, value = nil, options = {}) - tag :input, { "type" => "text", "name" => name, "id" => name, "value" => value }.update(options.stringify_keys) + tag :input, { "type" => "text", "name" => name, "id" => sanitize_to_id(name), "value" => value }.update(options.stringify_keys) end # Creates a label field @@ -130,7 +130,7 @@ module ActionView # label_tag 'name', nil, :class => 'small_label' # # => def label_tag(name, text = nil, options = {}) - content_tag :label, text || name.to_s.humanize, { "for" => name }.update(options.stringify_keys) + content_tag :label, text || name.to_s.humanize, { "for" => sanitize_to_id(name) }.update(options.stringify_keys) end # Creates a hidden form input field used to transmit data that would be lost due to HTTP's statelessness or @@ -282,7 +282,7 @@ module ActionView # check_box_tag 'eula', 'accepted', false, :disabled => true # # => def check_box_tag(name, value = "1", checked = false, options = {}) - html_options = { "type" => "checkbox", "name" => name, "id" => name, "value" => value }.update(options.stringify_keys) + html_options = { "type" => "checkbox", "name" => name, "id" => sanitize_to_id(name), "value" => value }.update(options.stringify_keys) html_options["checked"] = "checked" if checked tag :input, html_options end @@ -470,6 +470,12 @@ module ActionView tag(:input, :type => "hidden", :name => request_forgery_protection_token.to_s, :value => form_authenticity_token) end end + + # see http://www.w3.org/TR/html4/types.html#type-name + def sanitize_to_id(name) + name.to_s.gsub(']','').gsub(/[^-a-zA-Z0-9:.]/, "_") + end + end end end -- cgit v1.2.3