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

"Retweets" with Datamapper

I want to impliment something which is similar to Twitter Repost System, therefore I will use this as an example. So let's say I have a Tweet Model and I want to allow other user to repost a certian tweet of another user, how do I impliment…
Micheal Perr
  • 1,805
  • 5
  • 18
  • 24
0
votes
1 answer

ruby Datamapper is not inserting all records

I have this ruby function which yields 1095 records MusicTab::FOps.gen_list('/fun/Music') and I want to store them using datamapper. When I do this MusicTab::FOps.gen_list('/fun/Music') do |arr_f| @files=Files.create( :file_path => arr_f[0], :title…
pahnin
  • 5,367
  • 12
  • 40
  • 57
0
votes
2 answers

Advanced DataMapper search for Many to Many relation

Give the Tag/Photo exemple on DataMapper documentation: class Photo include DataMapper::Resource property :id, Serial has n, :taggings has n, :tags, :through => :taggings end class Tag include DataMapper::Resource property…
cpereira
  • 155
  • 9
0
votes
2 answers

DataMapper fake property that's not stored in the DB

Is it possible to set up something you could call a "fake property" in a DataMapper model? What I mean is, a property that isn't persisted, but that is still modifiable using create() or update(). Instead of persisting the data in the data store, a…
user1499207
  • 305
  • 1
  • 4
  • 7
0
votes
1 answer

What do you think is the best approach for creating a data mapping layer in python?

I would appreciate hearing some opinions on the best approach to creating a light-weight data mapping layer between some python objects and a postgres database. I'm using the psycopg2 library, and plan to use pgbouncer. I looked at this:…
Jaigus
  • 1,422
  • 1
  • 16
  • 31
0
votes
1 answer

Datamapper two associations at the same time

Lets say I have a post, this post should have a certian amount of comments, and these comments should be created by certian users. So these are my datamapper models: class User include DataMapper::Resource property :id, Serial property :name,…
Micheal Perr
  • 1,805
  • 5
  • 18
  • 24
0
votes
1 answer

Error installing datamapper gem on lion

I am trying to install the datamapper gem on mac os x lion but am getting failed to build gem native extension while installing the sqlite adapter (see terminal output below). The two solutions I found from google and other stack overflow questions…
Ben
  • 643
  • 2
  • 11
  • 25
0
votes
1 answer

Minimum length for a String property in DataMapper

Im using DataMapper in my Sinatra application.I defined a property called 'to' whose minimum length i want to be 10 property :to,String,:required => true,:min => 10 This causes my application to crash with the error assert_valid_options':…
Kris
  • 1,403
  • 3
  • 17
  • 26
0
votes
2 answers

Creating multiple models

I'm using Zend Framework and implementing Domain Model. I have Models, Mappers and DbTables. Suppose we should fetch multiple rows from database or fetch form data where we should create multiple models and populate that models from database rows or…
Tigran Tokmajyan
  • 1,937
  • 7
  • 25
  • 36
0
votes
1 answer

DataMapper has_one problem

I`m having trouble associating models in DataMapper. Its really simple, but i just can get the idea. So, i have 2 tables: 1. Books -> id -> title -> publisher_id 2. Publishers -> id -> title The classes: class Book property :id, Serial …
Joe
0
votes
1 answer

undefined method `include?' for nil:NilClass

I have a Sinatra application running on Ubuntu / Apache2 / Passenger. It's a simple URL shortener that works on my staging server but started throwing the following error when I imported the old database (containing shortened URLS): undefined method…
Matt Gifford
  • 1,268
  • 9
  • 13
0
votes
1 answer

string to object?

Consider the following code: I receive an object from datamapper which contains Values from my select: user = User.first() puts user.name # John puts user.surname # Doe puts user.age # 42 In a user defined Array I have an Order for these Values to…
witsches
  • 227
  • 2
  • 3
  • 7
0
votes
1 answer

getting difficulty in generating the Dyanmic checkbox from the database

I am using Codeigniter and Datamapper for DB Query. My controller is as follows function fetch_interested_in() { $in = new Interested_in(); $in -> get(); $interested_in = array(); foreach($in -> all as $data) { …
Shashi Roy
  • 323
  • 3
  • 7
  • 22
0
votes
1 answer

Selecting Item from Android Spinner and Using It

I have a spinner which is populated from an Enum: public enum Frequencies { EVERYDAY("Every day"), EVERYOTHERDAY("Every second day"); private String friendlyName; private Frequencies(String friendlyName) { …
barry
  • 4,037
  • 6
  • 41
  • 68
0
votes
1 answer

Graphical Data Mapping for Eclipse

I´m looking for an open source graphical data mapper for Java/Eclipse that can map between POJOs. Something similar to Mapforce, Mule Studio's data mapper component or Dozer (but visual). Regards.
Víctor Romero
  • 5,107
  • 2
  • 22
  • 32