README.md in data_seeder-1.0.2 vs README.md in data_seeder-1.0.3
- old
+ new
@@ -26,10 +26,14 @@
Add the following to your db/seeds.rb file
DataSeeder.run
+Or if you prefer log messages go to the Rails logger instead of $stdout
+
+ DataSeeder.quiet_run
+
Add seed files to the db/seed directory as necessary. For instance, suppose you have
the following table:
create_table :countries do |t|
t.column :code, 'CHAR(2)', null: false
@@ -85,11 +89,11 @@
You will probably want your test environment seeded also. Adding the following to test/test_helper.rb
will seed your database prior to running tests but will redirect the output to the Rails.logger instead
of stdout.
- DataSeeder.test_run
+ DataSeeder.quiet_run
## Loaders
data_seeder has default loaders for txt, csv, json and yml extensions but you can also create
your own custom loaders.
@@ -144,10 +148,14 @@
Creating 2: We are seriously foobared
Creating 3: We are less seriously foobared
## Configurable values
+#### continue_on_exception (txt,csv)
+
+Continue processing lines if an exception occurs.
+
#### depends
Value or array that this model depends on such that they must be seeded first. Examples:
{
@@ -160,13 +168,13 @@
#### klass
Defines the ActiveRecord Class if it can't be inferred from the seed file.
-#### line
+#### line (txt)
-Proc used for converting a line to attributes (txt files only).
+Proc used for converting a line to attributes.
#### postprocess
Modify the attributes from the seed file before applying them to the model.
@@ -190,10 +198,11 @@
Model method used for displaying updates to a model.
#### use_line_number_as_id
-Use the line number of the seed file as the id
+Use the line number of the seed file as the id. Note that csv does not count the header
+in the line_number count.
## Incompatibilities from 0.0.x version
Custom seeders should now be specified as a Class and not an instance (MySeeder instead of MySeeder.new)