diff --git a/lib/rabl-rails/renderers/base.rb b/lib/rabl-rails/renderers/base.rb index e053a19..00c85d7 100644 --- a/lib/rabl-rails/renderers/base.rb +++ b/lib/rabl-rails/renderers/base.rb @@ -3,11 +3,11 @@ module RablRails class PartialError < StandardError; end class Base - attr_accessor :options + attr_accessor :_options def initialize(context) # :nodoc: @_context = context - @options = {} + @_options = {} setup_render_context end @@ -21,7 +21,7 @@ module RablRails collection_or_resource = instance_variable_get(template.data) if template.data output_hash = collection_or_resource.respond_to?(:each) ? render_collection(collection_or_resource, template.source) : render_resource(collection_or_resource, template.source) - options[:root_name] = template.root_name + _options[:root_name] = template.root_name format_output(output_hash) end diff --git a/lib/rabl-rails/renderers/json.rb b/lib/rabl-rails/renderers/json.rb index ef42fb5..632aaec 100644 --- a/lib/rabl-rails/renderers/json.rb +++ b/lib/rabl-rails/renderers/json.rb @@ -2,7 +2,7 @@ module RablRails module Renderers class JSON < Base def format_output(hash) - hash = { options[:root_name] => hash } if options[:root_name] && RablRails.include_json_root + hash = { _options[:root_name] => hash } if _options[:root_name] && RablRails.include_json_root MultiJson.encode(hash) end end