aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_view
diff options
context:
space:
mode:
authorJosé Valim <jose.valim@gmail.com>2011-05-07 23:43:25 +0200
committerJosé Valim <jose.valim@gmail.com>2011-05-07 23:43:44 +0200
commit0a1ba4eab0c442f3e9f4027e4b5d3418f8eb6ca4 (patch)
tree55765061231ecbeaa21883f17e77dc8ff76e2037 /actionpack/lib/action_view
parentfadd1fa3d314639067404403651de52a7d2b72f7 (diff)
downloadrails-0a1ba4eab0c442f3e9f4027e4b5d3418f8eb6ca4.tar.gz
rails-0a1ba4eab0c442f3e9f4027e4b5d3418f8eb6ca4.tar.bz2
rails-0a1ba4eab0c442f3e9f4027e4b5d3418f8eb6ca4.zip
Always expand */*
Diffstat (limited to 'actionpack/lib/action_view')
-rw-r--r--actionpack/lib/action_view/lookup_context.rb11
1 files changed, 4 insertions, 7 deletions
diff --git a/actionpack/lib/action_view/lookup_context.rb b/actionpack/lib/action_view/lookup_context.rb
index 02114f46da..f0ed3425de 100644
--- a/actionpack/lib/action_view/lookup_context.rb
+++ b/actionpack/lib/action_view/lookup_context.rb
@@ -167,15 +167,12 @@ module ActionView
@frozen_formats = true
end
- # Overload formats= to reject ["*/*"] values.
+ # Overload formats= to expand ["*/*"] values and automatically
+ # add :html as fallback to :js.
def formats=(values)
if values
- values.pop if values.last == "*/*"
- if values.size == 0
- values = nil
- elsif values == [:js]
- values << :html
- end
+ values.concat(_formats_defaults) if values.delete "*/*"
+ values << :html if values == [:js]
end
super(values)
end