Skip to content

Instantly share code, notes, and snippets.

View eka's full-sized avatar
🏠
Working from home

Esteban Feldman eka

🏠
Working from home
View GitHub Profile
configure :development do
require "sinatra/reloader" # First, a couple of dev-only requires
# Automatic reloading of files in the dev environment. Otherwise, it requires an app restart.
register Sinatra::Reloader
["helpers", "controllers", "models", "core_ext", "routes"].each do |folder|
Dir.glob("#{folder}/*.rb").each { |file| also_reload file }
end
#DataMapper::Model.raise_on_save_failure = true
enable :logging, :dump_errors
end
@eka
eka / fetch.rb
Last active August 29, 2015 13:57
class User < Ohm::Model
attribute :name
index :name
def self.fetch_by_field(field, values)
keys = to_indices(field, values)
command = Ohm::Command.new(:sunionstore, *keys)
Ohm::MultiSet.new(key, self, command)
end