Does ActiveRecord have a built-in upsert functionality? I know I could write it myself but I obviously don\'t want to if such a thing already exists.
Model.find_or_initialize likely does what you want. You can chain it with save or update_attributes if that makes sense.
Model.find_or_initialize
save
update_attributes
More info in the Rails Guides.