Permalink
Browse files

Merge remote branch 'rails/master'

  • Loading branch information...
2 parents 3c3ff13 + 755af49 commit ccd45618ed9a629c9535a5ff84ef5c238befa4ab @fxn fxn committed Jul 30, 2010
Showing with 303 additions and 172 deletions.
  1. +0 −1 Gemfile
  2. +1 −1 RAILS_VERSION
  3. +5 −0 actionmailer/CHANGELOG
  4. +2 −2 actionmailer/lib/action_mailer/base.rb
  5. +1 −1 actionmailer/lib/action_mailer/version.rb
  6. +2 −1 actionpack/CHANGELOG
  7. +1 −0 actionpack/lib/action_dispatch.rb
  8. +13 −0 actionpack/lib/action_dispatch/middleware/best_standards_support.rb
  9. +2 −5 actionpack/lib/action_dispatch/middleware/session/abstract_store.rb
  10. +1 −0 actionpack/lib/action_dispatch/middleware/session/mem_cache_store.rb
  11. +2 −1 actionpack/lib/action_dispatch/railtie.rb
  12. +1 −1 actionpack/lib/action_dispatch/routing/url_for.rb
  13. +1 −1 actionpack/lib/action_pack/version.rb
  14. +5 −4 actionpack/test/template/javascript_helper_test.rb
  15. +1 −1 activemodel/CHANGELOG
  16. +3 −3 activemodel/lib/active_model/conversion.rb
  17. +10 −10 activemodel/lib/active_model/errors.rb
  18. +6 −3 activemodel/lib/active_model/naming.rb
  19. +1 −1 activemodel/lib/active_model/translation.rb
  20. +7 −11 activemodel/lib/active_model/validations.rb
  21. +2 −2 activemodel/lib/active_model/validator.rb
  22. +1 −1 activemodel/lib/active_model/version.rb
  23. +1 −1 activerecord/CHANGELOG
  24. +1 −1 activerecord/lib/active_record/associations/association_collection.rb
  25. +1 −1 activerecord/lib/active_record/base.rb
  26. +0 −7 activerecord/lib/active_record/connection_adapters/abstract_adapter.rb
  27. +15 −3 activerecord/lib/active_record/log_subscriber.rb
  28. +2 −2 activerecord/lib/active_record/nested_attributes.rb
  29. +2 −3 activerecord/lib/active_record/railties/controller_runtime.rb
  30. +1 −1 activerecord/lib/active_record/relation.rb
  31. +5 −8 activerecord/lib/active_record/relation/query_methods.rb
  32. +1 −0 activerecord/lib/active_record/session_store.rb
  33. +1 −1 activerecord/lib/active_record/version.rb
  34. +9 −0 activerecord/test/cases/associations/has_many_associations_test.rb
  35. +2 −0 activerecord/test/cases/autosave_association_test.rb
  36. +4 −0 activerecord/test/cases/log_subscriber_test.rb
  37. +5 −0 activeresource/CHANGELOG
  38. +1 −1 activeresource/lib/active_resource/version.rb
  39. +1 −1 activesupport/CHANGELOG
  40. +0 −2 activesupport/lib/active_support/cache.rb
  41. +1 −1 activesupport/lib/active_support/core_ext/array/uniq_by.rb
  42. +9 −4 activesupport/lib/active_support/core_ext/array/wrap.rb
  43. +2 −1 activesupport/lib/active_support/core_ext/enumerable.rb
  44. +1 −0 activesupport/lib/active_support/core_ext/string/inflections.rb
  45. +5 −5 activesupport/lib/active_support/core_ext/string/multibyte.rb
  46. +2 −2 activesupport/lib/active_support/deprecation/proxy_wrappers.rb
  47. +37 −36 activesupport/lib/active_support/multibyte/chars.rb
  48. +4 −4 activesupport/lib/active_support/multibyte/unicode.rb
  49. +3 −3 activesupport/lib/active_support/notifications.rb
  50. +13 −13 activesupport/lib/active_support/secure_random.rb
  51. +1 −1 activesupport/lib/active_support/version.rb
  52. +43 −0 activesupport/test/caching_test.rb
  53. +20 −0 activesupport/test/core_ext/array_ext_test.rb
  54. +4 −4 activesupport/test/deprecation/proxy_wrappers_test.rb
  55. +1 −1 activesupport/test/load_paths_test.rb
  56. +11 −0 install.rb
  57. +1 −1 rails.gemspec
  58. +1 −1 railties/CHANGELOG
  59. +8 −1 railties/guides/source/active_support_core_extensions.textile
  60. +1 −0 railties/lib/rails/application.rb
  61. +1 −1 railties/lib/rails/commands.rb
  62. +1 −1 railties/lib/rails/engine/configuration.rb
  63. +3 −3 railties/lib/rails/generators/active_model.rb
  64. +1 −1 railties/lib/rails/generators/test_case.rb
  65. +1 −1 railties/lib/rails/info.rb
  66. +2 −1 railties/lib/rails/script_rails_loader.rb
  67. +1 −1 railties/lib/rails/tasks/framework.rake
  68. +1 −1 railties/lib/rails/version.rb
  69. +2 −1 railties/test/application/middleware_test.rb
  70. +1 −0 railties/test/application/routing_test.rb
  71. +1 −1 version.rb
View
@@ -39,7 +39,6 @@ platforms :ruby do
end
platforms :jruby do
- gem "system_timer"
gem "ruby-debug", ">= 0.10.3"
gem "activerecord-jdbcsqlite3-adapter"
View
@@ -1 +1 @@
-3.0.0.beta4
+3.0.0.rc
View
@@ -1,3 +1,8 @@
+*Rails 3.0.0 [release candidate] (July 26th, 2010)*
+
+* No material changes
+
+
*Rails 3.0.0 [beta 4] (June 8th, 2010)*
* subject is automatically looked up on I18n using mailer_name and action_name as scope as in t(".subject") [JK]
@@ -493,10 +493,10 @@ def headers(args=nil)
# You can also search for specific attachments:
#
# # By Filename
- # mail.attachments['filename.jpg'] #=> Mail::Part object or nil
+ # mail.attachments['filename.jpg'] # => Mail::Part object or nil
#
# # or by index
- # mail.attachments[0] #=> Mail::Part (first attachment)
+ # mail.attachments[0] # => Mail::Part (first attachment)
#
def attachments
@_message.attachments
@@ -3,7 +3,7 @@ module VERSION #:nodoc:
MAJOR = 3
MINOR = 0
TINY = 0
- BUILD = "beta4"
+ BUILD = "rc"
STRING = [MAJOR, MINOR, TINY, BUILD].join('.')
end
View
@@ -1,4 +1,4 @@
-*Rails 3.0.0 [Release Candidate] (unreleased)*
+*Rails 3.0.0 [release candidate] (July 26th, 2010)*
* Allow stylesheet/javascript extensions to be changed through railties. [Josh Kalderimis]
@@ -33,6 +33,7 @@
* Removed textilize, textilize_without_paragraph and markdown helpers. [Santiago Pastorino]
+
*Rails 3.0.0 [beta 4] (June 8th, 2010)*
* Remove middleware laziness [José Valim]
@@ -47,6 +47,7 @@ module ActionDispatch
end
autoload_under 'middleware' do
+ autoload :BestStandardsSupport
autoload :Callbacks
autoload :Cookies
autoload :Flash
@@ -0,0 +1,13 @@
+module ActionDispatch
+ class BestStandardsSupport
+ def initialize(app)
+ @app = app
+ end
+
+ def call(env)
+ status, headers, body = @app.call(env)
+ headers["X-UA-Compatible"] = "IE=Edge,chrome=1"
+ [status, headers, body]
+ end
+ end
+end
@@ -191,11 +191,8 @@ def set_cookie(request, options)
def load_session(env)
stale_session_check! do
- if sid = current_session_id(env)
- sid, session = get_session(env, sid)
- else
- sid, session = generate_sid, {}
- end
+ sid = current_session_id(env)
+ sid, session = get_session(env, sid)
[sid, session]
end
end
@@ -25,6 +25,7 @@ def initialize(app, options = {})
private
def get_session(env, sid)
+ sid ||= generate_sid
begin
session = @pool.get(sid) || {}
rescue MemCache::MemCacheError, Errno::ECONNREFUSED
@@ -7,10 +7,11 @@ class Railtie < Rails::Railtie
config.action_dispatch.x_sendfile_header = ""
config.action_dispatch.ip_spoofing_check = true
config.action_dispatch.show_exceptions = true
+ config.action_dispatch.best_standards_support = true
# Prepare dispatcher callbacks and run 'prepare' callbacks
initializer "action_dispatch.prepare_dispatcher" do |app|
ActionDispatch::Callbacks.to_prepare { app.routes_reloader.execute_if_updated }
end
end
-end
+end
@@ -20,7 +20,7 @@ module Routing
# <%= link_to('Click here', :controller => 'users',
# :action => 'new', :message => 'Welcome!') %>
#
- # #=> Generates a link to: /users/new?message=Welcome%21
+ # # Generates a link to /users/new?message=Welcome%21
#
# link_to, and all other functions that require URL generation functionality,
# actually use ActionController::UrlFor under the hood. And in particular,
@@ -3,7 +3,7 @@ module VERSION #:nodoc:
MAJOR = 3
MINOR = 0
TINY = 0
- BUILD = "beta4"
+ BUILD = "rc"
STRING = [MAJOR, MINOR, TINY, BUILD].join('.')
end
@@ -90,11 +90,12 @@ def test_link_to_function_with_href
end
def test_link_to_function_with_inner_block_does_not_raise_exception
- html = link_to_function("Greet me!") do |page|
- content_tag(:h1) { 'Hi' }
+ html = link_to_function( "Greet me!" ) do |page|
+ page.replace_html 'header', (content_tag :h1 do
+ 'Greetings'
+ end)
end
-
- assert_dom_equal %(<a href='#' onclick="; return false;">Greet me!</a>), html
+ assert_dom_equal %(<a href="#" onclick="Element.update(&quot;header&quot;, &quot;\\u003Ch1\\u003EGreetings\\u003C/h1\\u003E&quot;);; return false;">Greet me!</a>), html
end
def test_javascript_tag
View
@@ -1,4 +1,4 @@
-*Rails 3.0.0 [Release Candidate] (unreleased)*
+*Rails 3.0.0 [release candidate] (July 26th, 2010)*
* Added ActiveModel::MassAssignmentSecurity [Eric Chapweske, Josh Kalderimis]
@@ -17,9 +17,9 @@ module ActiveModel
# end
#
# cm = ContactMessage.new
- # cm.to_model == self #=> true
- # cm.to_key #=> nil
- # cm.to_param #=> nil
+ # cm.to_model == self # => true
+ # cm.to_key # => nil
+ # cm.to_param # => nil
#
module Conversion
# If your object is already designed to implement all of the Active Model
@@ -83,8 +83,8 @@ def initialize(base)
# When passed a symbol or a name of a method, returns an array of errors
# for the method.
#
- # p.errors[:name] #=> ["can not be nil"]
- # p.errors['name'] #=> ["can not be nil"]
+ # p.errors[:name] # => ["can not be nil"]
+ # p.errors['name'] # => ["can not be nil"]
def [](attribute)
if errors = get(attribute.to_sym)
errors
@@ -96,7 +96,7 @@ def [](attribute)
# Adds to the supplied attribute the supplied error message.
#
# p.errors[:name] = "must be set"
- # p.errors[:name] #=> ['must be set']
+ # p.errors[:name] # => ['must be set']
def []=(attribute, error)
self[attribute.to_sym] << error
end
@@ -124,9 +124,9 @@ def each
# Returns the number of error messages.
#
# p.errors.add(:name, "can't be blank")
- # p.errors.size #=> 1
+ # p.errors.size # => 1
# p.errors.add(:name, "must be specified")
- # p.errors.size #=> 2
+ # p.errors.size # => 2
def size
values.flatten.size
end
@@ -135,16 +135,16 @@ def size
#
# p.errors.add(:name, "can't be blank")
# p.errors.add(:name, "must be specified")
- # p.errors.to_a #=> ["name can't be blank", "name must be specified"]
+ # p.errors.to_a # => ["name can't be blank", "name must be specified"]
def to_a
full_messages
end
# Returns the number of error messages.
# p.errors.add(:name, "can't be blank")
- # p.errors.count #=> 1
+ # p.errors.count # => 1
# p.errors.add(:name, "must be specified")
- # p.errors.count #=> 2
+ # p.errors.count # => 2
def count
to_a.size
end
@@ -158,8 +158,8 @@ def empty?
#
# p.errors.add(:name, "can't be blank")
# p.errors.add(:name, "must be specified")
- # p.errors.to_xml #=> Produces:
- #
+ # p.errors.to_xml
+ # # =>
# # <?xml version=\"1.0\" encoding=\"UTF-8\"?>
# # <errors>
# # <error>name can't be blank</error>
@@ -17,7 +17,10 @@ def initialize(klass)
end
# Transform the model name into a more humane format, using I18n. By default,
- # it will underscore then humanize the class name (BlogPost.model_name.human #=> "Blog post").
+ # it will underscore then humanize the class name
+ #
+ # BlogPost.model_name.human # => "Blog post"
+ #
# Specify +options+ with additional translating options.
def human(options={})
return @human unless @klass.respond_to?(:lookup_ancestors) &&
@@ -45,8 +48,8 @@ def human(options={})
# extend ActiveModel::Naming
# end
#
- # BookCover.model_name #=> "BookCover"
- # BookCover.model_name.human #=> "Book cover"
+ # BookCover.model_name # => "BookCover"
+ # BookCover.model_name.human # => "Book cover"
#
# Providing the functionality that ActiveModel::Naming provides in your object
# is required to pass the Active Model Lint test. So either extending the provided
@@ -14,7 +14,7 @@ module ActiveModel
# end
#
# TranslatedPerson.human_attribute_name('my_attribute')
- # #=> "My attribute"
+ # # => "My attribute"
#
# This also provides the required class methods for hooking into the
# Rails internationalization API, including being able to define a
@@ -24,20 +24,16 @@ module ActiveModel
# end
#
# Which provides you with the full standard validation stack that you
- # know from ActiveRecord.
+ # know from Active Record:
#
# person = Person.new
- # person.valid?
- # #=> true
- # person.invalid?
- # #=> false
+ # person.valid? # => true
+ # person.invalid? # => false
+ #
# person.first_name = 'zoolander'
- # person.valid?
- # #=> false
- # person.invalid?
- # #=> true
- # person.errors
- # #=> #<OrderedHash {:first_name=>["starts with z."]}>
+ # person.valid? # => false
+ # person.invalid? # => true
+ # person.errors # => #<OrderedHash {:first_name=>["starts with z."]}>
#
# Note that ActiveModel::Validations automatically adds an +errors+ method
# to your instances initialized with a new ActiveModel::Errors object, so
@@ -102,8 +102,8 @@ class Validator
#
# == Examples
#
- # PresenceValidator.kind #=> :presence
- # UniquenessValidator.kind #=> :uniqueness
+ # PresenceValidator.kind # => :presence
+ # UniquenessValidator.kind # => :uniqueness
#
def self.kind
@kind ||= name.split('::').last.underscore.sub(/_validator$/, '').to_sym unless anonymous?
@@ -3,7 +3,7 @@ module VERSION #:nodoc:
MAJOR = 3
MINOR = 0
TINY = 0
- BUILD = "beta4"
+ BUILD = "rc"
STRING = [MAJOR, MINOR, TINY, BUILD].join('.')
end
View
@@ -1,4 +1,4 @@
-*Rails 3.0.0 [RC1] (unreleased)*
+*Rails 3.0.0 [release candidate] (July 26th, 2010)*
* Changed update_attribute to not run callbacks and update the record directly in the database [Neeraj Singh]
@@ -422,7 +422,7 @@ def method_missing(method, *args)
match = DynamicFinderMatch.match(method)
if match && match.creator?
attributes = match.attribute_names
- return send(:"find_by_#{attributes.join('and')}", *args) || create(Hash[attributes.zip(args)])
+ return send(:"find_by_#{attributes.join('_and_')}", *args) || create(Hash[attributes.zip(args)])
end
if @target.respond_to?(method) || (!@reflection.klass.respond_to?(method) && Class.respond_to?(method))
@@ -803,7 +803,7 @@ def sti_name
end
def arel_table
- @arel_table ||= Arel::Table.new(table_name, :engine => arel_engine)
+ @arel_table ||= Arel::Table.new(table_name, arel_engine)
end
def arel_engine
@@ -34,13 +34,11 @@ class AbstractAdapter
include QueryCache
include ActiveSupport::Callbacks
- attr_accessor :runtime
define_callbacks :checkout, :checkin
def initialize(connection, logger = nil) #:nodoc:
@active = nil
@connection, @logger = connection, logger
- @runtime = 0
@query_cache_enabled = false
@query_cache = {}
@instrumenter = ActiveSupport::Notifications.instrumenter
@@ -92,11 +90,6 @@ def prefetch_primary_key?(table_name = nil)
false
end
- def reset_runtime #:nodoc:
- rt, @runtime = @runtime, 0
- rt
- end
-
# QUOTING ==================================================
# Override to return the quoted table name. Defaults to column quoting.
@@ -1,13 +1,25 @@
module ActiveRecord
class LogSubscriber < ActiveSupport::LogSubscriber
+ def self.runtime=(value)
+ Thread.current["active_record_sql_runtime"] = value
+ end
+
+ def self.runtime
+ Thread.current["active_record_sql_runtime"] ||= 0
+ end
+
+ def self.reset_runtime
+ rt, self.runtime = runtime, 0
+ rt
+ end
+
def initialize
super
@odd_or_even = false
end
def sql(event)
- connection = ActiveRecord::Base.connection
- connection.runtime += event.duration
+ self.class.runtime += event.duration
return unless logger.debug?
name = '%s (%.1fms)' % [event.payload[:name], event.duration]
@@ -33,4 +45,4 @@ def logger
end
end
-ActiveRecord::LogSubscriber.attach_to :active_record
+ActiveRecord::LogSubscriber.attach_to :active_record
Oops, something went wrong.

0 comments on commit ccd4561

Please sign in to comment.