Skip to content

Instantly share code, notes, and snippets.

@d11wtq
Created October 21, 2011 14:43
Show Gist options
  • Save d11wtq/1304016 to your computer and use it in GitHub Desktop.
Save d11wtq/1304016 to your computer and use it in GitHub Desktop.
source :rubygems
DM_VERSION = "~> 1.2.0"
gem "dm-core", DM_VERSION
gem "dm-serializer", DM_VERSION
require "dm-core"
require "dm-serializer"
DataMapper.setup(:default, :adapter => :in_memory)
class User
include DataMapper::Resource
property :id, Serial
end
DataMapper.finalize
3.times { User.create }
p User.all.class
#=> DataMapper::Collection
p DataMapper::Collection.instance_methods.grep /to_json/
#=> [:to_json]
p User.all.to_json
#=> undefined method `to_json' for [{:id=>1}, {:id=>2}, {:id=>3}]:Array (NoMethodError)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment