Event.where(value: params[:value]).first_or_create.touch
or in event.rb
before_save :update_if_existing
private
def update_if_existing
if event = Event.find_by(value: value)
event.touch # updates the updated_at timestamp if the existing event
false # prevents the current event from being inserted into the db
end
end