Class: KlassNameType

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

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.create_knt_tableObject



16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/klass_name_type.rb', line 16

def self.create_knt_table
  begin
    unless table_exists?
      puts "klass_name_types table does not exist, so we're going to create the table."
      ActiveRecord::Base.connection.create_table(:klass_name_types) do |t|
        t.column :name, :string, :limit => 100, :null => false
      end
      ActiveRecord::Base.connection.add_index(:klass_name_types, :name, :unique => true)
    end
  rescue Exception => e
  end
end

Instance Method Details

#after_createObject



9
10
11
12
13
14
# File 'lib/klass_name_type.rb', line 9

def after_create
  begin
    KlassNameType.reload_constants!
  rescue Exception => e
  end
end