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

Version Path
Pistos-ramaze-2009.06.12 examples/app/blog/model/tag.rb
manveru-ramaze-2009.04.22 examples/app/blog/model/tag.rb
manveru-ramaze-2009.04 examples/app/blog/model/tag.rb
manveru-ramaze-2009.05.08 examples/app/blog/model/tag.rb
manveru-ramaze-2009.05 examples/app/blog/model/tag.rb
manveru-ramaze-2009.06.04 examples/app/blog/model/tag.rb
manveru-ramaze-2009.06.12 examples/app/blog/model/tag.rb
manveru-ramaze-2009.06 examples/app/blog/model/tag.rb
manveru-ramaze-2009.07 examples/app/blog/model/tag.rb
rjspotter-ramaze-2009.06.29 examples/app/blog/model/tag.rb
rjspotter-ramaze-2009.06.31 examples/app/blog/model/tag.rb
ramaze-2011.07.25 examples/app/blog/model/tag.rb
ramaze-2011.01.30 examples/app/blog/model/tag.rb
ramaze-2011.01 examples/app/blog/model/tag.rb
ramaze-2010.06.18 examples/app/blog/model/tag.rb
ramaze-2010.04.04 examples/app/blog/model/tag.rb
ramaze-2010.04 examples/app/blog/model/tag.rb
ramaze-2010.03 examples/app/blog/model/tag.rb
ramaze-2010.01 examples/app/blog/model/tag.rb
ramaze-2009.10 examples/app/blog/model/tag.rb