On Dec 20, 11:01 am, "[email protected]" <[email protected]>
wrote:

> As a note, in the case where you just want a number in a string I
> prefer this syntax:
>
> Factory.define :article do |t|
>   t.association       :section
>   t.sequence(:title)  {|n| "Article#{n}"}
> end
>
> That way you don't have a sequence who's only job is to replicate this
> functionality; save those sequences for something that is more complex
> that you want to reuse and count.
>
> \Peter

Wait.... what if you wanted to do this?

t.title {|x| "#{x.section.name}Article#{Factory.next(:count)}" }

So would this be a scenario in which it's better to have a separate
sequence for "something that is more complex" - so like a sequence
called :article_title?

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