Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- %w[save save!].each do |method_name|
- define_method(method_name) do
- self.slug = SecureRandom.hex(10) unless persisted?
- super()
- rescue ActiveRecord::RecordNotUnique => e
- e.message.match?(/index_certificates_on_slug/) ? retry : raise
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement