Check if a record already exists and update if it exists
When working within a Rails environment you can use try

occurrence.try(:touch_with_version)
occurrence.present?


Ruby also provides tap so you could also write:

occurrence.tap({|o| o.try(:touch_with_version)}).present?


You could even dig into the libraries to see that touch_with_version returns the result of ActiveRecord's save! which in turn returns the result of create_or_update which returns a boolean and so you can write:

occurrence.try(:touch_with_version).present?


If you're happy returning true, false, or nil you could shorten it to:

occurrence.try(:touch_with_version)


Very nice but also more fragile if either of those libraries decide to change their return values in a future release.