Skip to content

Commit 151d111

Browse files
author
rroblak
committed
Merge pull request rroblak#68 from ktaragorn/patch-1
Update documentation - exclude option's default and dumping relations
2 parents c567a59 + 1e0da75 commit 151d111

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

README.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,15 @@ Exclude `name` and `age` from the dump:
8888

8989
Options are specified as a Hash for the second argument.
9090

91+
In the console, any relation of ActiveRecord rows can be dumped (not individual objects though)
92+
93+
irb(main):001:0> puts SeedDump.dump(User.where(is_admin: false)
94+
User.create!([
95+
{password: "123456", username: "test_1", is_admin: false},
96+
{password: "234567", username: "test_2", is_admin: false}
97+
])
98+
99+
91100
Options
92101
-------
93102

@@ -97,7 +106,7 @@ Options are common to both the Rake task and the console, except where noted.
97106

98107
`batch_size`: Controls the number of records that are written to file at a given time. Default: 1000. If you're running out of memory when dumping, try decreasing this. If things are dumping too slow, trying increasing this.
99108

100-
`exclude`: Attributes to be excluded from the dump. By default `id`, `created_at`, and `updated_at` are excluded. Pass a comma-separated list to the Rake task (i.e. `name,age`) and an array on the console (i.e. `[:name, :age]`).
109+
`exclude`: Attributes to be excluded from the dump.Pass a comma-separated list to the Rake task (i.e. `name,age`) and an array on the console (i.e. `[:name, :age]`). Default: `[:id, :created_at, :updated_at]` (this default can be overridden by just setting this option)
101110

102111
`file`: Write to the specified output file. The Rake task default is `db/seeds.rb`. The console returns the dump as a string by default.
103112

0 commit comments

Comments
 (0)