Skip to content

Instantly share code, notes, and snippets.

@uranio-235
Created January 23, 2013 19:00
Show Gist options
  • Save uranio-235/4611620 to your computer and use it in GitHub Desktop.
Save uranio-235/4611620 to your computer and use it in GitHub Desktop.
#!/usr/bin/ruby
require 'data_mapper'
DataMapper.setup(:default, 'sqlite::memory:')
# la tabla es una clase
class Foo
include DataMapper::Resource
property :id, Serial
property :name, String
end
# crea las cosas
DataMapper.finalize
DataMapper.auto_migrate!
# siempre finalize despues de una operacion
Foo.create(:name => "Something")
# dame la consulta 0
puts Foo.all[0][:name]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment