Class: PgTagsOn::Tag

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
lib/pg_tags_on/tag.rb

Overview

Model for tags. Schema is defined dynamically and has only name column as string.

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.load_schema!Object



10
11
12
13
14
15
# File 'lib/pg_tags_on/tag.rb', line 10

def load_schema!
  @load_schema ||= begin
    name_column = ::ActiveRecord::ConnectionAdapters::PostgreSQL::Column.new('name', '', pg_string_type)
    @columns_hash = { 'name' => name_column }
  end
end

Instance Method Details

#inspectObject



25
26
27
28
29
# File 'lib/pg_tags_on/tag.rb', line 25

def inspect
  info = attributes.map { |name, value| %(#{name}: #{format_for_inspect(value)}) }.join(', ')

  "#<#{self.class.name} #{info}>"
end