immigrant 0.1.2 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/generators/immigration_generator.rb +2 -1
- data/lib/immigrant.rb +2 -12
- metadata +4 -4
@@ -2,6 +2,7 @@ require 'rails/generators/active_record'
|
|
2
2
|
|
3
3
|
class ImmigrationGenerator < ActiveRecord::Generators::Base
|
4
4
|
def create_immigration_file
|
5
|
+
Rails.application.eager_load!
|
5
6
|
@keys, warnings = Immigrant.infer_keys
|
6
7
|
warnings.values.each{ |warning| $stderr.puts "WARNING: #{warning}" }
|
7
8
|
@keys.each do |key|
|
@@ -17,4 +18,4 @@ class ImmigrationGenerator < ActiveRecord::Generators::Base
|
|
17
18
|
end
|
18
19
|
|
19
20
|
source_root File.expand_path(File.join(File.dirname(__FILE__), 'templates'))
|
20
|
-
end
|
21
|
+
end
|
data/lib/immigrant.rb
CHANGED
@@ -40,18 +40,8 @@ module Immigrant
|
|
40
40
|
|
41
41
|
def model_classes
|
42
42
|
classes = []
|
43
|
-
|
44
|
-
|
45
|
-
class_name = model.sub(/\A.*\/(.*?)\.rb\z/, '\1').camelize
|
46
|
-
begin
|
47
|
-
klass = class_name.constantize
|
48
|
-
rescue SyntaxError, LoadError
|
49
|
-
if File.read(model) =~ pattern
|
50
|
-
raise "unable to load #{class_name} and its associations"
|
51
|
-
end
|
52
|
-
next
|
53
|
-
end
|
54
|
-
classes << klass if klass < ActiveRecord::Base
|
43
|
+
ActiveRecord::Base.send(:subclasses).each do |model|
|
44
|
+
classes << model.name.constantize
|
55
45
|
end
|
56
46
|
classes
|
57
47
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: immigrant
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 29
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 3
|
10
|
+
version: 0.1.3
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Jon Jensen
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2012-
|
18
|
+
date: 2012-11-11 00:00:00 -07:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|