nesquena/rabl — pull request #307 by geehsien (2012-08-08 22:03:26+00:00)
Title: Set instance variables in engine instead of renderer

Currently, instance variables are set on the `renderer` object based on what's provided in `options[:locals]`. When we render with the default context (self), these instance variables are copied to the `engine` object via `copy_instance_variables_from(@_scope, [:@assigns, :@helpers])`.

This logic breaks when we render with a separate scope. The instance variables are still copied onto the `renderer` object, but when we `copy_instance_variables_from(@_scope, [:@assigns, :@helpers])`, `@_scope` is another context/scope, and we don't have access to the instance variables in the template as we'd expect.

This commit sets the instance variables onto `engine` directly, without relying on `@_scope`.