1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Merge commit 'mainstream/master'

This commit is contained in:
Pratik Naik 2009-03-16 11:20:28 +00:00
commit fc123d189c
34 changed files with 105 additions and 77 deletions

View file

@ -1,10 +1,7 @@
*2.3.1 [RC2] (March 5, 2009)*
*2.3.2 [Final] (March 15, 2009)*
* Fixed that ActionMailer should send correctly formatted Return-Path in MAIL FROM for SMTP #1842 [Matt Jones]
*2.3.0 [RC1] (February 1st, 2009)*
* Fixed RFC-2045 quoted-printable bug #1421 [squadette]
* Fixed that no body charset would be set when there are attachments present #740 [Paweł Kondzior]

View file

@ -55,7 +55,7 @@ spec = Gem::Specification.new do |s|
s.rubyforge_project = "actionmailer"
s.homepage = "http://www.rubyonrails.org"
s.add_dependency('actionpack', '= 2.3.1' + PKG_BUILD)
s.add_dependency('actionpack', '= 2.3.2' + PKG_BUILD)
s.has_rdoc = true
s.requirements << 'none'

View file

@ -2,7 +2,7 @@ module ActionMailer
module VERSION #:nodoc:
MAJOR = 2
MINOR = 3
TINY = 1
TINY = 2
STRING = [MAJOR, MINOR, TINY].join('.')
end

View file

@ -1,4 +1,4 @@
*2.3.1 [RC2] (March 5, 2009)*
*2.3.2 [Final] (March 15, 2009)*
* Fixed that redirection would just log the options, not the final url (which lead to "Redirected to #<Post:0x23150b8>") [DHH]
@ -14,9 +14,6 @@
* Added localized rescue template when I18n.locale is set (ex: public/404.da.html) #1835 [José Valim]
*2.3.0 [RC1] (February 1st, 2009)*
* Make the form_for and fields_for helpers support the new Active Record nested update options. #1202 [Eloy Duran]
<% form_for @person do |person_form| %>

View file

@ -80,7 +80,7 @@ spec = Gem::Specification.new do |s|
s.has_rdoc = true
s.requirements << 'none'
s.add_dependency('activesupport', '= 2.3.1' + PKG_BUILD)
s.add_dependency('activesupport', '= 2.3.2' + PKG_BUILD)
s.require_path = 'lib'
s.autorequire = 'action_controller'

View file

@ -630,7 +630,7 @@ module ActionController
action_path = resource.options[:path_names][action] if resource.options[:path_names].is_a?(Hash)
action_path ||= Base.resources_path_names[action] || action
map_resource_routes(map, resource, action, "#{resource.member_path}#{resource.action_separator}#{action_path}", "#{action}_#{resource.shallow_name_prefix}#{resource.singular}", m)
map_resource_routes(map, resource, action, "#{resource.member_path}#{resource.action_separator}#{action_path}", "#{action}_#{resource.shallow_name_prefix}#{resource.singular}", m, { :force_id => true })
end
end
end
@ -641,9 +641,9 @@ module ActionController
map_resource_routes(map, resource, :destroy, resource.member_path, route_path)
end
def map_resource_routes(map, resource, action, route_path, route_name = nil, method = nil)
def map_resource_routes(map, resource, action, route_path, route_name = nil, method = nil, resource_options = {} )
if resource.has_action?(action)
action_options = action_options_for(action, resource, method)
action_options = action_options_for(action, resource, method, resource_options)
formatted_route_path = "#{route_path}.:format"
if route_name && @set.named_routes[route_name.to_sym].nil?
@ -660,9 +660,10 @@ module ActionController
end
end
def action_options_for(action, resource, method = nil)
def action_options_for(action, resource, method = nil, resource_options = {})
default_options = { :action => action.to_s }
require_id = !resource.kind_of?(SingletonResource)
force_id = resource_options[:force_id] && !resource.kind_of?(SingletonResource)
case default_options[:action]
when "index", "new"; default_options.merge(add_conditions_for(resource.conditions, method || :get)).merge(resource.requirements)
@ -670,7 +671,7 @@ module ActionController
when "show", "edit"; default_options.merge(add_conditions_for(resource.conditions, method || :get)).merge(resource.requirements(require_id))
when "update"; default_options.merge(add_conditions_for(resource.conditions, method || :put)).merge(resource.requirements(require_id))
when "destroy"; default_options.merge(add_conditions_for(resource.conditions, method || :delete)).merge(resource.requirements(require_id))
else default_options.merge(add_conditions_for(resource.conditions, method)).merge(resource.requirements)
else default_options.merge(add_conditions_for(resource.conditions, method)).merge(resource.requirements(force_id))
end
end
end

View file

@ -23,7 +23,7 @@ module Rack
# Return the Rack release as a dotted string.
def self.release
"0.4"
"1.0 bundled"
end
autoload :Builder, "rack/builder"

View file

@ -2,7 +2,7 @@ module ActionPack #:nodoc:
module VERSION #:nodoc:
MAJOR = 2
MINOR = 3
TINY = 1
TINY = 2
STRING = [MAJOR, MINOR, TINY].join('.')
end

View file

@ -61,7 +61,7 @@ module ActionView #:nodoc:
end
end
return Template.new(original_template_path, original_template_path =~ /\A\// ? "" : ".") if File.file?(original_template_path)
return Template.new(original_template_path, original_template_path.to_s =~ /\A\// ? "" : ".") if File.file?(original_template_path)
raise MissingTemplate.new(self, original_template_path, format)
end

View file

@ -218,7 +218,7 @@ module ActionView #:nodoc:
# Returns file split into an array
# [base_path, name, locale, format, extension]
def split(file)
if m = file.match(/^(.*\/)?([^\.]+)\.(.*)$/)
if m = file.to_s.match(/^(.*\/)?([^\.]+)\.(.*)$/)
base_path = m[1]
name = m[2]
extensions = m[3]

View file

@ -2,7 +2,7 @@ require 'abstract_unit'
class SessionTest < Test::Unit::TestCase
StubApp = lambda { |env|
[200, {"Content-Type" => "text/html", "Content-Length" => "13"}, "Hello, World!"]
[200, {"Content-Type" => "text/html", "Content-Length" => "13"}, ["Hello, World!"]]
}
def setup
@ -389,9 +389,9 @@ class MetalTest < ActionController::IntegrationTest
class Poller
def self.call(env)
if env["PATH_INFO"] =~ /^\/success/
[200, {"Content-Type" => "text/plain", "Content-Length" => "12"}, "Hello World!"]
[200, {"Content-Type" => "text/plain", "Content-Length" => "12"}, ["Hello World!"]]
else
[404, {"Content-Type" => "text/plain", "Content-Length" => "0"}, '']
[404, {"Content-Type" => "text/plain", "Content-Length" => "0"}, []]
end
end
end

View file

@ -157,6 +157,11 @@ class TestController < ActionController::Base
render :file => 'test/dot.directory/render_file_with_ivar'
end
def render_file_using_pathname
@secret = 'in the sauce'
render :file => Pathname.new(File.dirname(__FILE__)).join('..', 'fixtures', 'test', 'dot.directory', 'render_file_with_ivar.erb')
end
def render_file_from_template
@secret = 'in the sauce'
@path = File.expand_path(File.join(File.dirname(__FILE__), '../fixtures/test/render_file_with_ivar.erb'))
@ -861,6 +866,11 @@ class RenderTest < ActionController::TestCase
assert_equal "The secret is in the sauce\n", @response.body
end
def test_render_file_using_pathname
get :render_file_using_pathname
assert_equal "The secret is in the sauce\n", @response.body
end
def test_render_file_with_locals
get :render_file_with_locals
assert_equal "The secret is in the sauce\n", @response.body

View file

@ -175,6 +175,24 @@ class ResourcesTest < ActionController::TestCase
end
end
def test_with_collection_actions_and_name_prefix_and_member_action_with_same_name
actions = { 'a' => :get }
with_restful_routing :messages, :path_prefix => '/threads/:thread_id', :name_prefix => "thread_", :collection => actions, :member => actions do
assert_restful_routes_for :messages, :path_prefix => 'threads/1/', :name_prefix => 'thread_', :options => { :thread_id => '1' } do |options|
actions.each do |action, method|
assert_recognizes(options.merge(:action => action), :path => "/threads/1/messages/#{action}", :method => method)
end
end
assert_restful_named_routes_for :messages, :path_prefix => 'threads/1/', :name_prefix => 'thread_', :options => { :thread_id => '1' } do |options|
actions.keys.each do |action|
assert_named_route "/threads/1/messages/#{action}", "#{action}_thread_messages_path", :action => action
end
end
end
end
def test_with_collection_action_and_name_prefix_and_formatted
actions = { 'a' => :get, 'b' => :put, 'c' => :post, 'd' => :delete }
@ -209,6 +227,14 @@ class ResourcesTest < ActionController::TestCase
end
end
def test_with_member_action_and_requirement
expected_options = {:controller => 'messages', :action => 'mark', :id => '1.1.1'}
with_restful_routing(:messages, :requirements => {:id => /[0-9]\.[0-9]\.[0-9]/}, :member => { :mark => :get }) do
assert_recognizes(expected_options, :path => 'messages/1.1.1/mark', :method => :get)
end
end
def test_member_when_override_paths_for_default_restful_actions_with
[:put, :post].each do |method|
with_restful_routing :messages, :member => { :mark => method }, :path_names => {:new => 'nuevo'} do

View file

@ -199,29 +199,18 @@ class CookieStoreTest < ActionController::IntegrationTest
with_test_route_set do
# First request accesses the session
time = Time.local(2008, 4, 24)
Time.stubs(:now).returns(time)
expected_expiry = (time + 5.hours).gmtime.strftime("%a, %d-%b-%Y %H:%M:%S GMT")
cookies[SessionKey] = SignedBar
get '/set_session_value'
assert_response :success
cookie = headers['Set-Cookie']
cookie_body = response.body
assert_equal "_myapp_session=#{cookie_body}; path=/; expires=#{expected_expiry}; HttpOnly",
headers['Set-Cookie']
# Second request does not access the session
time = Time.local(2008, 4, 25)
Time.stubs(:now).returns(time)
expected_expiry = (time + 5.hours).gmtime.strftime("%a, %d-%b-%Y %H:%M:%S GMT")
# Second request does not access the session so the
# expires header should not be changed
get '/no_session_access'
assert_response :success
assert_equal "_myapp_session=#{cookie_body}; path=/; expires=#{expected_expiry}; HttpOnly",
headers['Set-Cookie']
assert_equal cookie, headers['Set-Cookie'],
"#{unmarshal_session(cookie).inspect} expected but was #{unmarshal_session(headers['Set-Cookie']).inspect}"
end
end
@ -236,4 +225,13 @@ class CookieStoreTest < ActionController::IntegrationTest
yield
end
end
def unmarshal_session(cookie_string)
session = Rack::Utils.parse_query(cookie_string, ';,').inject({}) {|h,(k,v)|
h[k] = Array === v ? v.first : v
h
}[SessionKey]
verifier = ActiveSupport::MessageVerifier.new(SessionSecret, 'SHA1')
verifier.verify(session)
end
end

View file

@ -1,11 +1,9 @@
*2.3.1 [RC2] (March 5, 2009)*
*2.3.2 [Final] (March 15, 2009)*
* Added ActiveRecord::Base.find_each and ActiveRecord::Base.find_in_batches for batch processing [DHH/Jamis Buck]
* Added that ActiveRecord::Base.exists? can be called with no arguments #1817 [Scott Taylor]
*2.3.0 [RC1] (February 1st, 2009)*
* Add Support for updating deeply nested models from a single form. #1202 [Eloy Duran]
class Book < ActiveRecord::Base

View file

@ -177,7 +177,7 @@ spec = Gem::Specification.new do |s|
s.files = s.files + Dir.glob( "#{dir}/**/*" ).delete_if { |item| item.include?( "\.svn" ) }
end
s.add_dependency('activesupport', '= 2.3.1' + PKG_BUILD)
s.add_dependency('activesupport', '= 2.3.2' + PKG_BUILD)
s.files.delete FIXTURES_ROOT + "/fixture_database.sqlite"
s.files.delete FIXTURES_ROOT + "/fixture_database_2.sqlite"

View file

@ -2,7 +2,7 @@ module ActiveRecord
module VERSION #:nodoc:
MAJOR = 2
MINOR = 3
TINY = 1
TINY = 2
STRING = [MAJOR, MINOR, TINY].join('.')
end

View file

@ -1,11 +1,6 @@
*2.3.1 [RC2] (March 5, 2009)*
*2.3.2 [Final] (March 15, 2009)*
* Nothing new, just included in 2.3.1
*2.3.0 [RC1] (February 1st, 2009)*
* Nothing new, just included in 2.3.0
* Nothing new, just included in 2.3.2
*2.2.1 [RC2] (November 14th, 2008)*

View file

@ -67,7 +67,7 @@ spec = Gem::Specification.new do |s|
s.files = s.files + Dir.glob( "#{dir}/**/*" ).delete_if { |item| item.include?( "\.svn" ) }
end
s.add_dependency('activesupport', '= 2.3.1' + PKG_BUILD)
s.add_dependency('activesupport', '= 2.3.2' + PKG_BUILD)
s.require_path = 'lib'
s.autorequire = 'active_resource'

View file

@ -2,7 +2,7 @@ module ActiveResource
module VERSION #:nodoc:
MAJOR = 2
MINOR = 3
TINY = 1
TINY = 2
STRING = [MAJOR, MINOR, TINY].join('.')
end

View file

@ -1,11 +1,8 @@
*Edge*
*2.3.2 [Final] (March 15, 2009)*
* XmlMini supports LibXML and Nokogiri backends. #2084, #2190 [Bart ten Brinke, Aaron Patterson]
Example: XmlMini.backend = 'Nokogiri'
*2.3.1 [RC2] (March 5, 2009)*
* Vendorize i18n 0.1.3 gem (fixes issues with incompatible character encodings in Ruby 1.9) #2038 [Akira Matsuda]
* Update bundled memcache-client from 1.5.0.5 to 1.6.4.99. See http://www.mikeperham.com/2009/02/15/memcache-client-performance/ [Mike Perham]
@ -18,9 +15,6 @@
* Introduce Array.wrap(foo) to wrap the argument in an array unless it's already an array. Wraps nil as an empty array. Use instead of Array(foo) and foo.to_a since they treat String as Enumerable. [Jeremy Kemper]
*2.3.0 [RC1] (February 1st, 2009)*
* TimeWithZone#xmlschema accepts optional fraction_digits argument [#1725 state:resolved] [Nicholas Dainty]
* Object#tap shim for Ruby < 1.8.7. Similar to Object#returning, tap yields self then returns self. [Jeremy Kemper]

View file

@ -2,7 +2,7 @@ module ActiveSupport
module VERSION #:nodoc:
MAJOR = 2
MINOR = 3
TINY = 1
TINY = 2
STRING = [MAJOR, MINOR, TINY].join('.')
end

View file

@ -1,10 +1,7 @@
*2.3.1 [RC2] (March 5, 2009)*
*2.3.2 [Final] (March 15, 2009)*
* Allow metal to live in plugins #2045 [Matthew Rudy]
*2.3.0 [RC1] (February 1st, 2009)*
* Added metal [Josh Peek]
* Remove script/performance/request in favour of the performance integration tests. [Pratik Naik]

View file

@ -311,11 +311,11 @@ spec = Gem::Specification.new do |s|
EOF
s.add_dependency('rake', '>= 0.8.3')
s.add_dependency('activesupport', '= 2.3.1' + PKG_BUILD)
s.add_dependency('activerecord', '= 2.3.1' + PKG_BUILD)
s.add_dependency('actionpack', '= 2.3.1' + PKG_BUILD)
s.add_dependency('actionmailer', '= 2.3.1' + PKG_BUILD)
s.add_dependency('activeresource', '= 2.3.1' + PKG_BUILD)
s.add_dependency('activesupport', '= 2.3.2' + PKG_BUILD)
s.add_dependency('activerecord', '= 2.3.2' + PKG_BUILD)
s.add_dependency('actionpack', '= 2.3.2' + PKG_BUILD)
s.add_dependency('actionmailer', '= 2.3.2' + PKG_BUILD)
s.add_dependency('activeresource', '= 2.3.2' + PKG_BUILD)
s.rdoc_options << '--exclude' << '.'
s.has_rdoc = false

View file

@ -85,6 +85,10 @@ module Rails
Gem::RubyGemsVersion
end
property 'Rack version' do
::Rack.release
end
# The Rails version.
property 'Rails version' do
Rails::VERSION::STRING

View file

@ -18,7 +18,7 @@ module Rails
metal_glob.each do |glob|
Dir[glob].sort.map do |file|
file = file.match(matcher)[1]
all_metals[file.classify] = file
all_metals[file.camelize] = file
end
end

View file

@ -2,7 +2,7 @@ module Rails
module VERSION #:nodoc:
MAJOR = 2
MINOR = 3
TINY = 1
TINY = 2
STRING = [MAJOR, MINOR, TINY].join('.')
end

View file

@ -1,5 +1,5 @@
class MetalA < Rails::Rack::Metal
def self.call(env)
[200, { "Content-Type" => "text/html"}, "Hi"]
[200, { "Content-Type" => "text/html"}, ["Hi"]]
end
end

View file

@ -1,5 +1,5 @@
class MetalB < Rails::Rack::Metal
def self.call(env)
[200, { "Content-Type" => "text/html"}, "Hi"]
[200, { "Content-Type" => "text/html"}, ["Hi"]]
end
end

View file

@ -0,0 +1,5 @@
class LegacyRoutes < Rails::Rack::Metal
def self.call(env)
[301, { "Location" => "http://example.com"}, []]
end
end

View file

@ -1,5 +1,5 @@
class FooMetal < Rails::Rack::Metal
def self.call(env)
[200, { "Content-Type" => "text/html"}, "Hi"]
[200, { "Content-Type" => "text/html"}, ["Hi"]]
end
end

View file

@ -1,7 +1,7 @@
module Folder
class MetalA < Rails::Rack::Metal
def self.call(env)
[200, { "Content-Type" => "text/html"}, "Hi"]
[200, { "Content-Type" => "text/html"}, ["Hi"]]
end
end
end

View file

@ -1,7 +1,7 @@
module Folder
class MetalB < Rails::Rack::Metal
def self.call(env)
[200, { "Content-Type" => "text/html"}, "Hi"]
[200, { "Content-Type" => "text/html"}, ["Hi"]]
end
end
end

View file

@ -8,6 +8,12 @@ class MetalTest < Test::Unit::TestCase
end
end
def test_metals_should_respect_class_name_conventions
use_appdir("pluralmetal") do
assert_equal(["LegacyRoutes"], found_metals_as_string_array)
end
end
def test_metals_should_return_alphabetical_list_of_found_metal_apps
use_appdir("multiplemetals") do
assert_equal(["MetalA", "MetalB"], found_metals_as_string_array)