Skip to content

Instantly share code, notes, and snippets.

@fgrehm
Created October 16, 2009 22:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fgrehm/212121 to your computer and use it in GitHub Desktop.
Save fgrehm/212121 to your computer and use it in GitHub Desktop.
orm.map(Exhibit, "exhibits") do |exhibits, type|
exhibits.field :id, type.serial
exhibits.field :name, type.string(200)
exhibits.field :zoo_id, type.integer
exhibits.key :id
end
orm.map(ZooKeeper, 'zoo_keepers') do |zoo_keepers, type|
zoo_keepers.field :id, type.serial
zoo_keepers.field :name, type.string(200)
zoo_keepers.key :id
zoo_keepers.many_to_many(:exhibits, Exhibit, 'exhibits_zoo_keepers')
end
# this is what i thought for ManyToMany#load but there's no relation between Exhibits -> ZooKeeper
# only Exhibits <- ZooKeeper
orm.all(Exhibits) do |exhibits|
exhibits.zoo_keepers.id.eq(1)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment