klass_name_types 1.0.4 → 1.0.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -11,8 +11,9 @@ class KlassNameType < ActiveRecord::Base
11
11
  unless table_exists?
12
12
  puts "klass_name_types table does not exist, so we're going to create the table."
13
13
  ActiveRecord::Base.connection.create_table(:klass_name_types) do |t|
14
- t.column :name, :string, :limit => 100, :null => false, :unique => true
14
+ t.column :name, :string, :limit => 100, :null => false
15
15
  end
16
+ ActiveRecord::Base.connection.add_index(:klass_name_types, :name, :unique => true)
16
17
  end
17
18
  rescue Exception => e
18
19
  end
@@ -1,54 +1,33 @@
1
-
2
1
  class << ActiveRecord::Base
3
2
 
4
3
  alias_method :ar_inherited, :inherited
5
4
 
6
5
  def inherited(child) #:nodoc:
7
6
  c_name = child.to_s
7
+ # puts "c_name = #{c_name}"
8
8
  begin
9
9
  unless c_name.match("#<Class:")
10
10
  unless KlassNameType.table_exists?
11
11
  KlassNameType.create_knt_table
12
12
  end
13
- if KlassNameType.create(:name => c_name)
14
- # puts "Created KlassNameType: #{c_name}"
15
- KlassNameType.reload_constants!
13
+
14
+ begin
15
+ m_flag = child.class_is_a?(MigrationModel)
16
+ rescue Exception => e
17
+ # puts e.inspect
18
+ m_flag = false
19
+ end
20
+
21
+ unless m_flag
22
+ if KlassNameType.create(:name => c_name)
23
+ # puts "Created KlassNameType: #{c_name}"
24
+ KlassNameType.reload_constants!
25
+ end
16
26
  end
17
27
  end
18
28
  rescue Exception => e
29
+ # puts e.inspect
19
30
  end
20
31
  ar_inherited(child)
21
32
  end
22
- end
23
-
24
- class ActiveRecord::Migration
25
-
26
-
27
- end
28
-
29
- # path = File.expand_path(RAILS_ROOT + "/app/models")
30
- # puts path
31
- #
32
- # FileUtils.mkdir_p(path) unless File.exists?(path)
33
- #
34
- # Find.find(path) do |f|
35
- # if FileTest.directory?(f) and f =~ /\.svn/
36
- # Find.prune
37
- # else
38
- # if FileTest.file?(f)
39
- # f.gsub!(path, "")
40
- # m = f.match(/\/[a-zA\-Z-_]*.rb/)
41
- # if m
42
- # model = m.to_s
43
- # x = model.gsub('/', '').gsub('.rb', '')
44
- # begin
45
- # # puts "x = #{x}"
46
- # puts "path/x = #{path}/#{x}"
47
- # require "#{path}/#{x}"
48
- # rescue => ex
49
- # puts ex
50
- # end
51
- # end
52
- # end
53
- # end
54
- # end
33
+ end
@@ -2,4 +2,4 @@
2
2
  gem_name: klass_name_types
3
3
  package: klass_name_types
4
4
  project: magrathea
5
- version: 1.0.4
5
+ version: 1.0.5
metadata CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.2
3
3
  specification_version: 1
4
4
  name: klass_name_types
5
5
  version: !ruby/object:Gem::Version
6
- version: 1.0.4
7
- date: 2007-09-20 00:00:00 -04:00
6
+ version: 1.0.5
7
+ date: 2007-09-21 00:00:00 -04:00
8
8
  summary: klass_name_types
9
9
  require_paths:
10
10
  - lib