modelist 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +36 -2
- data/lib/modelist/tester.rb +5 -0
- data/lib/modelist/version.rb +1 -1
- metadata +2 -2
data/README.md
CHANGED
@@ -61,7 +61,7 @@ Example output:
|
|
61
61
|
1 (out of 2): bartenders.order_id -> order
|
62
62
|
1 (out of 2): bartenders.beer_id -> beers
|
63
63
|
|
64
|
-
Specify
|
64
|
+
Specify --output-file to provide an pathname of an errors file.
|
65
65
|
|
66
66
|
##### Required
|
67
67
|
|
@@ -90,7 +90,41 @@ or:
|
|
90
90
|
|
91
91
|
Example output:
|
92
92
|
|
93
|
-
|
93
|
+
(...example data from models and attributes...)
|
94
|
+
---
|
95
|
+
|
96
|
+
|
97
|
+
FAILED: MyModel
|
98
|
+
|
99
|
+
---
|
100
|
+
MyModel.last.some_associations: PG::Error: ERROR: operator does not exist: character varying = integer
|
101
|
+
LINE 1: ...oobars" WHERE "foobars"."my_model_id" = 7
|
102
|
+
^
|
103
|
+
(...continued and backtrace...)
|
104
|
+
---
|
105
|
+
(...more errors...)
|
106
|
+
|
107
|
+
|
108
|
+
Passed (258):
|
109
|
+
---
|
110
|
+
AnotherGoodModel
|
111
|
+
GoodModel
|
112
|
+
...
|
113
|
+
|
114
|
+
Warnings (123):
|
115
|
+
---
|
116
|
+
Foo.first was nil. Assuming there is no data in the associated table, but please verify.
|
117
|
+
Bar's belongs_to :waitresses may need to be singularized to waitress?
|
118
|
+
...
|
119
|
+
|
120
|
+
Failed (85):
|
121
|
+
---
|
122
|
+
Bar
|
123
|
+
Foobar
|
124
|
+
MyModel
|
125
|
+
|
126
|
+
|
127
|
+
Specify --output-file to provide an pathname of an errors file.
|
94
128
|
|
95
129
|
### API
|
96
130
|
|
data/lib/modelist/tester.rb
CHANGED
@@ -164,6 +164,11 @@ module Modelist
|
|
164
164
|
elsif (value.is_a?(Array) && value.size == 0)
|
165
165
|
#results[:warnings] << "(ignore) #{model_class_name}.#{association_name} was empty"
|
166
166
|
end
|
167
|
+
if [:belongs_to, :has_one].include?(reflection.macro) && association_name.to_sym != association_name.to_s.singularize.to_sym && !association_name.to_s.end_with?('ess') && !association_name.to_s.end_with?('us')
|
168
|
+
results[:warnings] << "#{model_class.name}'s #{reflection.macro} #{association_name.to_sym.inspect} may need to be singularized to #{association_name.to_s.singularize}?"
|
169
|
+
elsif [:has_many, :has_and_belongs_to_many].include?(reflection.macro) && association_name.to_sym != association_name.to_s.pluralize.to_sym
|
170
|
+
results[:warnings] << "#{model_class.name}'s #{reflection.macro} #{association_name.to_sym.inspect} may need to be pluralized to #{association_name.to_s.pluralize}?"
|
171
|
+
end
|
167
172
|
rescue Exception => e
|
168
173
|
method_name_to_exception["#{model_class.name}.last.#{association_name}"] = e
|
169
174
|
end
|
data/lib/modelist/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: modelist
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-11-
|
12
|
+
date: 2012-11-21 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: thor
|