planter 0.0.13 → 0.0.14
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/planter/seeder.rb +4 -4
- data/lib/planter/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 65eb2897cfca2aa456d13a8044d6a86ed9b898aced01a3718e4d11f5dc718da1
|
4
|
+
data.tar.gz: 2dec806f05018f1bdf1e81282047dba3f049274cf6397aeaa8db55ff7bf8856c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 752f29be613b3ce52fad80262ec500db79176329ac802c44f582375be3304c2435653fea1698ac1475f7da938250833f6807fa4b98f558806594db331024dc21
|
7
|
+
data.tar.gz: 46c6632d2faed5ab3ee96a4084de5043dd4312048cd1299dbb45910b537e0f5376b087f80e0e97f5ebc041334876cf47f048bbc8df97e6b052489e5c4bccd8d4
|
data/lib/planter/seeder.rb
CHANGED
@@ -154,7 +154,7 @@ module Planter
|
|
154
154
|
# The seeding method specified.
|
155
155
|
#
|
156
156
|
# @return [Symbol]
|
157
|
-
class_attribute :
|
157
|
+
class_attribute :seed_method
|
158
158
|
|
159
159
|
##
|
160
160
|
# Access the metaclass so we can define public and private class methods.
|
@@ -208,12 +208,12 @@ module Planter
|
|
208
208
|
raise ArgumentError, "Must specify :parent_model with :association"
|
209
209
|
end
|
210
210
|
|
211
|
-
self.
|
211
|
+
self.seed_method = method
|
212
212
|
self.number_of_records = number_of_records
|
213
213
|
self.model = model || to_s.delete_suffix('Seeder').singularize
|
214
214
|
self.parent_model = parent_model
|
215
215
|
self.association = parent_model && (association || determine_association)
|
216
|
-
self.csv_file = determine_csv_filename(csv_name) if
|
216
|
+
self.csv_file = determine_csv_filename(csv_name) if self.seed_method == :csv
|
217
217
|
self.erb_trim_mode = erb_trim_mode || Planter.config.erb_trim_mode
|
218
218
|
self.unique_columns =
|
219
219
|
case unique_columns
|
@@ -305,7 +305,7 @@ module Planter
|
|
305
305
|
end
|
306
306
|
|
307
307
|
def validate_attributes # :nodoc:
|
308
|
-
case
|
308
|
+
case seed_method.intern
|
309
309
|
when :csv
|
310
310
|
contents = ::File.read(csv_file)
|
311
311
|
if csv_file.end_with?('.erb')
|
data/lib/planter/version.rb
CHANGED