Class: Flms::ApplicationController

Inherits:
ActionController::Base
  • Object
show all
Defined in:
app/controllers/flms/application_controller.rb

Instance Method Summary collapse

Instance Method Details

#with_format(format) ⇒ Object

When we want to render a partial as HTML, but specify the plain_html custom format to a view, we need this method to swap the format to html so that Rails can properly resolve the partials (since we use *.html.haml for both :html and :plain_html formats)



8
9
10
11
12
13
14
# File 'app/controllers/flms/application_controller.rb', line 8

def with_format format
  old_formats = formats
  self.formats = [format]
  yield
  self.formats = old_formats
  nil
end