Ralph Shnelvar wrote in post #969835:
> 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????

Almost everything. You're using eval (almost never necessary in Ruby -- 
send is usually what you want).  You're using eval in the view (breaking 
MVC).  You're using dynamic element IDs (questionable but sometimes 
necessary).  You're using camelCase (poor style for Ruby).

And most importantly, you're asking a question that is so abstract that 
it has little to do with your actual goal.

So...what are you actually trying to achieve here?  What's your *actual* 
code like?  What errors or unexpected behavior are you getting?

Best,
-- 
Marnen Laibow-Koser
http://www.marnen.org
[email protected]

Sent from my iPhone

-- 
Posted via http://www.ruby-forum.com/.

-- 
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