lib/rabl/partials.rb in rabl-0.6.7 vs lib/rabl/partials.rb in rabl-0.6.8
- old
+ new
@@ -60,12 +60,12 @@
def fetch_rails_source(file, options={})
# use Rails template resolution mechanism if possible (find_template)
source_format = request_format if defined?(request_format)
if source_format && context_scope.respond_to?(:lookup_context) # Rails 3
lookup_proc = lambda { |partial|
- if context_scope.lookup_context.method(:find).parameters.count < 5
+ if ActionPack::VERSION::MAJOR == 3 && ActionPack::VERSION::MINOR < 2
context_scope.lookup_context.find(file, [], partial)
- else
+ else # Rails 3.2 and higher
context_scope.lookup_context.find(file, [], partial, [], {:formats => [:json]})
end }
template = lookup_proc.call(false) rescue lookup_proc.call(true)
template.identifier if template
elsif source_format && context_scope.respond_to?(:view_paths) # Rails 2