Skip to content

Instantly share code, notes, and snippets.

View glongman's full-sized avatar

Geoff Longman glongman

View GitHub Profile
class MyModel < ActiveRecord::Base; end
# example model has 3 fields guid, name, and description
# find_or_create_by_name
mymodel = MyModel.find_or_create_by_name(params[:name) do |created|
created.guid = GuidGen.generate
created.description = params[:description]
#include "ruby.h"
/*
* Ruby access into the interpreter.
*/
/* Classes */
extern VALUE Z;