Skip to content

Instantly share code, notes, and snippets.

View snusnu's full-sized avatar

Martin Gamsjaeger snusnu

View GitHub Profile
module DataMapper
module Types
class UtcDateTime < DataMapper::Type
primitive DateTime
def self.load(value, property)
if value.nil?
require 'rubygems'
require 'dm-core'
require 'spec'
module DataMapper
module ActiveModel
# This is mostly copied from active_model and adapted to use extlib under the hood.
# see http://github.com/rails/rails/blob/master/activemodel/lib/active_model/naming.rb
## no idea
'Merb::Controller#cookies creating should append secure to the end of the cookie header when marked as such' FAILED
expected "safecook=no-hackers-here; domain=specs.merbivore.com; path=/; secure;" to match /secure$/
## probably bundler related
'using dependency to require a simple gem loads dependencies immediately if Merb is already started' FAILED
expected not nil, got nil
# setup new rubygem environment for merb 1.0.x
gem install extlib rspec rake memcache-client mongrel ruby-debug hpricot --no-rdoc --no-ri
gem install webrat --version=0.3.1 --no-rdoc --no-ri
gem install json_pure --version=1.1.6 --no-rdoc --no-ri
require 'rubygems'
require 'dm-core'
module DataMapper
# monkey patch alarm
def self.setup(*args)
# original code
# ------------------------------------------------
mysql:
mysql-config: /usr/local/mysql/bin/mysql_config
nokogiri:
xml2-include: /opt/local/include/libxml2
xml2-lib: /opt/local/lib
xslt-dir: /opt/local
iconv-dir: /opt/local
require 'extlib/assertions' # pull it in
require 'extlib/inflection' # use active_support
require 'extlib/lazy_array' # pull it in
require 'extlib/logger' # use active_support
require 'extlib/class' # pull it in
require 'extlib/hash' # use active_support
require 'extlib/mash' # use active_support (if available)
require 'extlib/pathname' # think about dropping
require 'extlib/module' # think about using active_support
require 'extlib/object' # pull it in
require 'rubygems'
require 'dm-core'
DataMapper::Logger.new($stdout, :debug)
DataMapper.setup(:default, 'sqlite3:memory:')
class Quote
include DataMapper::Resource
property :id, Serial
has 0..n, :billings, :through => Resource
development:
adapter: master_slave
master:
adapter: mysql
database: master
host: master_server
slave:
adapter: mysql
database: slave
host: localhost
module ParameterSanitization
# Convert blank strings to nil if type is Integer and nils are allowed
#
# @example
#
# class User
#
# include DataMapper::Resource
#