Tuesday, May 25, 2010

[Rails] Re: Factory Girl Alternative

On May 25, 11:11 pm, Marnen Laibow-Koser <li...@ruby-forum.com> wrote:
> 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#...@home.com",
>
> > 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 "jim...@home.com".  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.
>
Yes you are indeed talking piffle here.
If you prefer a block to a straight method declaration then this is
not for you, fair enough.
>
>
> > 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.
>
Nope sorry.
>
>
> > Best,
> > --
> > Marnen Laibow-Koser
> >http://www.marnen.org
> > mar...@marnen.org
>
> --
> Posted viahttp://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 rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate