Sha256: 72d4b53aaa53a2d4f3fa719574bfb0b903d7daa485dcf2da0e4615c7a25fbeb1

Contents?: true

Size: 396 Bytes

Versions: 2

Compression:

Stored size: 396 Bytes

Contents

module TemplateSwitcher
  module ActionControllerExtension
    extend ActiveSupport::Concern

    included do
      alias :__render__ :render
    end

    def render_switcher(selector, *args)
      TemplateSwitcher.mapping ||= {}

      if mapping = TemplateSwitcher.mapping[selector]
        prepend_view_path(Rails.root.join("app", mapping))
      end
      __render__(*args)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
template-switcher-0.0.2 lib/template_switcher/action_controller_extension.rb
template-switcher-0.0.1 lib/template_switcher/action_controller_extension.rb