Skip to content

Instantly share code, notes, and snippets.

View hashrocketeer's full-sized avatar

Hashrocket Employees hashrocketeer

View GitHub Profile
--regex-ruby=/(^|[:;])[ \t]*([A-Z][[:alnum:]_]+) *=/\2/c,class,constant/
--regex-ruby=/(^|;)[ \t]*(has_many|belongs_to|has_one|has_and_belongs_to_many)\(? *:([[:alnum:]_]+)/\3/f,function,association/
--regex-ruby=/(^|;)[ \t]*(named_)?scope\(? *:([[:alnum:]_]+)/\3/f,function,named_scope/
--regex-ruby=/(^|;)[ \t]*event\(? *:([[:alnum:]_]+)/\2/f,function,aasm_event/
--regex-ruby=/(^|;)[ \t]*event\(? *:([[:alnum:]_]+)/\2!/f,function,aasm_event/
--regex-ruby=/(^|;)[ \t]*event\(? *:([[:alnum:]_]+)/\2?/f,function,aasm_event/
class FuzzyHash
attr_reader :attrs
def initialize(attrs)
@attrs = attrs
end
def blank?
attrs.nil?
end
require 'mongoid'
Mongoid.configure do |config|
config.master = Mongo::Connection.new.db('testing')
end
class User
include Mongoid::Document
collection.remove
end