blob: d866040f3f87f1ebc0be1754278dc36959454478 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
require "../../../spec/support/factories/**"
# Add seeds here that are *required* for your app to work.
# For example, you might need at least one admin user or you might need at least
# one category for your blog posts for the app to work.
#
# Use `Db::Seed::SampleData` if your only want to add sample data helpful for
# development.
class Db::Seed::RequiredData < LuckyTask::Task
summary "Add database records required for the app to work"
def call
# Using a Avram::Factory:
#
# Use the defaults, but override just the email
# UserFactory.create &.email("me@example.com")
# Using a SaveOperation:
#
# SaveUser.create!(email: "me@example.com", name: "Jane")
#
# You likely want to be able to run this file more than once. To do that,
# only create the record if it doesn't exist yet:
#
# unless UserQuery.new.email("me@example.com").first?
# SaveUser.create!(email: "me@example.com", name: "Jane")
# end
puts "Done adding required data"
end
end
|