Sha256: e2b3fc912433e756b8d4aa030dfac960707160c2c311f6ff573bd04c7617b07c

Contents?: true

Size: 506 Bytes

Versions: 2

Compression:

Stored size: 506 Bytes

Contents

module Flms
  class ApplicationController < ActionController::Base

    # 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)
    def with_format format
      old_formats = formats
      self.formats = [format]
      yield
      self.formats = old_formats
      nil
    end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
flms-0.9.0 app/controllers/flms/application_controller.rb
flms-0.1.0 app/controllers/flms/application_controller.rb