gary (owner)

Revisions

gist: 73517 Download_button fork
public
Public Clone URL: git://gist.github.com/73517.git
Embed All Files: show embed
carriers #
1
2
3
4
5
6
7
8
9
10
class Carrier
  include DataMapper::Resource
 
  property :id, Serial
 
  has n, :networks
  has n, :newspapers, :through => :networks
 
end
 
legacy join table #
1
2
3
4
5
6
7
8
9
10
class Network
  include DataMapper::Resource
 
  storage_names[:default] = 'clients_carriers'
 
  belongs_to :carrier, :key => true
  belongs_to :newspaper, :key => true, :child_key => [:client_id]
 
end
 
newspaper #
1
2
3
4
5
6
7
8
9
10
11
class Newspaper
  include DataMapper::Resource
 
  storage_names[:default] = 'clients'
 
  property :id, Serial
 
  has n, :networks, :child_key => [:client_id]
  has n, :carriers, :through => :networks
 
end