aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--actionmailer/CHANGELOG2
-rw-r--r--actionpack/CHANGELOG7
-rw-r--r--actionpack/lib/action_controller/rescue.rb16
-rw-r--r--actionpack/lib/action_controller/test_case.rb9
-rw-r--r--actionpack/lib/action_view/partials.rb21
-rw-r--r--actionpack/lib/action_view/template.rb2
-rw-r--r--actionpack/test/controller/rescue_test.rb25
-rw-r--r--actionpack/test/fixtures/public/500.da.html1
-rw-r--r--activerecord/CHANGELOG2
-rw-r--r--activeresource/CHANGELOG5
-rw-r--r--activesupport/CHANGELOG2
-rw-r--r--railties/CHANGELOG2
-rw-r--r--railties/doc/guides/source/action_mailer_basics.txt2
13 files changed, 74 insertions, 22 deletions
diff --git a/actionmailer/CHANGELOG b/actionmailer/CHANGELOG
index 64124e06a8..ecfa25b0a0 100644
--- a/actionmailer/CHANGELOG
+++ b/actionmailer/CHANGELOG
@@ -1,4 +1,4 @@
-*2.3.0 [Edge]*
+*2.3.0 [RC1] (February 1st, 2009)*
* Fixed RFC-2045 quoted-printable bug #1421 [squadette]
diff --git a/actionpack/CHANGELOG b/actionpack/CHANGELOG
index 0d3f04373f..546311e078 100644
--- a/actionpack/CHANGELOG
+++ b/actionpack/CHANGELOG
@@ -1,4 +1,9 @@
-*2.3.0 [Edge]*
+*Edge*
+
+* 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]
diff --git a/actionpack/lib/action_controller/rescue.rb b/actionpack/lib/action_controller/rescue.rb
index 4b7d1e32fd..ec61715b57 100644
--- a/actionpack/lib/action_controller/rescue.rb
+++ b/actionpack/lib/action_controller/rescue.rb
@@ -99,13 +99,19 @@ module ActionController #:nodoc:
# Attempts to render a static error page based on the
# <tt>status_code</tt> thrown, or just return headers if no such file
- # exists. For example, if a 500 error is being handled Rails will first
- # attempt to render the file at <tt>public/500.html</tt>. If the file
- # doesn't exist, the body of the response will be left empty.
+ # exists. At first, it will try to render a localized static page.
+ # For example, if a 500 error is being handled Rails and locale is :da,
+ # it will first attempt to render the file at <tt>public/500.da.html</tt>
+ # then attempt to render <tt>public/500.html</tt>. If none of them exist,
+ # the body of the response will be left empty.
def render_optional_error_file(status_code)
status = interpret_status(status_code)
- path = "#{Rails.public_path}/#{status.to_s[0,3]}.html"
- if File.exist?(path)
+ locale_path = "#{Rails.public_path}/#{status[0,3]}.#{I18n.locale}.html" if I18n.locale
+ path = "#{Rails.public_path}/#{status[0,3]}.html"
+
+ if locale_path && File.exist?(locale_path)
+ render :file => locale_path, :status => status, :content_type => Mime::HTML
+ elsif File.exist?(path)
render :file => path, :status => status, :content_type => Mime::HTML
else
head status
diff --git a/actionpack/lib/action_controller/test_case.rb b/actionpack/lib/action_controller/test_case.rb
index 0b0d0c799b..d2059d51f4 100644
--- a/actionpack/lib/action_controller/test_case.rb
+++ b/actionpack/lib/action_controller/test_case.rb
@@ -127,9 +127,14 @@ module ActionController
#
# The exception is stored in the exception accessor for further inspection.
module RaiseActionExceptions
- protected
- attr_accessor :exception
+ def self.included(base)
+ base.class_eval do
+ attr_accessor :exception
+ protected :exception, :exception=
+ end
+ end
+ protected
def rescue_action_without_handler(e)
self.exception = e
diff --git a/actionpack/lib/action_view/partials.rb b/actionpack/lib/action_view/partials.rb
index 59e82b98a4..9e5e0f786e 100644
--- a/actionpack/lib/action_view/partials.rb
+++ b/actionpack/lib/action_view/partials.rb
@@ -187,15 +187,20 @@ module ActionView
builder_partial_path = partial_path.class.to_s.demodulize.underscore.sub(/_builder$/, '')
local_assigns.merge!(builder_partial_path.to_sym => partial_path)
render_partial(:partial => builder_partial_path, :object => options[:object], :locals => local_assigns)
- when Array, ActiveRecord::Associations::AssociationCollection, ActiveRecord::NamedScope::Scope
- render_partial_collection(options.except(:partial).merge(:collection => partial_path))
else
- object = partial_path
- render_partial(
- :partial => ActionController::RecordIdentifier.partial_path(object, controller.class.controller_path),
- :object => object,
- :locals => local_assigns
- )
+ if Array === partial_path ||
+ (defined?(ActiveRecord) &&
+ (ActiveRecord::Associations::AssociationCollection === partial_path ||
+ ActiveRecord::NamedScope::Scope === partial_path))
+ render_partial_collection(options.except(:partial).merge(:collection => partial_path))
+ else
+ object = partial_path
+ render_partial(
+ :partial => ActionController::RecordIdentifier.partial_path(object, controller.class.controller_path),
+ :object => object,
+ :locals => local_assigns
+ )
+ end
end
end
diff --git a/actionpack/lib/action_view/template.rb b/actionpack/lib/action_view/template.rb
index 1361a969a9..553158b82a 100644
--- a/actionpack/lib/action_view/template.rb
+++ b/actionpack/lib/action_view/template.rb
@@ -133,7 +133,7 @@ module ActionView #:nodoc:
end
def mime_type
- Mime::Type.lookup_by_extension(format) if format
+ Mime::Type.lookup_by_extension(format) if format && defined?(::Mime)
end
memoize :mime_type
diff --git a/actionpack/test/controller/rescue_test.rb b/actionpack/test/controller/rescue_test.rb
index 9f6b45f065..85c2a4c1bb 100644
--- a/actionpack/test/controller/rescue_test.rb
+++ b/actionpack/test/controller/rescue_test.rb
@@ -199,6 +199,31 @@ class RescueControllerTest < ActionController::TestCase
end
end
+ def test_rescue_action_in_public_with_localized_error_file
+ # Reload and register danish language for testing
+ I18n.reload!
+ I18n.backend.store_translations 'da', {}
+
+ # Ensure original are still the same since we are reindexing view paths
+ assert_equal ORIGINAL_LOCALES, I18n.available_locales.map(&:to_s).sort
+
+ # Change locale
+ old_locale = I18n.locale
+ I18n.locale = :da
+
+ with_rails_root FIXTURE_PUBLIC do
+ with_all_requests_local false do
+ get :raises
+ end
+ end
+
+ assert_response :internal_server_error
+ body = File.read("#{FIXTURE_PUBLIC}/public/500.da.html")
+ assert_equal body, @response.body
+ ensure
+ I18n.locale = old_locale
+ end
+
def test_rescue_action_in_public_with_error_file
with_rails_root FIXTURE_PUBLIC do
with_all_requests_local false do
diff --git a/actionpack/test/fixtures/public/500.da.html b/actionpack/test/fixtures/public/500.da.html
new file mode 100644
index 0000000000..a497c13656
--- /dev/null
+++ b/actionpack/test/fixtures/public/500.da.html
@@ -0,0 +1 @@
+500 localized error fixture
diff --git a/activerecord/CHANGELOG b/activerecord/CHANGELOG
index 0636841ed4..027533aa2d 100644
--- a/activerecord/CHANGELOG
+++ b/activerecord/CHANGELOG
@@ -1,4 +1,4 @@
-*2.3.0/3.0*
+*2.3.0 [RC1] (February 1st, 2009)*
* Add Support for updating deeply nested models from a single form. #1202 [Eloy Duran]
diff --git a/activeresource/CHANGELOG b/activeresource/CHANGELOG
index 428c6d91e9..fcb5dd5f46 100644
--- a/activeresource/CHANGELOG
+++ b/activeresource/CHANGELOG
@@ -1,3 +1,8 @@
+*2.3.0 [RC1] (February 1st, 2009)*
+
+* Nothing new, just included in 2.3.0
+
+
*2.2.1 [RC2] (November 14th, 2008)*
* Fixed that ActiveResource#post would post an empty string when it shouldn't be posting anything #525 [Paolo Angelini]
diff --git a/activesupport/CHANGELOG b/activesupport/CHANGELOG
index fed977775e..24e0836bde 100644
--- a/activesupport/CHANGELOG
+++ b/activesupport/CHANGELOG
@@ -1,4 +1,4 @@
-*2.3.0 [Edge]*
+*2.3.0 [RC1] (February 1st, 2009)*
* TimeWithZone#xmlschema accepts optional fraction_digits argument [#1725 state:resolved] [Nicholas Dainty]
diff --git a/railties/CHANGELOG b/railties/CHANGELOG
index 5b932ac197..38c6f808e6 100644
--- a/railties/CHANGELOG
+++ b/railties/CHANGELOG
@@ -1,4 +1,4 @@
-*2.3.0 [Edge]*
+*2.3.0 [RC1] (February 1st, 2009)*
* Remove script/performance/request in favour of the performance integration tests. [Pratik Naik]
diff --git a/railties/doc/guides/source/action_mailer_basics.txt b/railties/doc/guides/source/action_mailer_basics.txt
index f33839a8a9..6224a7b15b 100644
--- a/railties/doc/guides/source/action_mailer_basics.txt
+++ b/railties/doc/guides/source/action_mailer_basics.txt
@@ -476,4 +476,4 @@ class UserMailerTest < ActionMailer::TestCase
What have we done? Well, we sent the email and stored the returned object in the email variable. We then ensured that it was sent (the first assert), then, in the second batch of assertion, we ensure that the email does indeed contain the values that we expect.
== Epilogue
-This guide presented how to create a mailer and how to test it. In reality, you may find that writing your tests before you actually write your code to be a rewarding experience. It may take some time to get used to TDD (Test Driven Development), but coding this way achieves two major benefits. Firstly, you know that the code does indeed work, because the tests fail (because there's no code), then they pass, because the code that satisfies the tests was written. Secondly, when you start with the tests, you don't have to make time AFTER you write the code, to write the tests, then never get around to it. The tests are already there and testing has now become part of your coding regimen. \ No newline at end of file
+This guide presented how to create a mailer and how to test it. In reality, you may find that writing your tests before you actually write your code to be a rewarding experience. It may take some time to get used to TDD (Test Driven Development), but coding this way achieves two major benefits. Firstly, you know that the code does indeed work, because the tests fail (because there's no code), then they pass, because the code that satisfies the tests was written. Secondly, when you start with the tests, you don't have to make time AFTER you write the code, to write the tests, then never get around to it. The tests are already there and testing has now become part of your coding regimen.