Module: TagDb

Defined in:
lib/tagutils/tags/readers/tag.rb,
lib/tagutils/tags.rb,
lib/tagutils/tags/schema.rb,
lib/tagutils/tags/patterns.rb,
lib/tagutils/tags/models/tag.rb,
lib/tagutils/tags/active_record.rb,
lib/tagutils/tags/models/tagging.rb,
lib/tagutils/tags/models/tag_comp.rb

Overview

use TagUtils - why? why not??

Defined Under Namespace

Modules: ClassMacros, Model Classes: CreateDb, TagReader

Constant Summary collapse

VERSION =
TagUtils::VERSION
TAG_KEY_PATTERN =

nb: only allow spaces and underscore inbetween;

do NOT allow digit as first char for now
'\A(?:[a-z]|[a-z][a-z0-9_ ]*[a-z0-9])\z'
TAG_KEY_PATTERN_MESSAGE =
"expected one or more lowercase letters a-z or 0-9 digits or space or underscore /#{TAG_KEY_PATTERN}/"
Models =

add convenience module alias in plural

e.g. lets you use include TagDb::Models
Model

Class Method Summary collapse

Class Method Details

.createObject



17
18
19
20
# File 'lib/tagutils/tags.rb', line 17

def self.create
  CreateDb.new.up
  ConfDb::Model::Prop.create!( key: 'db.schema.tag.version', value: VERSION )
end

.delete!Object

delete ALL records (use with care!)



23
24
25
26
27
# File 'lib/tagutils/tags.rb', line 23

def self.delete!
  puts '*** deleting tag/tagging table records/data...'
  Model::Tagging.delete_all
  Model::Tag.delete_all
end

.tablesObject



29
30
31
32
# File 'lib/tagutils/tags.rb', line 29

def self.tables
  puts "  #{Model::Tag.count} tags"
  puts "  #{Model::Tagging.count} taggings"
end