Questions tagged [ruby-datamapper]

DataMapper is a Object Relational Mapper written in Ruby. It implements an architectural pattern with the same name (with some changes).

Key features of Datamapper:

  • query chaining (delaying actual talking to a DB until necessary)
  • bulk loading of several data rows with one query
  • very abstract design allowing non-SQL adapters
  • lazy loading of large fields

Home page http://datamapper.org/

242 questions
53
votes
2 answers

Ruby on Rails app on Google App Engine

Can anyone give me some pointers on how I could deploy my rails app to GAE? I've been reading about it, but it seems to be a fairly complicated task. I tried with the google-appengine gem, but its not a piece of cake either. Has there been any…
Albus Dumbledore
  • 11,500
  • 22
  • 60
  • 102
21
votes
5 answers

Can DataMapper still be used for Rails?

I'm looking to use a more separated system for my models in a Ruby on Rails project. It looked like the solution was DataMapper. However, I see that none of their repositories have been updated in the last year, and when installed in a Rails 4…
Jonah
  • 9,535
  • 5
  • 39
  • 74
7
votes
2 answers

gem install dm-postgres-adapter build error

i'm trying to build dm-postgres-adapter but get this error. sudo gem install dm-postgres-adapter Building native extensions. This could take a while... ERROR: Error installing dm-postgres-adapter: ERROR: Failed to build gem native…
Chakalaka
  • 2,766
  • 16
  • 24
6
votes
2 answers

ruby datamapper will not load

I was trying to learn about the Sinatra ruby framework by following this tutorial: http://net.tutsplus.com/tutorials/ruby/singing-with-sinatra-the-recall-app-2/ however, after running the gem install and writing a simple sinatra server in test.rb…
GSto
  • 38,666
  • 37
  • 126
  • 179
5
votes
3 answers

Sinatra: NoMethodError

Whole source code here I think I have a logic error in program flow, which returns NoMethodError First, a piece of code which causes error.
marmeladze
  • 5,543
  • 3
  • 21
  • 41
5
votes
3 answers

Datamapper: report why I can't destroy record

I'm setting up my db model using datamapper and dm-contraints. I have two models which have a many to many relationship but when I try to destroy one, the only message I get is false. Is it possible to get datamapper to give me more feedback one…
Gerard
  • 4,688
  • 5
  • 48
  • 76
4
votes
3 answers

DataMapper - why "has" and "belongs_to"?

I'm just getting started with DataMapper and I'm trying to figure out why you need to specify a has and a belongs_to. For instance, look at the example on the DataMapper website. Isn't this redundant? If Post has n comments, then doesn't Comment…
MikeC8
  • 3,513
  • 2
  • 22
  • 32
4
votes
1 answer

Ruby Hash: can't convert String into Integer TypeError

Currently getting a Ruby Hash: can't convert String into Integer error. The code fails on the edit_id line. I've tried many different solutions from similar questions already posted on SE, but unfortunately none of them have…
Phil Hudson
  • 3,519
  • 8
  • 33
  • 55
4
votes
1 answer

Datamapper erases sqlite db when accessed via thin (sinatra)

I'm building a small web app using sinatra + datamapper. The app is based on an sqlite database which contains a big number of records in table1 and nothing in table2. My dir structure is the following: total 32 -rw-r--r-- 1 atma staff 1895 31…
atmosx
  • 1,330
  • 13
  • 18
4
votes
1 answer

is it possible to do a "where in" query with datamapper?

I would like to get a list of objects that match a specified ID from datamapper. I know I could use multiple 'or' conditions, but the list of id's can be in the hundreds. Is there a datamapper command that is equivalent to the following sql? select…
hyun
  • 63
  • 5
3
votes
1 answer

DataMapper one-to-many delete failing

class Alpha include DataMapper::Resource property :id, Serial property :name, String has n, :betas end class Beta include DataMapper::Resource property :id, Serial property :name, String belongs_to :alpha end # Create an Alpha…
Craig552uk
  • 591
  • 1
  • 4
  • 13
3
votes
1 answer

DataMapper - Enum like options flag for Discriminator?

I have recently started using DataMapper in a few projects & overall I think its just fantastic. But I have a question about using a particular aspect of it. I know that if I have a model with an Enum property (property :whatev, Enum[ :foo, :bar…
Don Graziano
  • 431
  • 5
  • 15
3
votes
2 answers

Adapters not working with datamapper

I have the following code: require 'sinatra' require 'datamapper' DataMapper.setup :default, "postgres://localhost/mydb" However, when I try and run it, I get: LoadError: no such file to load --…
ICR
  • 13,212
  • 4
  • 45
  • 77
3
votes
1 answer

Rails, DataMapper & JSON issue

I've some trouble with a really simple Rails setup using DataMapper. This is my model: class Capture include DataMapper::Resource property :id, Serial property :identifier, String property :caption, Text end Now I add a new capture in…
ctp
  • 1,025
  • 1
  • 7
  • 27
3
votes
1 answer

Updating a property set as the key in DataMapper

Is it possible to update a property in DataMapper if :key is set to true? Say, for example, I have a model set up like this: class Post include DataMapper::Resource property :slug, Text, :unique => true, :key => true # ... end and I made a…
Piccolo
  • 1,473
  • 2
  • 21
  • 35
1
2 3
16 17