Skip to content

Instantly share code, notes, and snippets.

require File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'spec_helper'))
require 'pp'
describe "OneToMany" do
before(:all) do
class Team
include DataMapper::Resource
def self.default_repository_name; ADAPTER end
property :id, Serial
@djwonk
djwonk / update.rb
Created September 10, 2008 23:12
update_merb_and_dm
class Updater
@base = "/Users/david/dev"
@extlib = @base + "/contrib/extlib"
@dm = @base + "/contrib/dm"
@merb = @base + "/sources/merb"
def self.start(force_install = false)
@force_install = force_install
update "extlib", "#{@extlib}"
update "do", "#{@dm}/do"
bayes:herb david$ merb -i
~ Loaded DEVELOPMENT Environment...
~ loading gem 'merb_datamapper' ...
~ loading gem 'dm-core' ...
~ Merb::Orms::DataMapper::Connect block.
~ Connecting to database...
~ Checking if we need to use DataMapper sessions
~ Merb::Orms::DataMapper::Connect complete
~ Compiling routes...
~ Starting Merb server listening at 0.0.0.0:4000
# /spec/public/controller/url_spec.rb
# round 'bout line 118
it "should match with an object as second arg and preserve content type" do
@monkey = Monkey.new
@controller.content_type = :xml
@controller.url(:monkey, @monkey).should == "/monkeys/45.xml"
end
This is a way to use run_later from Merb in a DataMapper model.
It runs the code in the block at some unspecified point in the
future.
I don't like that I copied and pasted run_later from Merb, but
run_later was defined at the controller level and this seemed
like a quick and easy way to do it.
# merb-core
# exceptions.rb
class InternalServerError < Merb::ControllerExceptions::ServerError #:doc:
self.status = 500;
# def initialize(exception = nil)
# @exception = exception
# end
#
# def backtrace
I *suspect* that the benchmark summary line might be wrong
A B A / B
10 8 1.25
100 50 2.00
-------------------
110 58 1.90
A straight average of 1.25 and 2.00 would be 1.62.
Perhaps model.rb line 195 has a bug.
The addition operator is probably intended to remove duplicates
(set like behavior) but does not appear to actually do so.
From 27114d268267fce766dbb3511f54463851b2f3bd Mon Sep 17 00:00:00 2001
From: David James <djwonk@collectiveinsight.net>
Date: Sun, 12 Oct 2008 21:14:07 -0400
Subject: [PATCH] Fixed warning about STATUS_CODES due to 2 requires.
---
lib/merb-core/autoload.rb | 4 ----
lib/merb-core/controller/status_codes.rb | 4 ++--
2 files changed, 2 insertions(+), 6 deletions(-)