Permalink
Browse files

Merge commit 'rails/master'

  • Loading branch information...
2 parents 8f1a5bf + 2218493 commit b9ab4c780af82c1c60d63c50f040a55da5bfa8db @fxn fxn committed Apr 28, 2010
Showing with 2,408 additions and 1,408 deletions.
  1. +3 −0 Gemfile
  2. +1 −2 actionmailer/lib/action_mailer/base.rb
  3. +0 −2 actionmailer/test/old_base/mail_service_test.rb
  4. +2 −0 actionpack/CHANGELOG
  5. +0 −1 actionpack/lib/abstract_controller.rb
  6. +0 −21 actionpack/lib/abstract_controller/assigns.rb
  7. +4 −13 actionpack/lib/abstract_controller/base.rb
  8. +0 −1 actionpack/lib/abstract_controller/helpers.rb
  9. +1 −1 actionpack/lib/abstract_controller/logger.rb
  10. +4 −1 actionpack/lib/action_controller/base.rb
  11. +2 −4 actionpack/lib/action_controller/caching.rb
  12. +4 −4 actionpack/lib/action_controller/caching/pages.rb
  13. +9 −39 actionpack/lib/action_controller/deprecated/base.rb
  14. +2 −2 actionpack/lib/action_controller/metal/compatibility.rb
  15. +2 −2 actionpack/lib/action_controller/metal/helpers.rb
  16. +3 −3 actionpack/lib/action_controller/metal/renderers.rb
  17. +44 −74 actionpack/lib/action_controller/metal/request_forgery_protection.rb
  18. +26 −39 actionpack/lib/action_controller/railtie.rb
  19. +134 −126 actionpack/lib/action_controller/test_case.rb
  20. +2 −1 actionpack/lib/action_dispatch/http/parameters.rb
  21. +2 −1 actionpack/lib/action_dispatch/middleware/params_parser.rb
  22. +5 −4 actionpack/lib/action_dispatch/routing/mapper.rb
  23. +1 −1 actionpack/lib/action_dispatch/routing/url_for.rb
  24. +1 −0 actionpack/lib/action_dispatch/testing/assertions/routing.rb
  25. +1 −0 actionpack/lib/action_dispatch/testing/test_process.rb
  26. +2 −2 actionpack/lib/action_view/base.rb
  27. +1 −1 actionpack/lib/action_view/helpers/active_model_helper.rb
  28. +1 −1 actionpack/lib/action_view/helpers/prototype_helper.rb
  29. +1 −1 actionpack/lib/action_view/test_case.rb
  30. +7 −1 actionpack/test/abstract_unit.rb
  31. +1 −1 actionpack/test/controller/assert_select_test.rb
  32. +2 −1 actionpack/test/controller/layout_test.rb
  33. +18 −0 actionpack/test/controller/render_json_test.rb
  34. +17 −7 actionpack/test/controller/render_xml_test.rb
  35. +2 −2 actionpack/test/controller/send_file_test.rb
  36. +15 −1 actionpack/test/controller/url_for_test.rb
  37. +8 −2 actionpack/test/dispatch/routing_test.rb
  38. +4 −4 actionpack/test/template/active_model_helper_test.rb
  39. +0 −3 actionpack/test/template/form_tag_helper_test.rb
  40. +1 −0 actionpack/test/template/text_helper_test.rb
  41. +9 −0 actionpack/test/template/url_helper_test.rb
  42. +1 −0 activemodel/lib/active_model/locale/en.yml
  43. +17 −18 activemodel/lib/active_model/serializers/xml.rb
  44. +18 −11 activemodel/lib/active_model/validations/numericality.rb
  45. +9 −9 activemodel/test/cases/validations/i18n_validation_test.rb
  46. +4 −0 activerecord/CHANGELOG
  47. +10 −1 activerecord/lib/active_record/associations.rb
  48. +1 −2 activerecord/lib/active_record/base.rb
  49. +3 −7 activerecord/lib/active_record/connection_adapters/abstract/quoting.rb
  50. +23 −134 activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb
  51. +9 −7 activerecord/lib/active_record/fixtures.rb
  52. +34 −1 activerecord/lib/active_record/locking/optimistic.rb
  53. +1 −0 activerecord/lib/active_record/nested_attributes.rb
  54. +9 −13 activerecord/lib/active_record/railtie.rb
  55. +2 −2 activerecord/lib/active_record/railties/databases.rake
  56. +1 −0 activerecord/lib/active_record/relation/finder_methods.rb
  57. +1 −3 activerecord/lib/active_record/relation/query_methods.rb
  58. +0 −11 activerecord/lib/active_record/serializers/xml_serializer.rb
  59. +2 −2 activerecord/test/cases/finder_test.rb
  60. +9 −1 activerecord/test/cases/fixtures_test.rb
  61. +48 −3 activerecord/test/cases/locking_test.rb
  62. +2 −0 activerecord/test/fixtures/admin/accounts.yml
  63. +7 −0 activerecord/test/fixtures/admin/users.yml
  64. +5 −0 activerecord/test/models/admin.rb
  65. +3 −0 activerecord/test/models/admin/account.rb
  66. +3 −0 activerecord/test/models/admin/user.rb
  67. +9 −0 activerecord/test/schema/schema.rb
  68. +5 −0 activeresource/CHANGELOG
  69. +3 −72 activeresource/lib/active_resource/base.rb
  70. +6 −3 activeresource/test/cases/base_test.rb
  71. +39 −0 activesupport/CHANGELOG
  72. +427 −69 activesupport/lib/active_support/cache.rb
  73. +6 −15 activesupport/lib/active_support/cache/compressed_mem_cache_store.rb
  74. +139 −41 activesupport/lib/active_support/cache/file_store.rb
  75. +109 −75 activesupport/lib/active_support/cache/mem_cache_store.rb
  76. +125 −31 activesupport/lib/active_support/cache/memory_store.rb
  77. +102 −52 activesupport/lib/active_support/cache/strategy/local_cache.rb
  78. +2 −38 activesupport/lib/active_support/cache/synchronized_memory_store.rb
  79. +19 −18 activesupport/lib/active_support/configurable.rb
  80. +2 −1 activesupport/lib/active_support/core_ext/kernel/reporting.rb
  81. +3 −0 activesupport/lib/active_support/core_ext/string/conversions.rb
  82. +2 −1 activesupport/lib/active_support/core_ext/uri.rb
  83. +5 −1 activesupport/lib/active_support/hash_with_indifferent_access.rb
  84. +19 −5 activesupport/lib/active_support/json/encoding.rb
  85. +2 −2 activesupport/lib/active_support/multibyte/chars.rb
  86. +15 −5 activesupport/lib/active_support/notifications/fanout.rb
  87. +2 −1 activesupport/lib/active_support/testing/isolation.rb
  88. +3 −0 activesupport/lib/active_support/testing/setup_and_teardown.rb
  89. +10 −27 activesupport/lib/active_support/values/time_zone.rb
  90. +461 −188 activesupport/test/caching_test.rb
  91. +42 −0 activesupport/test/configurable_test.rb
  92. +39 −2 activesupport/test/core_ext/hash_ext_test.rb
  93. +6 −3 activesupport/test/core_ext/string_ext_test.rb
  94. +5 −2 activesupport/test/core_ext/time_with_zone_test.rb
  95. +1 −1 activesupport/test/core_ext/uri_ext_test.rb
  96. +21 −4 activesupport/test/json/encoding_test.rb
  97. +1 −1 activesupport/test/multibyte_chars_test.rb
  98. +22 −0 activesupport/test/notifications_test.rb
  99. +4 −4 activesupport/test/time_zone_test.rb
  100. +1 −0 railties/Rakefile
  101. +2 −2 railties/lib/rails/application.rb
  102. +2 −2 railties/lib/rails/application/configuration.rb
  103. +2 −1 railties/lib/rails/commands/dbconsole.rb
  104. +2 −1 railties/lib/rails/commands/runner.rb
  105. +3 −2 railties/lib/rails/engine.rb
  106. +3 −2 railties/lib/rails/generators/actions.rb
  107. +1 −1 railties/lib/rails/generators/erb/scaffold/templates/show.html.erb
  108. +2 −1 railties/lib/rails/generators/rails/app/app_generator.rb
  109. +0 −3 railties/lib/rails/generators/rails/app/templates/Rakefile
  110. +6 −2 railties/lib/rails/generators/rails/app/templates/config/boot.rb
  111. +5 −5 railties/lib/rails/generators/rails/app/templates/config/databases/postgresql.yml
  112. +2 −6 railties/lib/rails/generators/rails/stylesheets/templates/scaffold.css
  113. +2 −0 railties/lib/rails/tasks/documentation.rake
  114. +3 −1 railties/lib/rails/test_help.rb
  115. +3 −1 railties/lib/rails/test_unit/testing.rake
  116. +13 −68 railties/test/application/configuration_test.rb
  117. +0 −54 railties/test/application/middleware_stack_defaults_test.rb
  118. +93 −0 railties/test/application/middleware_test.rb
  119. +23 −0 railties/test/application/rake_test.rb
  120. +19 −0 railties/test/isolation/abstract_unit.rb
  121. +1 −0 tools/profile
View
@@ -7,6 +7,9 @@ gem "rake", ">= 0.8.7"
gem "mocha", ">= 0.9.8"
group :mri do
+ gem 'json'
+ gem 'yajl-ruby'
+
if RUBY_VERSION < '1.9'
gem "system_timer"
gem "ruby-debug", ">= 0.10.3"
@@ -291,8 +291,6 @@ class Base < AbstractController::Base
:parts_order => [ "text/plain", "text/enriched", "text/html" ]
}.freeze
- ActiveSupport.run_load_hooks(:action_mailer, self)
-
class << self
def mailer_name
@@ -643,5 +641,6 @@ def insert_part(container, response, charset) #:nodoc:
container.add_part(part)
end
+ ActiveSupport.run_load_hooks(:action_mailer, self)
end
end
@@ -866,7 +866,6 @@ def test_multipart_with_utf8_subject
regex = Regexp.escape('Subject: Foo =?UTF-8?Q?=C3=A1=C3=AB=C3=B4=?= =?UTF-8?Q?_=C3=AE=C3=BC=?=')
assert_match(/#{regex}/, mail.encoded)
string = "Foo áëô îü"
- string.force_encoding('UTF-8') if string.respond_to?(:force_encoding)
assert_match(string, mail.subject)
end
@@ -875,7 +874,6 @@ def test_implicitly_multipart_with_utf8
regex = Regexp.escape('Subject: Foo =?UTF-8?Q?=C3=A1=C3=AB=C3=B4=?= =?UTF-8?Q?_=C3=AE=C3=BC=?=')
assert_match(/#{regex}/, mail.encoded)
string = "Foo áëô îü"
- string.force_encoding('UTF-8') if string.respond_to?(:force_encoding)
assert_match(string, mail.subject)
end
@@ -1,5 +1,7 @@
*Rails 3.0.0 [beta 4/release candidate] (unreleased)*
+* 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]
@@ -12,7 +12,6 @@
module AbstractController
extend ActiveSupport::Autoload
- autoload :Assigns
autoload :Base
autoload :Callbacks
autoload :Collector
@@ -1,21 +0,0 @@
-module AbstractController
- module Assigns
- # This method should return a hash with assigns.
- # You can overwrite this configuration per controller.
- # :api: public
- def view_assigns
- hash = {}
- variables = instance_variable_names
- variables -= protected_instance_variables if respond_to?(:protected_instance_variables)
- variables.each { |name| hash[name] = instance_variable_get(name) }
- hash
- end
-
- # This method assigns the hash specified in _assigns_hash to the given object.
- # :api: private
- # TODO Ideally, this should be done on AV::Base.new initialization.
- def _evaluate_assigns(object)
- view_assigns.each { |k,v| object.instance_variable_set(k, v) }
- end
- end
-end
@@ -1,4 +1,4 @@
-require 'active_support/ordered_options'
+require 'active_support/configurable'
module AbstractController
class Error < StandardError; end
@@ -8,6 +8,8 @@ class Base
attr_internal :response_body
attr_internal :action_name
+ include ActiveSupport::Configurable
+
class << self
attr_reader :abstract
alias_method :abstract?, :abstract
@@ -29,14 +31,6 @@ def descendants
@descendants ||= []
end
- def config
- @config ||= ActiveSupport::InheritableOptions.new(superclass < Base ? superclass.config : {})
- end
-
- def configure
- yield config
- end
-
# A list of all internal methods for a controller. This finds the first
# abstract superclass of a controller, and gets a list of all public
# instance methods on that abstract class. Public instance methods of
@@ -99,10 +93,6 @@ def controller_path
abstract!
- def config
- @config ||= ActiveSupport::InheritableOptions.new(self.class.config)
- end
-
# Calls the action going through the entire action dispatch stack.
#
# The actual method that is called is determined by calling
@@ -133,6 +123,7 @@ def action_methods
end
private
+
# Returns true if the name can be considered an action. This can
# be overridden in subclasses to modify the semantics of what
# can be considered an action.
@@ -8,7 +8,6 @@ module Helpers
included do
class_attribute :_helpers
- delegate :_helpers, :to => :'self.class'
self._helpers = Module.new
end
@@ -6,7 +6,7 @@ module Logger
extend ActiveSupport::Concern
included do
- cattr_accessor :logger
+ config_accessor :logger
extend ActiveSupport::Benchmarkable
end
end
@@ -65,8 +65,11 @@ def self.subclasses
@subclasses ||= []
end
+ # TODO Move this to the appropriate module
+ config_accessor :assets_dir, :asset_path, :javascripts_dir, :stylesheets_dir
+
ActiveSupport.run_load_hooks(:action_controller, self)
end
end
-require "action_controller/deprecated/base"
+require "action_controller/deprecated/base"
@@ -63,12 +63,10 @@ def cache_configured?
included do
extend ConfigMethods
- delegate :perform_caching, :perform_caching=, :to => :config
- singleton_class.delegate :perform_caching, :perform_caching=, :to => :config
- self.perform_caching = true
+ config_accessor :perform_caching
+ self.perform_caching = true if perform_caching.nil?
end
-
def caching_allowed?
request.get? && response.status == 200
end
@@ -44,17 +44,17 @@ module Pages
# For Rails, this directory has already been set to Rails.public_path (which is usually set to <tt>Rails.root + "/public"</tt>). Changing
# this setting can be useful to avoid naming conflicts with files in <tt>public/</tt>, but doing so will likely require configuring your
# web server to look in the new location for cached files.
- singleton_class.delegate :page_cache_directory, :page_cache_directory=, :to => :config
- self.page_cache_directory = ''
+ config_accessor :page_cache_directory
+ self.page_cache_directory ||= ''
##
# :singleton-method:
# Most Rails requests do not have an extension, such as <tt>/weblog/new</tt>. In these cases, the page caching mechanism will add one in
# order to make it easy for the cached files to be picked up properly by the web server. By default, this cache extension is <tt>.html</tt>.
# If you want something else, like <tt>.php</tt> or <tt>.shtml</tt>, just set Base.page_cache_extension. In cases where a request already has an
# extension, such as <tt>.xml</tt> or <tt>.rss</tt>, page caching will not add an extension. This allows it to work well with RESTful apps.
- singleton_class.delegate :page_cache_extension, :page_cache_extension=, :to => :config
- self.page_cache_extension = '.html'
+ config_accessor :page_cache_extension
+ self.page_cache_extension ||= '.html'
end
module ClassMethods
@@ -1,33 +1,16 @@
module ActionController
class Base
- class << self
- def deprecated_config_accessor(option, message = nil)
- deprecated_config_reader(option, message)
- deprecated_config_writer(option, message)
+ # Deprecated methods. Wrap them in a module so they can be overwritten by plugins
+ # (like the verify method.)
+ module DeprecatedBehavior #:nodoc:
+ def relative_url_root
+ ActiveSupport::Deprecation.warn "ActionController::Base.relative_url_root is ineffective. " <<
+ "Please stop using it.", caller
end
- def deprecated_config_reader(option, message = nil)
- message ||= "Reading #{option} directly from ActionController::Base is deprecated. " \
- "Please read it from config.#{option}"
-
- self.class_eval <<-RUBY, __FILE__, __LINE__ + 1
- def #{option}
- ActiveSupport::Deprecation.warn #{message.inspect}, caller
- config.#{option}
- end
- RUBY
- end
-
- def deprecated_config_writer(option, message = nil)
- message ||= "Setting #{option} directly on ActionController::Base is deprecated. " \
- "Please set it on config.action_controller.#{option}"
-
- self.class_eval <<-RUBY, __FILE__, __LINE__ + 1
- def #{option}=(val)
- ActiveSupport::Deprecation.warn #{message.inspect}, caller
- config.#{option} = val
- end
- RUBY
+ def relative_url_root=
+ ActiveSupport::Deprecation.warn "ActionController::Base.relative_url_root= is ineffective. " <<
+ "Please stop using it.", caller
end
def consider_all_requests_local
@@ -125,9 +108,7 @@ def use_accept_header
def use_accept_header=(val)
use_accept_header
end
- end
- module DeprecatedBehavior
# This method has been moved to ActionDispatch::Request.filter_parameters
def filter_parameter_logging(*args, &block)
ActiveSupport::Deprecation.warn("Setting filter_parameter_logging in ActionController is deprecated and has no longer effect, please set 'config.filter_parameters' in config/application.rb instead", caller)
@@ -146,17 +127,6 @@ def verify(*args)
extend DeprecatedBehavior
- deprecated_config_writer :session_options
- deprecated_config_writer :session_store
-
- deprecated_config_accessor :assets_dir
- deprecated_config_accessor :asset_path
- deprecated_config_accessor :helpers_path
- deprecated_config_accessor :javascripts_dir
- deprecated_config_accessor :page_cache_directory
- deprecated_config_accessor :relative_url_root, "relative_url_root is ineffective. Please stop using it"
- deprecated_config_accessor :stylesheets_dir
-
delegate :consider_all_requests_local, :consider_all_requests_local=,
:allow_concurrency, :allow_concurrency=, :to => :"self.class"
end
@@ -21,8 +21,8 @@ class << self
delegate :default_charset=, :to => "ActionDispatch::Response"
end
- # cattr_reader :protected_instance_variables
- cattr_accessor :protected_instance_variables
+ # TODO: Update protected instance variables list
+ config_accessor :protected_instance_variables
self.protected_instance_variables = %w(@assigns @performed_redirect @performed_render
@variables_added @request_origin @url
@parent_controller @action_name
@@ -52,8 +52,8 @@ module Helpers
include AbstractController::Helpers
included do
- class_attribute :helpers_path
- self.helpers_path = []
+ config_accessor :helpers_path
+ self.helpers_path ||= []
end
module ClassMethods
@@ -71,20 +71,20 @@ def self._write_render_options
end
add :json do |json, options|
- json = ActiveSupport::JSON.encode(json) unless json.respond_to?(:to_str)
+ json = ActiveSupport::JSON.encode(json, options) unless json.respond_to?(:to_str)
json = "#{options[:callback]}(#{json})" unless options[:callback].blank?
self.content_type ||= Mime::JSON
self.response_body = json
end
add :js do |js, options|
self.content_type ||= Mime::JS
- self.response_body = js.respond_to?(:to_js) ? js.to_js : js
+ self.response_body = js.respond_to?(:to_js) ? js.to_js(options) : js
end
add :xml do |xml, options|
self.content_type ||= Mime::XML
- self.response_body = xml.respond_to?(:to_xml) ? xml.to_xml : xml
+ self.response_body = xml.respond_to?(:to_xml) ? xml.to_xml(options) : xml
end
add :update do |proc, options|
Oops, something went wrong.

0 comments on commit b9ab4c7

Please sign in to comment.