klass_name_types 1.0.2 → 1.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/klass_name_types.rb +37 -5
- data/lib/tasks/rubyforge_config.yml +1 -1
- metadata +1 -1
data/lib/klass_name_types.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
|
1
2
|
class << ActiveRecord::Base
|
2
3
|
|
3
4
|
alias_method :ar_inherited, :inherited
|
@@ -9,14 +10,45 @@ class << ActiveRecord::Base
|
|
9
10
|
unless KlassNameType.table_exists?
|
10
11
|
KlassNameType.create_knt_table
|
11
12
|
end
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
end
|
13
|
+
if KlassNameType.create(:name => c_name)
|
14
|
+
# puts "Created KlassNameType: #{c_name}"
|
15
|
+
KlassNameType.reload_constants!
|
16
16
|
end
|
17
17
|
end
|
18
18
|
rescue Exception => e
|
19
19
|
end
|
20
20
|
ar_inherited(child)
|
21
21
|
end
|
22
|
-
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
|