yaddl 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/yaddl.rb +8 -3
- data/lib/yaddl/version.rb +1 -1
- metadata +1 -1
data/lib/yaddl.rb
CHANGED
@@ -161,8 +161,13 @@ class Generator
|
|
161
161
|
|
162
162
|
attrs = {}
|
163
163
|
model['attributes'].each do |k,v|
|
164
|
-
|
165
|
-
|
164
|
+
if v['type'] == "references"
|
165
|
+
attrs[k+"_id"] ||= {}
|
166
|
+
attrs[k+"_id"]['type'] ="integer"
|
167
|
+
else
|
168
|
+
attrs[k] ||= {}
|
169
|
+
attrs[k]['type'] = v['type'].sub(/yaml|hash|object|cache/i, "text")
|
170
|
+
end
|
166
171
|
end
|
167
172
|
model['belongs_to'].each do |k,v|
|
168
173
|
attrs[k+"_id"] ||= {}
|
@@ -198,7 +203,7 @@ class Generator
|
|
198
203
|
if changes.count > 0
|
199
204
|
index = ""
|
200
205
|
while Dir.glob("#{Rails.root}/db/migrate/*_#{summary}#{v2}#{name.pluralize}#{index}".underscore.downcase+".rb").count > 0
|
201
|
-
index = 1 if index
|
206
|
+
index = 1 if index == ""
|
202
207
|
index += 1
|
203
208
|
end
|
204
209
|
|
data/lib/yaddl/version.rb
CHANGED