Skip to content

Commit

Permalink
Variants can be declared without a block to signify their presence in…
Browse files Browse the repository at this point in the history
… the controller
  • Loading branch information
dhh committed Dec 8, 2013
1 parent a16fa9a commit 99975e7
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
4 changes: 3 additions & 1 deletion actionpack/lib/action_controller/metal/mime_responds.rb
Expand Up @@ -466,7 +466,9 @@ def initialize(variant)
end

def method_missing(name)
yield if name == @variant || (name == :none && @variant.nil?)
if block_given?
yield if name == @variant || (name == :none && @variant.nil?)
end
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion actionpack/test/controller/mime/respond_to_test.rb
Expand Up @@ -170,7 +170,7 @@ def variant_plus_none_for_format
respond_to do |format|
format.html do |variant|
variant.phone { render text: "phone" }
variant.none { render text: "none" }
variant.none
end
end
end
Expand Down
@@ -0,0 +1 @@
none

0 comments on commit 99975e7

Please sign in to comment.