Sha256: 9a462a78e66e5e76c87a906b3446d612685264d113a58556d7629575ed81c004
Contents?: true
Size: 655 Bytes
Versions: 26
Compression:
Stored size: 655 Bytes
Contents
module Blog class EntriesTags < Sequel::Model set_schema do primary_key :id foreign_key :entry_id foreign_key :tag_id end many_to_one :entry, :class => 'Blog::Entry' many_to_one :tag, :class => 'Blog::Tag' create_table unless table_exists? end class Tag < Sequel::Model set_schema do primary_key :id varchar :name, :unique => true end many_to_many :entries, :class => 'Blog::Entry' def to_s name end def <=>(other) raise ArgumentError unless other.respond_to?(:name) self.name <=> other.name end create_table unless table_exists? end end
Version data entries
26 entries across 26 versions & 4 rubygems