require 'rubygems' require 'dm-core' DataMapper.setup(:default, 'sqlite3::memory:') class Article include DataMapper::Resource property :id, Serial property :title, String property :body, Text property :locale, String belongs_to :link end class Link include DataMapper::Resource property :id, Serial has n, :articles # or a number of languages, if it`s fixed end DataMapper.auto_migrate! article_en = Article.new( :title => "ENGLISH article", :body => "english", :locale => 'en-EN' ) article_ru = Article.new( :title => "RUSSIAN article", :body => "russian", :locale => 'ru-RU' ) link1 = Link.new link1.articles << article_en << article_ru link1.save article_en = Article.new( :title => "ENGLISH article #2", :body => "english #2", :locale => 'en-EN' ) article_ru = Article.new( :title => "RUSSIAN article #2", :body => "russian #2", :locale => 'ru-RU' ) link2 = Link.new link2.articles << article_en << article_ru link2.save puts link1.articles.first(:locale => 'ru-RU').inspect puts link2.articles.first(:locale => 'ru-RU').inspect