On Tue, Dec 21, 2010 at 3:05 PM, Ralph Shnelvar <[email protected]> wrote:
> In HAML I have hundreds of lines like the following:
>
>  - xyz = someFuncThatReturnsString('xyz')
>
> and elsewhere
>
>  %div{'id' => xyz}
>
> The above lines work fine.
>
> - - -
>
> Attempting to keep things DRY (Don't repeat yourself) I want to do
> something like
>
>  - eval(otherFuncThatReturnsString('xyz'))
>
> where
>
>  otherFuncThatReturnsString('xyz')
>
> returns
>
>  "xyz = someFuncThatReturnsString('xyz')"
>
> When I do this, HAML no longer sees xyz as being defined when it
> attempts to interpret
>
>  %div{'id' => xyz}
>
> What am I doing wrong????
Defining variables on the views.
You should define those variables in the controllers and then have
them in the views or partials passing them as locals if necessary.

-- 
Leonardo Mateo.
There's no place like ~

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to