Skip to content

Instantly share code, notes, and snippets.

@arbales
Forked from arbales/gist:261484
Created December 27, 2009 17:22
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save arbales/264337 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby -Ku
# encoding: utf-8
require 'rubygems'
require 'dm-core'
require 'dm-types'
DataMapper::Logger.new($stdout, :debug)
DataMapper.setup(:default, "sqlite3:///#{Dir.pwd}/examine.db")
class Seating
include DataMapper::Resource
property :serial, Serial
property :days, Flag[:monday, :tuesday, :wednesday, :thursday, :friday, :saturday, :sunday]
end
DataMapper.auto_migrate!
Seating.create(:days => [:monday, :tuesday]) # A
Seating.create(:days => [:tuesday]) # B
Seating.create(:days => [:monday, :tuesday, :wednesday, :thursday, :friday]) # C
p Seating.all(:days => [:tuesday]) # Returns only B
p Seating.all(:days => [:monday, :tuesday]) # Returns only B
# Sad emoticon :'(
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment