Skip to content

Instantly share code, notes, and snippets.

umbra:gemologist ted$ rake db:automigrate --trace
(in /Users/ted/Sites/gemologist)
Loading init file from /Users/ted/Sites/gemologist/config/init.rb
Loading /Users/ted/Sites/gemologist/config/environments/development.rb
** Invoke db:automigrate (first_time)
** Invoke merb_env (first_time)
** Execute merb_env
Loading /Users/ted/Sites/gemologist/config/environments/rake.rb
~ Connecting to database...
~ Loaded slice 'MerbAuthSlicePassword' ...
Seed authentication
Automigrating in helper!
Automigrating in helper!
Automigrating in helper!
Automigrating in helper!
Automigrating in helper!
Automigrating in helper!
Automigrating in helper!
- authenticates a user with the correct name and password (PENDING: Not Yet Implemented)
- does not authenticate a user from another seed (PENDING: Not Yet Implemented)
@knowtheory
knowtheory / scratch
Created May 31, 2009 17:20 — forked from paul/scratch
Adapter Returns
===============
create(resources)
-----------------
Nothing. Doesn't matter what it returns. In the case of auto-populated fields, the adapter HAS all the records, it can just modify the
values directly. They don't need to be returned, DM should just update the identity map, and keep using them.
If something bad happens (not created for some reason) that is, and should be, and exception. In the case of DO, the most common case
SELECT "humans"."id", "humans"."first_name", "humans"."middle_name", "humans"."last_name"
FROM "humans"
INNER JOIN "ownerships" ON "pets"."id" = "ownerships"."pet_id"
INNER JOIN "humans" ON "ownerships"."human_id" = "humans"."id"
WHERE "pets"."name" = 'Bo'
GROUP BY "humans"."id", "humans"."first_name", "humans"."middle_name", "humans"."last_name"
ORDER BY "humans"."id"
require 'dm-core'
require 'spec'
DataMapper::Logger.new(STDOUT, :debug)
DataMapper.setup(:default, "mysql://localhost/dm_friends")
class User
include DataMapper::Resource
property :id, Serial
## full stack
NoMethodError in CommentController#post_comment
undefined method `new_record?' for "oooh trying again, goddamn it!":String
RAILS_ROOT: /home/jeremy/dk4-exper
Application Trace | Framework Trace | Full Trace
/usr/lib/ruby/gems/1.8/gems/dm-core-0.9.11/lib/dm-core/property.rb:450:in `lazy_load'
=begin
This is my control script.
DataMapper by itself doesn't seem to explode when using BigDecimal.
umbra:dm-specs ted$ ruby scratch_pad/big_dec.rb
Create
Find
Access Value
umbra:dm-specs ted$
# This file does not trigger the BigDecimal bug indicated here: http://www.ruby-lang.org/en/news/2009/06/09/dos-vulnerability-in-bigdecimal/
require 'rubygems'
require 'dm-core'
class BigDec
include DataMapper::Resource
property :id, Serial
property :value, BigDecimal
end
here = File.dirname(__FILE__)
require File.join(here, 'spec_helper')
class IntegerProperty
include DataMapper::Resource
property :id, Serial
property :number, Integer
end
describe "stuff" do
>> b = Human.get(1)
=> #<Human @id=1 @first_name="Barack" @middle_name=nil @last_name="Obama">
>> b == Human.get(1)
=> true
>> b.middle_name = "Hussein"
=> "Hussein"
>> b == Human.get(1)
=> false