Module: HtmlSlice::Rails

Defined in:
lib/html_slice/rails.rb

Class Method Summary collapse

Class Method Details

.included(base) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/html_slice/rails.rb', line 5

def self.included(base)
  base.class_eval do
    include ActionView::RecordIdentifier
    include ActionView::Helpers::FormHelper
    include ActionView::Helpers::FormOptionsHelper
    include ActionView::Helpers::TranslationHelper
    include ActionView::Helpers::UrlHelper
    include ::Rails.application.routes.url_helpers
    include HtmlSlice

    def controller
      nil
    end

    def slice(slice_id = HtmlSlice::DEFAULT_SLICE, &block)
      html_slice(slice_id, &block).html_safe
    end
  end
end