Da Sobota 11 Februr 2006 23:12 marcus napsal:
> I need to run an ERB template (a normal Rails view template) in a Rails
> model (and then write the result to a file). The problem is that I need
> to run it in the scope of the calling controller. So I was thinking of
> creating a binding in the controller and pass into the model and use the
> binding there. I do however need to add variables from the model scope
> into the binding. How do I do this? Thought of using eval with the
> binding but it only seems to take an input string to eval (a block would
> have been nice I think).
>
> The reason I do this is that the model in question is a STI model and
> each sub class may need to add different variables. If you can think of
> a better way to accomplish what I want I'll be glad to hear :)
>
> Thanks,
>
> /Marcus

I -think- instance variables get exported from the ERB template into the 
calling method.

David Vallner