aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_controller
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2013-12-07 15:00:35 -0800
committerDavid Heinemeier Hansson <david@loudthinking.com>2013-12-07 15:00:35 -0800
commita16fa9abfd0b34026b04f4ceeb0b75e63609a74a (patch)
tree0f308828e18d5f0280530551cd6bc72ae2cbd647 /actionpack/lib/action_controller
parent76dae289edf33d4b3fc937ecd9d2c77b294d8074 (diff)
downloadrails-a16fa9abfd0b34026b04f4ceeb0b75e63609a74a.tar.gz
rails-a16fa9abfd0b34026b04f4ceeb0b75e63609a74a.tar.bz2
rails-a16fa9abfd0b34026b04f4ceeb0b75e63609a74a.zip
Allow code execution in case no variant has been set with variant.none
Diffstat (limited to 'actionpack/lib/action_controller')
-rw-r--r--actionpack/lib/action_controller/metal/mime_responds.rb9
1 files changed, 5 insertions, 4 deletions
diff --git a/actionpack/lib/action_controller/metal/mime_responds.rb b/actionpack/lib/action_controller/metal/mime_responds.rb
index 54d3be68f0..4993583c29 100644
--- a/actionpack/lib/action_controller/metal/mime_responds.rb
+++ b/actionpack/lib/action_controller/metal/mime_responds.rb
@@ -196,9 +196,10 @@ module ActionController #:nodoc:
# Respond to variants in the action just like you respond to formats:
#
# respond_to do |format|
- # format.html do |html|
- # html.tablet # renders app/views/projects/show.html+tablet.erb
- # html.phone { extra_setup; render ... }
+ # format.html do |variant|
+ # variant.tablet # renders app/views/projects/show.html+tablet.erb
+ # variant.phone { extra_setup; render ... }
+ # variant.none { special_setup } # executed only if there is no variant set
# end
# end
#
@@ -465,7 +466,7 @@ module ActionController #:nodoc:
end
def method_missing(name)
- yield if name == @variant
+ yield if name == @variant || (name == :none && @variant.nil?)
end
end
end