Permalink
Browse files

Merge branch 'master' into nested_has_many_through

  • Loading branch information...
2 parents f2b4191 + d40ca9c commit c954d54e2f36bb53ced5e3655adc071dd233797e @jonleighton jonleighton committed Oct 6, 2010
Showing with 990 additions and 1,040 deletions.
  1. +1 −0 Gemfile
  2. +2 −2 actionmailer/lib/action_mailer/old_api.rb
  3. +1 −1 actionmailer/lib/rails/generators/mailer/templates/mailer.rb
  4. +3 −3 actionpack/CHANGELOG
  5. +6 −3 actionpack/lib/action_controller/test_case.rb
  6. +1 −21 actionpack/lib/action_dispatch/http/cache.rb
  7. +1 −1 actionpack/lib/action_dispatch/http/request.rb
  8. +1 −1 actionpack/lib/action_dispatch/http/response.rb
  9. +13 −12 actionpack/lib/action_dispatch/http/upload.rb
  10. +0 −5 actionpack/lib/action_dispatch/http/url.rb
  11. +54 −229 actionpack/lib/action_dispatch/middleware/session/abstract_store.rb
  12. +20 −44 actionpack/lib/action_dispatch/middleware/session/cookie_store.rb
  13. +7 −46 actionpack/lib/action_dispatch/middleware/session/mem_cache_store.rb
  14. +3 −3 actionpack/lib/action_dispatch/middleware/static.rb
  15. +4 −4 actionpack/lib/action_dispatch/routing/mapper.rb
  16. +1 −2 actionpack/lib/action_dispatch/testing/performance_test.rb
  17. +1 −1 actionpack/lib/action_view/helpers/form_helper.rb
  18. +24 −27 actionpack/lib/action_view/helpers/url_helper.rb
  19. +21 −5 actionpack/lib/action_view/test_case.rb
  20. +35 −0 actionpack/test/abstract_unit.rb
  21. +2 −2 actionpack/test/controller/filters_test.rb
  22. +1 −1 actionpack/test/controller/integration_test.rb
  23. +2 −2 actionpack/test/controller/log_subscriber_test.rb
  24. +0 −46 actionpack/test/controller/new_base/etag_test.rb
  25. +1 −26 actionpack/test/controller/record_identifier_test.rb
  26. +0 −18 actionpack/test/controller/redirect_test.rb
  27. +0 −118 actionpack/test/controller/render_test.rb
  28. +0 −16 actionpack/test/controller/rescue_test.rb
  29. +0 −7 actionpack/test/dispatch/request/multipart_params_parsing_test.rb
  30. +3 −8 actionpack/test/dispatch/response_test.rb
  31. +0 −12 actionpack/test/dispatch/session/cookie_store_test.rb
  32. +0 −14 actionpack/test/dispatch/show_exceptions_test.rb
  33. +27 −20 actionpack/test/dispatch/static_test.rb
  34. +58 −0 actionpack/test/dispatch/uploaded_file_test.rb
  35. +19 −0 actionpack/test/lib/controller/fake_models.rb
  36. +15 −0 actionpack/test/template/form_helper_test.rb
  37. +31 −0 actionpack/test/template/test_case_test.rb
  38. +0 −18 actionpack/test/template/url_helper_test.rb
  39. +5 −1 activemodel/lib/active_model/naming.rb
  40. +4 −0 activemodel/test/cases/naming_test.rb
  41. +7 −0 activemodel/test/models/track_back.rb
  42. +1 −1 activerecord/lib/active_record.rb
  43. +12 −0 activerecord/lib/active_record/associations/association_collection.rb
  44. +26 −10 activerecord/lib/active_record/base.rb
  45. +4 −4 activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb
  46. +19 −19 activerecord/lib/active_record/migration.rb
  47. +14 −11 activerecord/lib/active_record/relation/calculations.rb
  48. +5 −11 activerecord/lib/active_record/relation/predicate_builder.rb
  49. +3 −3 activerecord/lib/active_record/relation/query_methods.rb
  50. +7 −5 activerecord/lib/active_record/schema_dumper.rb
  51. +5 −2 activerecord/lib/active_record/session_store.rb
  52. +6 −0 activerecord/test/cases/associations/has_and_belongs_to_many_associations_test.rb
  53. +6 −0 activerecord/test/cases/associations/has_many_associations_test.rb
  54. +14 −0 activerecord/test/cases/associations/has_many_through_associations_test.rb
  55. +11 −1 activerecord/test/cases/calculations_test.rb
  56. +14 −0 activerecord/test/cases/inheritance_test.rb
  57. +1 −1 activeresource/lib/active_resource/validations.rb
  58. +1 −1 activeresource/test/cases/format_test.rb
  59. +1 −1 activesupport/lib/active_support/cache/mem_cache_store.rb
  60. +3 −3 activesupport/lib/active_support/core_ext/class/inheritable_attributes.rb
  61. +1 −4 activesupport/lib/active_support/core_ext/enumerable.rb
  62. +1 −2 activesupport/lib/active_support/test_case.rb
  63. +0 −9 activesupport/lib/active_support/testing/default.rb
  64. +1 −1 activesupport/lib/active_support/xml_mini.rb
  65. +57 −0 activesupport/test/test_case_test.rb
  66. +0 −7 activesupport/test/test_test.rb
  67. +1 −1 railties/guides/source/getting_started.textile
  68. +4 −0 railties/guides/source/index.html.erb
  69. +1 −0 railties/guides/source/layout.html.erb
  70. +77 −0 railties/guides/source/ruby_on_rails_guides_guidelines.textile
  71. +7 −1 railties/lib/rails/application.rb
  72. +4 −2 railties/lib/rails/application/routes_reloader.rb
  73. +21 −1 railties/lib/rails/engine.rb
  74. +25 −3 railties/lib/rails/engine/configuration.rb
  75. +11 −14 railties/lib/rails/generators/rails/app/app_generator.rb
  76. +3 −0 railties/lib/rails/generators/rails/app/templates/Gemfile
  77. +1 −1 railties/lib/rails/generators/rails/app/templates/app/views/layouts/application.html.erb.tt
  78. +1 −1 railties/lib/rails/railtie.rb
  79. +6 −26 railties/lib/rails/railtie/configuration.rb
  80. +1 −1 railties/railties.gemspec
  81. +26 −0 railties/test/application/middleware/best_practices_test.rb
  82. +0 −12 railties/test/application/middleware/cache_test.rb
  83. +63 −0 railties/test/application/middleware/remote_ip_test.rb
  84. +56 −0 railties/test/application/middleware/sendfile_test.rb
  85. +34 −103 railties/test/application/middleware_test.rb
  86. +14 −47 railties/test/application/routing_test.rb
  87. +1 −1 railties/test/generators/generated_attribute_test.rb
  88. +9 −0 railties/test/generators/mailer_generator_test.rb
  89. +27 −0 railties/test/isolation/abstract_unit.rb
  90. +10 −11 railties/test/railties/engine_test.rb
View
@@ -6,6 +6,7 @@ else
gem "arel", :git => "git://github.com/rails/arel.git"
end
+gem "rack", :git => "git://github.com/rack/rack.git"
gem "rails", :path => File.dirname(__FILE__)
gem "rake", ">= 0.8.7"
@@ -247,8 +247,8 @@ def parse_content_type(defaults=nil)
[ nil, {} ]
else
ctype, *attrs = @content_type.split(/;\s*/)
- attrs = attrs.inject({}) { |h,s| k,v = s.split(/\=/, 2); h[k] = v; h }
- [ctype, {"charset" => @charset}.merge(attrs)]
+ attrs = Hash[attrs.map { |attr| attr.split(/\=/, 2) }]
+ [ctype, {"charset" => @charset}.merge!(attrs)]
end
end
end
@@ -6,7 +6,7 @@ class <%= class_name %> < ActionMailer::Base
# Subject can be set in your I18n file at config/locales/en.yml
# with the following lookup:
#
- # en.<%= file_name %>.<%= action %>.subject
+ # en.<%= file_path.gsub("/",".") %>.<%= action %>.subject
#
def <%= action %>
@greeting = "Hi"
@@ -1,12 +1,12 @@
*Rails 3.1.0 (unreleased)*
+* 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.
+* 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.0 (August 29, 2010)*
@@ -187,15 +187,18 @@ def recycle!
end
end
- class TestSession < ActionDispatch::Session::AbstractStore::SessionHash #:nodoc:
- DEFAULT_OPTIONS = ActionDispatch::Session::AbstractStore::DEFAULT_OPTIONS
+ class TestSession < Rack::Session::Abstract::SessionHash #:nodoc:
+ DEFAULT_OPTIONS = Rack::Session::Abstract::ID::DEFAULT_OPTIONS
def initialize(session = {})
+ @env, @by = nil, nil
replace(session.stringify_keys)
@loaded = true
end
- def exists?; true; end
+ def exists?
+ true
+ end
end
# Superclass for ActionController functional tests. Functional tests allow you to
@@ -50,8 +50,7 @@ def initialize(*)
if cache_control = self["Cache-Control"]
cache_control.split(/,\s*/).each do |segment|
first, last = segment.split("=")
- last ||= true
- @cache_control[first.to_sym] = last
+ @cache_control[first.to_sym] = last || true
end
end
end
@@ -88,28 +87,9 @@ def etag=(etag)
def handle_conditional_get!
if etag? || last_modified? || !@cache_control.empty?
set_conditional_cache_control!
- elsif nonempty_ok_response?
- self.etag = body
-
- if request && request.etag_matches?(etag)
- self.status = 304
- self.body = []
- end
-
- set_conditional_cache_control!
- else
- headers["Cache-Control"] = "no-cache"
end
end
- def nonempty_ok_response?
- @status == 200 && string_body?
- end
-
- def string_body?
- !@blank && @body.respond_to?(:all?) && @body.all? { |part| part.is_a?(String) }
- end
-
DEFAULT_CACHE_CONTROL = "max-age=0, private, must-revalidate"
def set_conditional_cache_control!
@@ -199,7 +199,7 @@ def body_stream #:nodoc:
# TODO This should be broken apart into AD::Request::Session and probably
# be included by the session middleware.
def reset_session
- session.destroy if session
+ session.destroy if session && session.respond_to?(:destroy)
self.session = {}
@env['action_dispatch.request.flash_hash'] = nil
end
@@ -132,7 +132,7 @@ def location=(url)
# information.
attr_accessor :charset, :content_type
- CONTENT_TYPE = "Content-Type"
+ CONTENT_TYPE = "Content-Type"
cattr_accessor(:default_charset) { "utf-8" }
@@ -2,27 +2,28 @@
module ActionDispatch
module Http
- class UploadedFile < Tempfile
+ class UploadedFile
attr_accessor :original_filename, :content_type, :tempfile, :headers
def initialize(hash)
@original_filename = hash[:filename]
@content_type = hash[:type]
@headers = hash[:head]
+ @tempfile = hash[:tempfile]
+ raise(ArgumentError, ':tempfile is required') unless @tempfile
+ end
- # To the untrained eye, this may appear as insanity. Given the alternatives,
- # such as busting the method cache on every request or breaking backwards
- # compatibility with is_a?(Tempfile), this solution is the best available
- # option.
- #
- # TODO: Deprecate is_a?(Tempfile) and define a real API for this parameter
- tempfile = hash[:tempfile]
- tempfile.instance_variables.each do |ivar|
- instance_variable_set(ivar, tempfile.instance_variable_get(ivar))
- end
+ def read(*args)
+ @tempfile.read(*args)
end
- alias local_path path
+ def rewind
+ @tempfile.rewind
+ end
+
+ def size
+ @tempfile.size
+ end
end
module Upload
@@ -18,11 +18,6 @@ def protocol
@protocol ||= ssl? ? 'https://' : 'http://'
end
- # Is this an SSL request?
- def ssl?
- @ssl ||= @env['HTTPS'] == 'on' || @env['HTTP_X_FORWARDED_PROTO'] == 'https'
- end
-
# Returns the \host for this request, such as "example.com".
def raw_host_with_port
if forwarded = env["HTTP_X_FORWARDED_HOST"]
Oops, something went wrong. Retry.

0 comments on commit c954d54

Please sign in to comment.