From ac015b1d07241f9702af41b079d27985c9b9a20f Mon Sep 17 00:00:00 2001 From: Carl Lerche <carllerche@mac.com> Date: Fri, 16 Apr 2010 15:33:15 -0700 Subject: Revert "Avoid deprecation warnings and potential TypeErrors [#4404 state:resolved]" Revert "protected instance variables added to the deprecated config accessor This reverts commit 4bce5ba600596b5e7afec9b097866ac259c5940a and 0ee2d3c89a893f0c53924cbb756c7e9be616eb8f. --- actionpack/lib/abstract_controller/assigns.rb | 4 ++-- actionpack/lib/abstract_controller/rendering.rb | 2 +- actionpack/lib/action_controller/deprecated/base.rb | 1 - 3 files changed, 3 insertions(+), 4 deletions(-) (limited to 'actionpack/lib') diff --git a/actionpack/lib/abstract_controller/assigns.rb b/actionpack/lib/abstract_controller/assigns.rb index 4f58cac91f..21459c6d51 100644 --- a/actionpack/lib/abstract_controller/assigns.rb +++ b/actionpack/lib/abstract_controller/assigns.rb @@ -6,7 +6,7 @@ module AbstractController def view_assigns hash = {} variables = instance_variable_names - variables -= config.protected_instance_variables if config.respond_to?(:protected_instance_variables) + variables -= protected_instance_variables if respond_to?(:protected_instance_variables) variables.each { |name| hash[name] = instance_variable_get(name) } hash end @@ -18,4 +18,4 @@ module AbstractController view_assigns.each { |k,v| object.instance_variable_set(k, v) } end end -end +end \ No newline at end of file diff --git a/actionpack/lib/abstract_controller/rendering.rb b/actionpack/lib/abstract_controller/rendering.rb index f1e6f7deb6..d2db366140 100644 --- a/actionpack/lib/abstract_controller/rendering.rb +++ b/actionpack/lib/abstract_controller/rendering.rb @@ -126,7 +126,7 @@ module AbstractController def view_assigns hash = {} variables = instance_variable_names - variables -= config.protected_instance_variables if config.respond_to?(:protected_instance_variables) + variables -= protected_instance_variables if respond_to?(:protected_instance_variables) variables.each { |name| hash[name.to_s[1..-1]] = instance_variable_get(name) } hash end diff --git a/actionpack/lib/action_controller/deprecated/base.rb b/actionpack/lib/action_controller/deprecated/base.rb index f91f637db8..57203ce95f 100644 --- a/actionpack/lib/action_controller/deprecated/base.rb +++ b/actionpack/lib/action_controller/deprecated/base.rb @@ -154,7 +154,6 @@ module ActionController deprecated_config_accessor :helpers_path deprecated_config_accessor :javascripts_dir deprecated_config_accessor :page_cache_directory - deprecated_config_accessor :protected_instance_variables deprecated_config_accessor :relative_url_root, "relative_url_root is ineffective. Please stop using it" deprecated_config_accessor :stylesheets_dir -- cgit v1.2.3 From c16c248912e4ae3b6a64e6acdbf1a1e0dd2feb26 Mon Sep 17 00:00:00 2001 From: Sam Elliott <sam@lenary.co.uk> Date: Fri, 16 Apr 2010 23:24:57 +0100 Subject: mail_to with :encode => :javascript now outputs safe html Signed-off-by: Carl Lerche <carllerche@mac.com> --- actionpack/lib/action_view/helpers/url_helper.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'actionpack/lib') diff --git a/actionpack/lib/action_view/helpers/url_helper.rb b/actionpack/lib/action_view/helpers/url_helper.rb index 0b748d700b..4ffc5ea127 100644 --- a/actionpack/lib/action_view/helpers/url_helper.rb +++ b/actionpack/lib/action_view/helpers/url_helper.rb @@ -504,7 +504,7 @@ module ActionView "document.write('#{content_tag("a", name || email_address_obfuscated.html_safe, html_options.merge({ "href" => "mailto:"+email_address+extras }))}');".each_byte do |c| string << sprintf("%%%x", c) end - "<script type=\"#{Mime::JS}\">eval(decodeURIComponent('#{string}'))</script>" + "<script type=\"#{Mime::JS}\">eval(decodeURIComponent('#{string}'))</script>".html_safe elsif encode == "hex" email_address_encoded = '' email_address_obfuscated.each_byte do |c| -- cgit v1.2.3 From 457f7709e964a62a24562010c0f79445976cce8b Mon Sep 17 00:00:00 2001 From: wycats <wycats@gmail.com> Date: Fri, 16 Apr 2010 21:56:35 -0400 Subject: Missing requires --- actionpack/lib/action_dispatch/http/response.rb | 1 + actionpack/lib/action_view/test_case.rb | 1 + 2 files changed, 2 insertions(+) (limited to 'actionpack/lib') diff --git a/actionpack/lib/action_dispatch/http/response.rb b/actionpack/lib/action_dispatch/http/response.rb index 362e5ec970..8b730a97ee 100644 --- a/actionpack/lib/action_dispatch/http/response.rb +++ b/actionpack/lib/action_dispatch/http/response.rb @@ -1,6 +1,7 @@ require 'digest/md5' require 'active_support/core_ext/module/delegation' require 'active_support/core_ext/object/blank' +require 'active_support/core_ext/class/attribute_accessors' module ActionDispatch # :nodoc: # Represents an HTTP response generated by a controller action. One can use diff --git a/actionpack/lib/action_view/test_case.rb b/actionpack/lib/action_view/test_case.rb index ddea9cfd92..beda7743bf 100644 --- a/actionpack/lib/action_view/test_case.rb +++ b/actionpack/lib/action_view/test_case.rb @@ -1,4 +1,5 @@ require 'active_support/core_ext/object/blank' +require 'action_controller' require 'action_controller/test_case' require 'action_view' -- cgit v1.2.3 From 4327ad51abfddde822766702d154df11bd5b47a3 Mon Sep 17 00:00:00 2001 From: David Chelimsky <dchelimsky@gmail.com> Date: Sat, 17 Apr 2010 14:52:37 -0500 Subject: access assigns as a method or hash, with strings or symbols [#4431 state:resolved] --- actionpack/lib/action_dispatch/testing/test_process.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'actionpack/lib') diff --git a/actionpack/lib/action_dispatch/testing/test_process.rb b/actionpack/lib/action_dispatch/testing/test_process.rb index d4eecac2de..79f309cae7 100644 --- a/actionpack/lib/action_dispatch/testing/test_process.rb +++ b/actionpack/lib/action_dispatch/testing/test_process.rb @@ -3,13 +3,13 @@ require 'action_dispatch/middleware/flash' module ActionDispatch module TestProcess def assigns(key = nil) - assigns = {} + assigns = {}.with_indifferent_access @controller.instance_variable_names.each do |ivar| next if ActionController::Base.protected_instance_variables.include?(ivar) assigns[ivar[1..-1]] = @controller.instance_variable_get(ivar) end - key.nil? ? assigns : assigns[key.to_s] + key.nil? ? assigns : assigns[key] end def session -- cgit v1.2.3 From 8c7e8976e97d96f514e22b04fc1afb9453134076 Mon Sep 17 00:00:00 2001 From: Diego Carrion <dc.rec1@gmail.com> Date: Fri, 16 Apr 2010 20:04:29 -0300 Subject: added shorthand support for routes like /projects/status(.:format) Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net> --- actionpack/lib/action_dispatch/routing/mapper.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'actionpack/lib') diff --git a/actionpack/lib/action_dispatch/routing/mapper.rb b/actionpack/lib/action_dispatch/routing/mapper.rb index 53585740ce..ef2826a4e8 100644 --- a/actionpack/lib/action_dispatch/routing/mapper.rb +++ b/actionpack/lib/action_dispatch/routing/mapper.rb @@ -66,8 +66,8 @@ module ActionDispatch path = normalize_path(path) if using_match_shorthand?(path, options) - options[:to] ||= path[1..-1].sub(%r{/([^/]*)$}, '#\1') - options[:as] ||= path[1..-1].gsub("/", "_") + options[:to] ||= path[1..-1].sub(%r{/([^/]*)$}, '#\1').sub(%r{\(.*\)}, '') + options[:as] ||= path[1..-1].gsub("/", "_").sub(%r{\(.*\)}, '') end [ path, options ] @@ -80,7 +80,7 @@ module ActionDispatch # match "account/overview" def using_match_shorthand?(path, options) - path && options.except(:via, :anchor, :to, :as).empty? && path =~ %r{^/[\w\/]+$} + path && options.except(:via, :anchor, :to, :as).empty? && path =~ %r{^/[\w+/?]+(\(.*\))*$} end def normalize_path(path) -- cgit v1.2.3 From 4309c1fda3d778b16569b74a7d86ec19b5e994a3 Mon Sep 17 00:00:00 2001 From: Santiago Pastorino <santiago@wyeworks.com> Date: Sat, 17 Apr 2010 19:08:49 -0300 Subject: perform_caching is now delegated to config on instance and class level --- actionpack/lib/action_controller/caching.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'actionpack/lib') diff --git a/actionpack/lib/action_controller/caching.rb b/actionpack/lib/action_controller/caching.rb index b3fa129929..0da0ca1893 100644 --- a/actionpack/lib/action_controller/caching.rb +++ b/actionpack/lib/action_controller/caching.rb @@ -63,8 +63,9 @@ module ActionController #:nodoc: included do extend ConfigMethods - @@perform_caching = true - cattr_accessor :perform_caching + delegate :perform_caching, :perform_caching=, :to => :config + singleton_class.delegate :perform_caching, :perform_caching=, :to => :config + self.perform_caching = true end -- cgit v1.2.3 From 9c4ac84e495c1476758aa8bcc764f6c1a935f404 Mon Sep 17 00:00:00 2001 From: Santiago Pastorino <santiago@wyeworks.com> Date: Sat, 17 Apr 2010 19:10:10 -0300 Subject: perform_caching should be accessed through the controller here --- actionpack/lib/action_view/helpers/cache_helper.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'actionpack/lib') diff --git a/actionpack/lib/action_view/helpers/cache_helper.rb b/actionpack/lib/action_view/helpers/cache_helper.rb index 9c6fc752e5..a904af56bb 100644 --- a/actionpack/lib/action_view/helpers/cache_helper.rb +++ b/actionpack/lib/action_view/helpers/cache_helper.rb @@ -39,7 +39,7 @@ module ActionView private # TODO: Create an object that has caching read/write on it def fragment_for(name = {}, options = nil, &block) #:nodoc: - if controller.class.perform_caching + if controller.perform_caching if controller.fragment_exist?(name, options) controller.read_fragment(name, options) else -- cgit v1.2.3 From 978c80d6e347b060dc11ee666c8a3a61fc9408a4 Mon Sep 17 00:00:00 2001 From: Santiago Pastorino <santiago@wyeworks.com> Date: Sun, 18 Apr 2010 14:02:46 -0300 Subject: Missing require added --- actionpack/lib/action_dispatch/middleware/params_parser.rb | 1 + 1 file changed, 1 insertion(+) (limited to 'actionpack/lib') diff --git a/actionpack/lib/action_dispatch/middleware/params_parser.rb b/actionpack/lib/action_dispatch/middleware/params_parser.rb index 1524b00d5b..09fb1f998a 100644 --- a/actionpack/lib/action_dispatch/middleware/params_parser.rb +++ b/actionpack/lib/action_dispatch/middleware/params_parser.rb @@ -1,3 +1,4 @@ +require 'active_support/core_ext/hash/conversions.rb' require 'action_dispatch/http/request' module ActionDispatch -- cgit v1.2.3