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

Variants can be declared without a block to signify their presence in the controller

This commit is contained in:
David Heinemeier Hansson 2013-12-07 16:32:38 -08:00
parent a16fa9abfd
commit 99975e742e
3 changed files with 5 additions and 2 deletions

View file

@ -466,7 +466,9 @@ module ActionController #:nodoc:
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

View file

@ -170,7 +170,7 @@ class RespondToController < ActionController::Base
respond_to do |format|
format.html do |variant|
variant.phone { render text: "phone" }
variant.none { render text: "none" }
variant.none
end
end
end

View file

@ -0,0 +1 @@
none