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:
parent
a16fa9abfd
commit
99975e742e
3 changed files with 5 additions and 2 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
1
actionpack/test/fixtures/respond_to/variant_plus_none_for_format.html.erb
vendored
Normal file
1
actionpack/test/fixtures/respond_to/variant_plus_none_for_format.html.erb
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
none
|
Loading…
Reference in a new issue