Skip to content

Commit

Permalink
[partials] Better lookup gets full template path
Browse files Browse the repository at this point in the history
  • Loading branch information
nesquena committed Mar 27, 2012
1 parent fa0f1c4 commit f34156a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/rabl/partials.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,10 @@ def fetch_source(file, options={})
if source_format && context_scope.respond_to?(:lookup_context) # Rails 3
lookup_proc = lambda { |partial| context_scope.lookup_context.find_template(file, [], partial) }
template = lookup_proc.call(false) rescue lookup_proc.call(true)
file_path = File.join(Rails.root.to_s, template.inspect) if template
file_path = template.identifier if template
elsif source_format && context_scope.respond_to?(:view_paths) # Rails 2
template = context_scope.view_paths.find_template(file, source_format, false)
file_path = File.join(view_path.first.to_s, template.inspect) if template
file_path = template.filename if template
else # fallback to manual
file_path = Dir[File.join("{#{view_path.join(",")}}", file + ".{*.,}rabl")].first
end
Expand Down

0 comments on commit f34156a

Please sign in to comment.