aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--actionmailer/CHANGELOG.md6
-rw-r--r--actionpack/CHANGELOG.md13
-rw-r--r--actionpack/lib/action_dispatch/routing/polymorphic_routes.rb8
-rw-r--r--actionpack/lib/action_dispatch/testing/integration.rb7
-rw-r--r--actionpack/lib/action_view/test_case.rb3
-rw-r--r--actionpack/test/abstract_unit.rb1
-rw-r--r--actionpack/test/activerecord/polymorphic_routes_test.rb28
-rw-r--r--actionpack/test/controller/integration_test.rb19
-rw-r--r--actionpack/test/template/test_case_test.rb19
-rw-r--r--activerecord/CHANGELOG.md9
-rw-r--r--activeresource/CHANGELOG.md6
-rw-r--r--activesupport/CHANGELOG.md9
-rw-r--r--railties/lib/rails/generators/rails/controller/templates/controller.rb2
-rw-r--r--railties/lib/rails/generators/rails/scaffold_controller/templates/controller.rb2
14 files changed, 122 insertions, 10 deletions
diff --git a/actionmailer/CHANGELOG.md b/actionmailer/CHANGELOG.md
index 58dc6b8ab4..4fd8190ee5 100644
--- a/actionmailer/CHANGELOG.md
+++ b/actionmailer/CHANGELOG.md
@@ -1,7 +1,13 @@
+## Rails 3.2.5 (Jun 1, 2012) ##
+
+* No changes.
+
+
## Rails 3.2.4 (May 31, 2012) ##
* No changes.
+
## Rails 3.2.3 (March 30, 2012) ##
* Upgrade mail version to 2.4.3 *ML*
diff --git a/actionpack/CHANGELOG.md b/actionpack/CHANGELOG.md
index 6f737001de..567e1b8a06 100644
--- a/actionpack/CHANGELOG.md
+++ b/actionpack/CHANGELOG.md
@@ -1,3 +1,15 @@
+## Rails 3.2.6 (unreleased) ##
+
+* Allow to use mounted_helpers (helpers for accessing mounted engines) in ActionView::TestCase. *Piotr Sarnacki*
+
+* Include mounted_helpers (helpers for accessing mounted engines) in ActionDispatch::IntegrationTest by default. *Piotr Sarnacki*
+
+
+## Rails 3.2.5 (Jun 1, 2012) ##
+
+* No changes.
+
+
## Rails 3.2.4 (May 31, 2012) ##
* Deprecate old APIs for highlight, excerpt and word_wrap *Jeremy Walker*
@@ -24,6 +36,7 @@
* Strip [nil] from parameters hash. Thanks to Ben Murphy for
reporting this! CVE-2012-2660
+
## Rails 3.2.3 (March 30, 2012) ##
* Allow to lazy load `default_form_builder` by passing a `String` instead of a constant. *Piotr Sarnacki*
diff --git a/actionpack/lib/action_dispatch/routing/polymorphic_routes.rb b/actionpack/lib/action_dispatch/routing/polymorphic_routes.rb
index 013cf93dbc..055761fed5 100644
--- a/actionpack/lib/action_dispatch/routing/polymorphic_routes.rb
+++ b/actionpack/lib/action_dispatch/routing/polymorphic_routes.rb
@@ -97,7 +97,7 @@ module ActionDispatch
end
record = extract_record(record_or_hash_or_array)
- record = record.to_model if record.respond_to?(:to_model)
+ record = convert_to_model(record)
args = Array === record_or_hash_or_array ?
record_or_hash_or_array.dup :
@@ -124,6 +124,8 @@ module ActionDispatch
args.last.kind_of?(Hash) ? args.last.merge!(url_options) : args << url_options
end
+ args.collect! { |a| convert_to_model(a) }
+
(proxy || self).send(named_route, *args)
end
@@ -154,6 +156,10 @@ module ActionDispatch
options[:action] ? "#{options[:action]}_" : ''
end
+ def convert_to_model(object)
+ object.respond_to?(:to_model) ? object.to_model : object
+ end
+
def routing_type(options)
options[:routing_type] || :url
end
diff --git a/actionpack/lib/action_dispatch/testing/integration.rb b/actionpack/lib/action_dispatch/testing/integration.rb
index ad78854471..ac784b3b60 100644
--- a/actionpack/lib/action_dispatch/testing/integration.rb
+++ b/actionpack/lib/action_dispatch/testing/integration.rb
@@ -177,8 +177,11 @@ module ActionDispatch
# If the app is a Rails app, make url_helpers available on the session
# This makes app.url_for and app.foo_path available in the console
- if app.respond_to?(:routes) && app.routes.respond_to?(:url_helpers)
- singleton_class.class_eval { include app.routes.url_helpers }
+ if app.respond_to?(:routes)
+ singleton_class.class_eval do
+ include app.routes.url_helpers if app.routes.respond_to?(:url_helpers)
+ include app.routes.mounted_helpers if app.routes.respond_to?(:mounted_helpers)
+ end
end
reset!
diff --git a/actionpack/lib/action_view/test_case.rb b/actionpack/lib/action_view/test_case.rb
index 98ce21ce1d..658a503f7f 100644
--- a/actionpack/lib/action_view/test_case.rb
+++ b/actionpack/lib/action_view/test_case.rb
@@ -229,7 +229,8 @@ module ActionView
def method_missing(selector, *args)
if @controller.respond_to?(:_routes) &&
- @controller._routes.named_routes.helpers.include?(selector)
+ ( @controller._routes.named_routes.helpers.include?(selector) ||
+ @controller._routes.mounted_helpers.method_defined?(selector) )
@controller.__send__(selector, *args)
else
super
diff --git a/actionpack/test/abstract_unit.rb b/actionpack/test/abstract_unit.rb
index 40ca23a39d..74efcba666 100644
--- a/actionpack/test/abstract_unit.rb
+++ b/actionpack/test/abstract_unit.rb
@@ -286,6 +286,7 @@ module ActionController
include ActionController::Testing
# This stub emulates the Railtie including the URL helpers from a Rails application
include SharedTestRoutes.url_helpers
+ include SharedTestRoutes.mounted_helpers
self.view_paths = FIXTURE_LOAD_PATH
diff --git a/actionpack/test/activerecord/polymorphic_routes_test.rb b/actionpack/test/activerecord/polymorphic_routes_test.rb
index 90e7f4ae59..afb714484b 100644
--- a/actionpack/test/activerecord/polymorphic_routes_test.rb
+++ b/actionpack/test/activerecord/polymorphic_routes_test.rb
@@ -25,6 +25,24 @@ class Series < ActiveRecord::Base
self.table_name = 'projects'
end
+class ModelDelegator < ActiveRecord::Base
+ self.table_name = 'projects'
+
+ def to_model
+ ModelDelegate.new
+ end
+end
+
+class ModelDelegate
+ def self.model_name
+ ActiveModel::Name.new(self)
+ end
+
+ def to_param
+ 'overridden'
+ end
+end
+
module Blog
class Post < ActiveRecord::Base
self.table_name = 'projects'
@@ -50,6 +68,7 @@ class PolymorphicRoutesTest < ActionController::TestCase
@bid = Bid.new
@tax = Tax.new
@fax = Fax.new
+ @delegator = ModelDelegator.new
@series = Series.new
@blog_post = Blog::Post.new
@blog_blog = Blog::Blog.new
@@ -439,6 +458,13 @@ class PolymorphicRoutesTest < ActionController::TestCase
end
end
+ def test_routing_a_to_model_delegate
+ with_test_routes do
+ @delegator.save
+ assert_equal "http://example.com/model_delegates/overridden", polymorphic_url(@delegator)
+ end
+ end
+
def with_namespaced_routes(name)
with_routing do |set|
set.draw do
@@ -469,6 +495,7 @@ class PolymorphicRoutesTest < ActionController::TestCase
resource :bid
end
resources :series
+ resources :model_delegates
end
self.class.send(:include, @routes.url_helpers)
@@ -516,5 +543,4 @@ class PolymorphicRoutesTest < ActionController::TestCase
yield
end
end
-
end
diff --git a/actionpack/test/controller/integration_test.rb b/actionpack/test/controller/integration_test.rb
index fda263310b..a9e59e2dbb 100644
--- a/actionpack/test/controller/integration_test.rb
+++ b/actionpack/test/controller/integration_test.rb
@@ -495,11 +495,26 @@ class ApplicationIntegrationTest < ActionDispatch::IntegrationTest
@routes ||= ActionDispatch::Routing::RouteSet.new
end
+ class MountedApp
+ def self.routes
+ @routes ||= ActionDispatch::Routing::RouteSet.new
+ end
+
+ routes.draw do
+ match 'baz', :to => 'application_integration_test/test#index', :as => :baz
+ end
+
+ def self.call(*)
+ end
+ end
+
routes.draw do
match '', :to => 'application_integration_test/test#index', :as => :empty_string
match 'foo', :to => 'application_integration_test/test#index', :as => :foo
match 'bar', :to => 'application_integration_test/test#index', :as => :bar
+
+ mount MountedApp => '/mounted', :as => "mounted"
end
def app
@@ -512,6 +527,10 @@ class ApplicationIntegrationTest < ActionDispatch::IntegrationTest
assert_equal '/bar', bar_path
end
+ test "includes mounted helpers" do
+ assert_equal '/mounted/baz', mounted.baz_path
+ end
+
test "route helpers after controller access" do
get '/'
assert_equal '/', empty_string_path
diff --git a/actionpack/test/template/test_case_test.rb b/actionpack/test/template/test_case_test.rb
index a75f1bc981..13a2b7fb6f 100644
--- a/actionpack/test/template/test_case_test.rb
+++ b/actionpack/test/template/test_case_test.rb
@@ -222,6 +222,25 @@ module ActionView
end
end
+ test "is able to use mounted routes" do
+ with_routing do |set|
+ app = Class.new do
+ def self.routes
+ @routes ||= ActionDispatch::Routing::RouteSet.new
+ end
+
+ routes.draw { get "bar", :to => lambda {} }
+
+ def self.call(*)
+ end
+ end
+
+ set.draw { mount app => "/foo", :as => "foo_app" }
+
+ assert_equal '/foo/bar', foo_app.bar_path
+ end
+ end
+
test "named routes can be used from helper included in view" do
with_routing do |set|
set.draw { resources :contents }
diff --git a/activerecord/CHANGELOG.md b/activerecord/CHANGELOG.md
index 6767fb74f5..0bd7685f9b 100644
--- a/activerecord/CHANGELOG.md
+++ b/activerecord/CHANGELOG.md
@@ -1,3 +1,11 @@
+## Rails 3.2.5 (Jun 1, 2012) ##
+
+* Restore behavior of Active Record 3.2.3 scopes.
+ A series of commits relating to preloading and scopes caused a regression.
+
+ *Andrew White*
+
+
## Rails 3.2.4 (May 31, 2012) ##
* Perf fix: Don't load the records when doing assoc.delete_all.
@@ -16,6 +24,7 @@
* Predicate builder should not recurse for determining where columns.
Thanks to Ben Murphy for reporting this! CVE-2012-2661
+
## Rails 3.2.3 (March 30, 2012) ##
* Added find_or_create_by_{attribute}! dynamic method. *Andrew White*
diff --git a/activeresource/CHANGELOG.md b/activeresource/CHANGELOG.md
index 5a626a262c..bf2a284284 100644
--- a/activeresource/CHANGELOG.md
+++ b/activeresource/CHANGELOG.md
@@ -1,7 +1,13 @@
+## Rails 3.2.5 (Jun 1, 2012) ##
+
+* No changes.
+
+
## Rails 3.2.4 (May 31, 2012) ##
* No changes.
+
## Rails 3.2.3 (March 30, 2012) ##
* No changes.
diff --git a/activesupport/CHANGELOG.md b/activesupport/CHANGELOG.md
index b231bdd1ac..e1ed948ede 100644
--- a/activesupport/CHANGELOG.md
+++ b/activesupport/CHANGELOG.md
@@ -1,11 +1,14 @@
+## Rails 3.2.5 (Jun 1, 2012) ##
+
+* ActiveSupport::JSON::Variable is deprecated. Define your own #as_json and #encode_json methods
+ for custom JSON string literals. *Erich Menge*
+
+
## Rails 3.2.4 (May 31, 2012) ##
* Added #beginning_of_hour and #end_of_hour to Time and DateTime core
extensions. *Mark J. Titorenko*
-* ActiveSupport::JSON::Variable is deprecated. Define your own #as_json and #encode_json methods
- for custom JSON string literals. *Erich Menge*
-
## Rails 3.2.3 (March 30, 2012) ##
diff --git a/railties/lib/rails/generators/rails/controller/templates/controller.rb b/railties/lib/rails/generators/rails/controller/templates/controller.rb
index ece6bbba3b..4053113b4b 100644
--- a/railties/lib/rails/generators/rails/controller/templates/controller.rb
+++ b/railties/lib/rails/generators/rails/controller/templates/controller.rb
@@ -1,7 +1,7 @@
<% if namespaced? -%>
require_dependency "<%= namespaced_file_path %>/application_controller"
-<% end -%>
+<% end -%>
<% module_namespacing do -%>
class <%= class_name %>Controller < ApplicationController
<% actions.each do |action| -%>
diff --git a/railties/lib/rails/generators/rails/scaffold_controller/templates/controller.rb b/railties/lib/rails/generators/rails/scaffold_controller/templates/controller.rb
index 593c8d85e6..6e4ad38c16 100644
--- a/railties/lib/rails/generators/rails/scaffold_controller/templates/controller.rb
+++ b/railties/lib/rails/generators/rails/scaffold_controller/templates/controller.rb
@@ -1,7 +1,7 @@
<% if namespaced? -%>
require_dependency "<%= namespaced_file_path %>/application_controller"
-<% end -%>
+<% end -%>
<% module_namespacing do -%>
class <%= controller_class_name %>Controller < ApplicationController
# GET <%= route_url %>