This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |