seed_dump 0.3.1 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.rdoc +4 -0
- data/VERSION +1 -1
- data/lib/seed_dump/perform.rb +3 -2
- data/seed_dump.gemspec +1 -1
- metadata +1 -1
data/CHANGELOG.rdoc
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.3.
|
1
|
+
0.3.2
|
data/lib/seed_dump/perform.rb
CHANGED
@@ -15,7 +15,7 @@ module SeedDump
|
|
15
15
|
@opts['no-data'] = !env['NO_DATA'].nil?
|
16
16
|
@opts['models'] = env['MODELS'] || (env['MODEL'] ? env['MODEL'] : "")
|
17
17
|
@opts['file'] = env['FILE'] || "#{Rails.root}/db/seeds.rb"
|
18
|
-
@opts['append'] = (!env['APPEND'].nil? && File.exists?(opts['file']) )
|
18
|
+
@opts['append'] = (!env['APPEND'].nil? && File.exists?(@opts['file']) )
|
19
19
|
@ar_options = env['LIMIT'].to_i > 0 ? { :limit => env['LIMIT'].to_i } : {}
|
20
20
|
@indent = " " * (env['INDENT'].nil? ? 2 : env['INDENT'].to_i)
|
21
21
|
@opts['models'] = @opts['models'].split(',').collect {|x| x.underscore.singularize.camelize.constantize }
|
@@ -41,8 +41,9 @@ module SeedDump
|
|
41
41
|
@id_set_string = ''
|
42
42
|
create_hash = ""
|
43
43
|
rows = []
|
44
|
+
arr = []
|
44
45
|
arr = model.find(:all, @ar_options) unless @opts['no-data']
|
45
|
-
arr = arr.empty? ? [model.new] : arr
|
46
|
+
arr = arr.empty? ? [model.new] : arr
|
46
47
|
arr.each_with_index { |r,i|
|
47
48
|
attr_s = [];
|
48
49
|
r.attributes.each { |k,v| dumpAttribute(attr_s,r,k,v) }
|
data/seed_dump.gemspec
CHANGED