Skip to content

Instantly share code, notes, and snippets.

@pedro
Created August 27, 2009 22:34
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 pedro/176634 to your computer and use it in GitHub Desktop.
Save pedro/176634 to your computer and use it in GitHub Desktop.
class Post < Sequel::Model
one_to_many :taggings
many_to_many :tags, :join_table => :taggings
end
class Tag < Sequel::Model
one_to_many :taggings
end
class Tagging < Sequel::Model
many_to_one :tag
many_to_one :post
end
# >> Post.new.tags
# Sequel::Error: model object Post does not have a primary key
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment