datamapper

Does Datamapper for Codeigniter force an intermediate table for all relationships?

I'm moving towards an ORM for my codeigniter application and have chosen datamapper. However, in the rules section, it states the following: A joining table must exist between each related normal tables, regardless of the type of relationship. I have dozens of tables that are in a one->many relationship. Does this mean that I h...

How to ignore duplicate inserts with datamapper

I have a datamapper model that has a unique index on a property called name. I want to create new records when a name doesn't already exist and silently ignore attempts to create records with duplicate names. What's the "right" way to do this in datamapper? ...

Has anyone got Rails3 up and running with DataMapper on WindowsXP?

I've tried following the directions listed here, but it seems damn near everything in the ruby/rails community is NOT designed with windows in mind. Had to install MINGW32 and MSYS to even get native gems to compile. Had to install the Git Bash as the templates that are run assume you've got git functioning on your system. Depending on w...

Error happens when I read items in DataMapper

class List include DataMapper::Resource property :id, Serial property :name, String property :items, String end List.auto_migrate! get '/:id' do @list = List.all(:id => params[:id]) @items = @list.items erb :show end I get undefined method `it...

Datamapper 0.9.x or 0.10.x?

Hi, I'm currently have a ruby app that is running on Datamapper 0.9.11, and I wonder if upgrading to 0.10.x is a good idea. Any experiences regarding upgrade, performance or reliability problems with the 10.x. branch? ...

What's the significant difference between active record and data mapper based ORMs?

Like doctrine(active record) and Xyster(data mapper),what's the difference? ...

Ruby reuse methods in DataMapper classes (helper)

Hi I'm trying to reuse methods in DataMapper classes. This might be as well a ruby question I think. class Foo include DataMapper::Resource property :name property ... def self.special_name self.all(:name => 'whatever') end end class Bar include DataMapper::Resource property :name property ... def self.specia...

Is there active development going on IBatis.Net DataMapper?

Is there active development going on IBatis.Net DataMapper? Do they have version for .Net 3.5. I saw lots of activity on iBatis Java DataMapper as they are planning to release iBatis3 with annotation support. What is the status of its .Net counterpart? ...

Data-mapper and Cassandra

Hello, I not sure I have understood all the principles of nosql, especially Cassandra project, but I like to know if it's possible to have Cassandra working with Data-mapper ? I working on a ruby application using Data-mapper and MySQL and start to think of migrating to Cassandra. Is that something easy and worth doing ? Thanks a lot, Lu...

Extend Google AppEngine User in JRuby?

I'm working with JRuby and DataMapper running on Google AppEngine. I want to add a property to the AppEngine::User like :active_calendar which is a reference to a Calendar kind. I was able to do something in Python this way using a back reference. Are these possible in JRuby? Is this possible? Do I need to subclass the User? Can I even...

Datamapper has n relationship with multiple keys

I am working on a simple relationship with DataMapper, a ruby webapp to track games. A game belongs_to 4 players, and each player can have many games. When I call player.games.size, I seem to be getting back a result of 0, for players that I know have games associated with them. I am currently able to pull the player associations off of ...

Taking the data mapper approach in Zend Framework

Let's assume the following tables setup for a Zend Framework app. user (id) groups (id) groups_users (id, user_id, group_id, join_date) I took the Data Mapper approach to models which basically gives me: Model_User, Model_UsersMapper, Model_DbTable_Users Model_Group, Model_GroupsMapper, Model_DbTable_Groups Model_GroupUser, Model_Gr...

Saving a 'Date' using DataMapper on AppEngine+JRuby

I have a a model as follows: class Total include DataMapper::Resource property :id, Serial property :amount, Float, :default => 0.00 property :day, Date belongs_to :calendar end I am trying to select a specific Total from the data-store. class Calendar include DataMapper::Resource property :id, Serial ...

PHP ORM library based on the Data Mapper pattern

For a PHP application with a complex domain model, I don't want to use the Active Record pattern, I need instead the Data Mapper pattern (as presented in Zend Framework). Do you know any library that could help me for the ORM part, or else a link to a documentation on "how to do it right" ? Thanks ...

CodeIgniter & Datamapper as frontend, Django Admin as backend, database tables inconsistent

I created a database for a site i'm doing using Django as the admin backend. However because the server where the site is hosted on, won't be able to support Python, I find myself needing to do the front end in PHP and as such i've decided to use CodeIgniter along with Datamapper to map the models/relationship. However DataMapper requi...

DataMapper Dates

Forgive me if this is a simple answer. But how do you get a Date from a DataMapper property. For example: require 'rubygems' require 'sinatra' require 'datamapper' class Test include DataMapper::Resource property :id, Serial property :created_at, Date end get '/:id' do test = Test.get(1) test.created_at = ? end ...

Big sinatra problems

Hi, So I'm having huge trouble with sinatra. Here's what I have: require 'dm-core' DataMapper.setup(:default, ENV['DATABASE_URL'] || 'sqlite3://my.db') class Something include DataMapper::Resource property :id, Serial property :thing, Text property :run_in, Integer property :added_at, ...

DataMapper: Create new record or update existing

Does DataMapper provide a convenient way to create a new record when none exists or update an existing one? I couldn't find anything in the API documentation. This is what I have at the moment which doesn't seem very elegant: foo = Foo.get(id) if foo.nil? foo = Foo.create(#attributes...) else foo.update(#attributes...) end foo.save...

Data Mappers, Models and Images

Hi, I've seen and read plenty of blog posts and forum topics talking about and giving examples of Data Mapper / Model implementations in PHP, but I've not seen any that also deal with saving files/images. I'm currently working on a Zend Framework based project and I'm doing some image manipulation in the model (which is being passed a ...

Strange DataMapper (0.10.2) error. Please help!

See the full error here: http://notesapp.heroku.com/ I'm using DataMapper and dm-validations 0.10.2. No matter how much I tweak my models, I get the same error, or another one. Here's how my model looks like: class User include DataMapper::Resource attr_accessor :password, :password_confirmation property :id, Serial, :req...