Skip to content
Browse files

Merge pull request #5359 from avakhov/missed-commits-from-3-2-stable

Missed commits from 3-2-stable
  • Loading branch information...
2 parents bbd2cae + 7708819 commit c4d90e42042e66faee9ff2a32625cb250c15b4ed @spastorino spastorino committed Mar 28, 2012
View
1 actionpack/lib/abstract_controller/layouts.rb
@@ -249,6 +249,7 @@ def conditional_layout?
# Symbol:: call the method specified by the symbol, which will return the template name
# false:: There is no layout
# true:: raise an ArgumentError
+ # nil:: Force default layout behavior with inheritance
#
# ==== Parameters
# * <tt>layout</tt> - The layout to use.
View
2 actionpack/lib/action_view/helpers/date_helper.rb
@@ -795,7 +795,7 @@ def select_year
private
%w( sec min hour day month year ).each do |method|
define_method(method) do
- @datetime.kind_of?(Fixnum) ? @datetime : @datetime.send(method) if @datetime
+ @datetime.kind_of?(Numeric) ? @datetime : @datetime.send(method) if @datetime
end
end
View
16 actionpack/test/abstract/layouts_test.rb
@@ -14,7 +14,10 @@ class Base < AbstractController::Base
"layouts/overwrite.erb" => "Overwrite <%= yield %>",
"layouts/with_false_layout.erb" => "False Layout <%= yield %>",
"abstract_controller_tests/layouts/with_string_implied_child.erb" =>
- "With Implied <%= yield %>"
+ "With Implied <%= yield %>",
+ "abstract_controller_tests/layouts/with_grand_child_of_implied.erb" =>
+ "With Grand Child <%= yield %>"
+
)]
end
@@ -64,6 +67,10 @@ class WithStringImpliedChild < WithString
class WithChildOfImplied < WithStringImpliedChild
end
+ class WithGrandChildOfImplied < WithStringImpliedChild
+ layout nil
+ end
+
class WithProc < Base
layout proc { |c| "overwrite" }
@@ -299,6 +306,13 @@ class TestBase < ActiveSupport::TestCase
assert_equal "With Implied Hello string!", controller.response_body
end
+ test "when a grandchild has nil layout specified, the child has an implied layout, and the " \
+ "parent has specified a layout, use the child controller layout" do
+ controller = WithGrandChildOfImplied.new
+ controller.process(:index)
+ assert_equal "With Grand Child Hello string!", controller.response_body
+ end
+
test "raises an exception when specifying layout true" do
assert_raises ArgumentError do
Object.class_eval do
View
12 actionpack/test/template/date_helper_test.rb
@@ -2132,6 +2132,18 @@ def test_datetime_select_with_separators
assert_dom_equal expected, datetime_select("post", "updated_at", { :date_separator => " / ", :datetime_separator => " , ", :time_separator => " - ", :include_seconds => true })
end
+ def test_datetime_select_with_integer
+ @post = Post.new
+ @post.updated_at = 3
+ datetime_select("post", "updated_at")
+ end
+
+ def test_datetime_select_with_infinity # Float
+ @post = Post.new
+ @post.updated_at = (-1.0/0)
+ datetime_select("post", "updated_at")
+ end
+
def test_datetime_select_with_default_prompt
@post = Post.new
@post.updated_at = nil
View
2 railties/lib/rails/generators/rails/app/templates/Gemfile
@@ -15,7 +15,7 @@ source 'https://rubygems.org'
# To use Jbuilder templates for JSON
# gem 'jbuilder'
-# Use unicorn as the web server
+# Use unicorn as the app server
# gem 'unicorn'
# Deploy with Capistrano

0 comments on commit c4d90e4

Please sign in to comment.
Something went wrong with that request. Please try again.