On Mon, Aug 15, 2011 at 2:04 PM, tom <[email protected]> wrote:
> @why
> sometimes u just need to display another e 10digits number which u can
> trace back and is still unique
> @how
> still not sure if a loop is the right way

You can just try to save and be prepared to catch the validation
failure, which will require you to loop until the save succeeds.

Or you could pre-generate a list of guaranteed unique invoice ids to
use, which would eliminate all that.

TMTOWTDI  :-)

-- 
Hassan Schroeder ------------------------ [email protected]
http://about.me/hassanschroeder
twitter: @hassan

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