Questions tagged [datamapper]

Architectural pattern for separating application logic from storage.

Objects and relational databases have different mechanisms for structuring data.

The Data Mapper is a layer of software that separates the in-memory objects from the database. Its responsibility is to transfer data between the two and also to isolate them from each other. With Data Mapper the in-memory objects needn't know even that there's a database present; they need no SQL interface code, and certainly no knowledge of the database schema.

Pattern definition: http://martinfowler.com/eaaCatalog/dataMapper.html

1134 questions
0
votes
1 answer

Save callbacks not running after append

I'm having a problem trying to append a relationship using the << operator. If I save after the append, my callback does not seem to run. I have two models: Fabric class Fabric include DataMapper::Resource property :id, Serial …
Anthony DeSimone
  • 1,994
  • 1
  • 12
  • 21
0
votes
1 answer

NoMethodError - undefined method 'id' for nil:NilClass with Sinatra app when deployed on Heroku

I am stuck with this problem. I have the following DataMapper model in my Sinatra app; class Word include DataMapper::Resource property :id, Serial, :key => true property :word, String end The following is another snippet of my code; get…
amirothman
  • 157
  • 1
  • 11
0
votes
1 answer

Infinite recursion while overriding DataMapper methods

I'm trying to override the all() and first() methods in a DataMapper model I have, but there are some issues. My methods are being called, but (as became immediately obvious) they call themselves recursively and cause a SystemStackError. class…
AlexQueue
  • 6,353
  • 5
  • 35
  • 44
0
votes
3 answers

one base executeQuery method or one for every query

I've started creating a toDoList and I like to create a "DataMapper" to fire queries to my Database. I created this Datamapper to handle things for me but I don't know if my way of thinking is correct in this case. In my Datamapper I have created…
Reshad
  • 2,570
  • 8
  • 45
  • 86
0
votes
1 answer

Datamapper ORM with memcache

I am using the wonderful ORM library at http://datamapper.wanwizard.eu/ in a PHP project. Is there a way to integrate memcache into this? I have enabled the config for the datamapper cache but this is just for the models. Apologies ahead of time as…
Luke Ollett
  • 316
  • 2
  • 16
0
votes
1 answer

NoMethodError when defining custom DataMapper property type

I'm using DataMapper 1.2.0 and trying to define a custom property type to save in the database. I'm trying to understand how I'm supposed to do this, but I keep getting a NoMethodError. The object is a Dog, but this type comes from a gem I don't…
Stephen Jennings
  • 12,494
  • 5
  • 47
  • 66
0
votes
1 answer

Mule DataMapper String List

I tryng to making a complex mapping (complex to me) with the follow scenario: In: 1 second third 4
Nicolas
  • 370
  • 3
  • 10
0
votes
1 answer

EF5 ASP.NET MVC 4 Linq query not returning anything & model property null -> Code First

Im having trouble linking my loaned items to my Library for each customer. It does it fine when it goes through the "AddToLibrary" method but when it comes to retreiving it, the medialibrary is empty and the query in the IEnumerable
user1290653
  • 775
  • 3
  • 11
  • 23
0
votes
1 answer

Why datamapper always round a default decimal to a integer

I use Ruby sinatra with datamapper. In my model I have a decimal property property :sim_update_interval, Decimal, :precision=>10, :scale=>2 , :default=>0.9 The problem is: Everytime I creates a new instance of the model, the default value of…
GingerJim
  • 3,737
  • 6
  • 26
  • 36
0
votes
1 answer

Datamapper ORM: get an object by array of ID's

i have an array like this: $arr = (1, 3, 87, 200); I wanna get the Object for these IDs only ca I do it like this: $object = new Object($arr); foreach($object as $o) { $o->user->get() }
John Smith
  • 47
  • 8
0
votes
1 answer

code igniter datamapper join get()

I am using this join in my code igniter model $this->db->select('e.name, p.projects'); $this->db->from('example as e'); $this->db->join('procure as p', e.id = p.id'); $this->db->where('e.cityid', '1'); …
user2261231
  • 109
  • 2
  • 13
0
votes
1 answer

Code igniter with data mapper giving in valid json

I have this to select columns from a table and I want to pass this to Jquery ajax fn. I am using below code but getting invalid json My table has three column id, name and city but I am not selecting city This is my json…
user2261231
  • 109
  • 2
  • 13
0
votes
1 answer

call model class object in codeginiter helper file while using wanwizard datamapper

While trying to access a user class object from codeigniter helper file, its throwing error like Class 'User' not found. My code is something like $u = new User(); $u->get(); I am able to use this in library files but not in helper files.…
Anusha
  • 281
  • 1
  • 13
0
votes
0 answers

Why do I get "undefined method 'insertsaying' for main:Object"?

I'm using DataMapper to create rows in MySQL. To make a new row in my "Ryne" table, I do: a = {:saying, "Ppffftt..!"} Ryne.create a So I said to myself, "Since I use this all the time, why not make a more 'slick' method which does this...": def…
Sean Larkin
  • 6,290
  • 1
  • 28
  • 43
0
votes
1 answer

DataMapper fetching last record using .last throws no method error if using .any? in view

Apologies for the long wined title, in my app I am trying to retrive e the last record from the database that matches the params I have passed to it. @goals = Weight.last(:is_goal=>true,:user_id=>@user.id) In my views I want to run a conditional…
Sam Mason
  • 1,037
  • 1
  • 8
  • 29