Method: ActionView::LookupContext#formats=
- Defined in:
- actionview/lib/action_view/lookup_context.rb
#formats=(values) ⇒ Object
Override formats= to expand [“/”] values and automatically add :html as fallback to :js.
263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 |
# File 'actionview/lib/action_view/lookup_context.rb', line 263 def formats=(values) if values values = values.dup values.concat(default_formats) if values.delete "*/*" values.uniq! unless Template::Types.valid_symbols?(values) invalid_values = values - Template::Types.symbols raise ArgumentError, "Invalid formats: #{invalid_values.map(&:inspect).join(", ")}" end if (values.length == 1) && (values[0] == :js) values << :html @html_fallback_for_js = true end end super(values) end |