Class: Thoth::Tag

### Home Classes Methods

### In Files

- lib/thoth/model/tag.rb

### Parent

Sequel::Model

### Methods

- ::suggest
- #atom_url
- #posts
- #url

### Included Modules

- Ramaze::Helper::Link

### Files

- robots.txt

### Class/Module Index

Quicksearch

- Thoth
- Thoth::AdminController
- Thoth::ArchiveController
- Thoth::Comment
- Thoth::CommentApiController
- Thoth::CommentController
- Thoth::Config
- Thoth::Error
- Thoth::Importer
- Thoth::MainController
- Thoth::Media
- Thoth::MediaController
- Thoth::MinifyController
- Thoth::Page
- Thoth::PageApiController
- Thoth::PageController
- Thoth::Pager
- Thoth::Plugin
- Thoth::Plugin::Delicious
- Thoth::Plugin::Flickr
- Thoth::Plugin::Tags
- Thoth::Plugin::Twitter
- Thoth::Post
- Thoth::PostApiController
- Thoth::PostController
- Thoth::SchemaError
- Thoth::SearchController
- Thoth::Tag
- Thoth::TagApiController
- Thoth::TagController
- Thoth::TagsPostsMap
- Ramaze
- Ramaze::Dispatcher
- Ramaze::Dispatcher::File
- Ramaze::Helper
- Ramaze::Helper::Admin
- Ramaze::Helper::Cookie
- Ramaze::Helper::Error
- Ramaze::Helper::Pagination
- Ramaze::Helper::Sanitize
- Ramaze::Helper::Wiki
- Ramaze::Helper::Ysearch
- Ramaze::Helper::Ysearch::SearchError
- AddMediaSize
- CreateSchema
- PantsImporter
- PoseidonImporter

No matching classes.

# Thoth::Tag

### Public Class Methods

suggest(query, limit = 1000) click to toggle source

Gets an array of tag names and post counts for tags with names that begin with the specified query string.

    # File lib/thoth/model/tag.rb, line 48
    def self.suggest(query, limit = 1000)
      tags = []

      self.dataset.grep(:name, "#{query}%").all do |tag|
        tags << [tag.name, tag.posts.count]
      end

      tags.sort!{|a, b| b[1] <=> a[1]}
      tags[0, limit]
    end

### Public Instance Methods

atom_url() click to toggle source

Gets the Atom feed URL for this tag.

    # File lib/thoth/model/tag.rb, line 64
    def atom_url
      Config.site.url.chomp('/') + R(TagController, :atom, CGI.escape(name))
    end

posts() click to toggle source

Gets posts with this tag.

    # File lib/thoth/model/tag.rb, line 69
    def posts
      @posts ||= posts_dataset.reverse_order(:created_at)
    end

url() click to toggle source

URL for this tag.

    # File lib/thoth/model/tag.rb, line 74
    def url
      Config.site.url.chomp('/') + R(TagController, CGI.escape(name))
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.