On Nov 18, 7:27 pm, Jables
<brun3...-Meo6Lv8EUjg3uPMLIKxrzw@public.gmane.org>
wrote:> I have a script that is run by a cron job. It is constantly trying to
> put the same records into the database plus a few unique ones so to
> solve this I put a validates_uniqueness_of :title on the model. This
> has the desired effect but the script exits with error on a invalid
> validation (identical title). I want it to keep going to the next
> record. How is this accomplished?
>
if you are using save! (which raises exceptions upon things like that)
either rescue the appropriate exception or use save (without the
exclamation mark) which returns true/false rather than raising
exceptions.
Fred> Thanks,
> JB
--~--~---------~--~----~------------~-------~--~----~
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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
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
-~----------~----~----~----~------~----~------~--~---