Marnen Laibow-Koser wrote:: > Ginty wrote: > [...] >> def user >> # Define attributes via a hash, generate the values any way you want >> define :name => "Jimmy", >> # An 'n' counter method is available to help make things >> unique >> :email => "jimmy#[email protected]", > > I just realized something else. Because you're not passing a block > here, your counter method is useless -- the variable interpolations in > that string will only be done once, and every call of the factory > thereafter will set email to "[email protected]". There is *no possible > way* for this syntax to work as you intended. The *only* way to get > this to work is with a block (or with eval, but that's silly).
On third thought, this may not be true either. However, I really don't like the need to define a separate user method just to avoid passing blocks. > > In other words, your aversion to blocks as arguments appears to be > breaking your software. On reflection, perhaps not; but it does appear to be causing lots of silly contortions in your code. If you don't like the core language features, then I suggest (for your own sanity) that you find a language more compatible with your way of thinking. Don't try to make Ruby into (say) PHP, or PHP into Ruby. > > Best, > -- > Marnen Laibow-Koser > http://www.marnen.org > [email protected] -- 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.

