Skip to content

Instantly share code, notes, and snippets.

@zilkey
zilkey / save_objects.rb
Created December 16, 2013 22:00
save or destroy multiple objects in a transaction and return false if any one of them doesn't work
def save_objects(*objects)
success = false
ActiveRecord::Base.transaction do
results = objects.map do |object|
if object && !object.marked_for_destruction?
object.save
elsif object
object.destroy
else
true
@zilkey
zilkey / composer.json
Last active July 5, 2017 15:39
Bluemix Wordpress Configuration
{
"repositories": [
{
"type": "vcs",
"url": "[email protected]:ibmjstart/wp-bluemix-sendgrid.git"
},
{
"type": "vcs",
"url": "[email protected]:ibmjstart/wp-bluemix-objectstorage.git"
},