Module: FerbHelper

Defined in:
lib/ferb_helper.rb

Class Method Summary collapse

Class Method Details

.included(base) ⇒ Object



19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/ferb_helper.rb', line 19

def self.included(base)
  base.send :include, Ferb
  path_suffix = ''
  if base.name =~ /^ApplicationHelper|ApplicationController$/i
    path_suffix = 'shared_templates'
  elsif base.name =~ /Helper$/i
    path_suffix = "#{base.name.gsub(/Helper$/,'').underscore}/"
  elsif base.name =~ /Controller$/i
    path_suffix = "#{base.name.gsub(/Controller$/,'').underscore}/"
  end
  base.template_root = Pathname.new(RAILS_ROOT)+'app/views/' + path_suffix
end