Class: ActionView::PathSet

Inherits:
Object
  • Object
show all
Defined in:
lib/facebooker/rails/extensions/action_view.rb

Instance Method Summary collapse

Instance Method Details

#find_template_with_facebooker(original_template_path, format = nil, html_fallback = true) ⇒ Object

Try to find fbml version if the format is fbjs



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/facebooker/rails/extensions/action_view.rb', line 4

def find_template_with_facebooker(original_template_path, format = nil, html_fallback = true)
  find_template_without_facebooker(original_template_path, format, html_fallback)
rescue ActionView::MissingTemplate
  template_path = original_template_path.sub(/^\//, '')

  each do |load_path|
   if format == :fbjs && html_fallback && template = load_path["#{template_path}.#{I18n.locale}.fbml"]
      return template
    elsif format == :fbjs && html_fallback && template = load_path["#{template_path}.fbml"]
      return template
    end

    raise MissingTemplate.new(self, original_template_path, format)
  end
end