[Machinist 2] Unique attributes with other validations

10 views
Skip to first unread message

Marcello 'Mereghost' Rocha

unread,
Jul 11, 2010, 11:07:00 AM7/11/10
to Machinist Users
In Machinist 2 how should I handle the following case: A model Person
has a SSN which is a structured number which can (and will) be
validated. Should I generate a number on the fly by creating a method
in the spec_helper (or even in the blueprint)?

Pete Yandell

unread,
Jul 11, 2010, 7:01:38 PM7/11/10
to Machinist Users


On Jul 12, 1:07 am, "Marcello 'Mereghost' Rocha"
A blueprint block is just regular Ruby code, so you can happily put
some logic in there to generate your SSN, or you can pull it out into
a method and call it from your blueprint.

- Pete
Reply all
Reply to author
Forward
0 new messages