Sorry about the delay, this one got lost in my inbox.
It's not possible to pass local variables to the templates, this isn't something that ruby supports. ERb templates are rendered against a binding, i.e. in the context of some ruby object:
ERB.new(template_text).result(binding)
The template is rendered with the dep as its binding, so anything defined on the dep itself will be available in the template. So you have to make `item_name` available on the dep as a method (or an ivar, or any other way you'd access it locally). A local variable doesn't work because it's not actually defined on the object's binding, it's just in local scope (in your case, as a block argument).
Perhaps the dep could be rewritten to render a single template, which means item_name would become a dep parameter (which is available to the template, because it's really a method).
(Rails jumps through hoops to allow values to be passed in via the :locals option. Each value that's passed is defined on-the-fly as a method on whatever object the template is evaluated against.)
The 'context' option is for specifying a custom binding, i.e. the thing that will be instance eval'ed against. It's intended as an internal option; it's the dep itself that is the binding by default. If you pass another object, you won't have access to any of the dep's methods in the template anymore.
- Ben
> --
> To post, email
babush...@googlegroups.com
> To unsubscribe, email
babushka_app...@googlegroups.com
> ~
>
http://babushka.me
>
http://github.com/benhoskings/babushka
>
http://groups.google.com/group/babushka_app