lib/rabl/partials.rb in rabl-0.9.0.pre3 vs lib/rabl/partials.rb in rabl-0.9.0.pre4
- old
+ new
@@ -8,11 +8,11 @@
# options can have :view_path, :child_root, :root
def partial(file, options={}, &block)
raise ArgumentError, "Must provide an :object option to render a partial" unless options.has_key?(:object)
object, view_path = options.delete(:object), options[:view_path] || @_view_path
source, location = self.fetch_source(file, :view_path => view_path)
- engine_options = options.merge(:source => source, :source_location => location)
+ engine_options = options.merge(:source => source, :source_location => location, :template => file)
self.object_to_hash(object, engine_options, &block)
end
# Returns a hash based representation of any data object given ejs template block
# object_to_hash(@user) { attribute :full_name } => { ... }
@@ -41,19 +41,14 @@
fetch_sinatra_source(file, options)
else # generic template resolution
fetch_manual_template(view_paths, file)
end
- # being used by cache digestor
- if defined?(Rails) && Rails.version =~ /^[4]/
- @_virtual_path = file_path.gsub('app/views/', '').gsub('.rabl', '')
- end
-
unless File.exist?(file_path.to_s)
raise "Cannot find rabl template '#{file}' within registered (#{view_paths.map(&:to_s).inspect}) view paths!"
end
- [File.read(file_path.to_s), file_path.to_s] if file_path
+ [File.read(file_path.to_s), file_path.to_s]
end
end
private