Adapt seeds file to use ActsAsTenant
This commit is contained in:
parent
8bff98b165
commit
5b3c1fdfac
113
db/seeds.rb
113
db/seeds.rb
@ -9,70 +9,69 @@ Group.delete_all
|
||||
|
||||
Wedding.delete_all
|
||||
|
||||
Wedding.create!(slug: :default, date: 1.year.from_now)
|
||||
ActsAsTenant.with_tenant(Wedding.create!(slug: :default, date: 1.year.from_now)) do
|
||||
Expense.create!(name: 'Photographer', amount: 3000, pricing_type: 'fixed')
|
||||
Expense.create!(name: 'Country house', amount: 6000, pricing_type: 'fixed')
|
||||
Expense.create!(name: 'Catering', amount: 200, pricing_type: 'per_person')
|
||||
Expense.create!(name: 'Flowers', amount: 500, pricing_type: 'fixed')
|
||||
Expense.create!(name: 'Band', amount: 1000, pricing_type: 'fixed')
|
||||
Expense.create!(name: 'Wedding planner', amount: 2000, pricing_type: 'fixed')
|
||||
Expense.create!(name: 'Dress', amount: 1000, pricing_type: 'fixed')
|
||||
Expense.create!(name: 'Suit', amount: 500, pricing_type: 'fixed')
|
||||
Expense.create!(name: 'Rings', amount: 1000, pricing_type: 'fixed')
|
||||
Expense.create!(name: 'Makeup', amount: 200, pricing_type: 'fixed')
|
||||
Expense.create!(name: 'Hair', amount: 200, pricing_type: 'fixed')
|
||||
Expense.create!(name: 'Transportation', amount: 3000, pricing_type: 'fixed')
|
||||
Expense.create!(name: 'Invitations', amount: 200, pricing_type: 'fixed')
|
||||
Expense.create!(name: 'Cake', amount: 500, pricing_type: 'fixed')
|
||||
|
||||
Expense.create!(name: 'Photographer', amount: 3000, pricing_type: 'fixed')
|
||||
Expense.create!(name: 'Country house', amount: 6000, pricing_type: 'fixed')
|
||||
Expense.create!(name: 'Catering', amount: 200, pricing_type: 'per_person')
|
||||
Expense.create!(name: 'Flowers', amount: 500, pricing_type: 'fixed')
|
||||
Expense.create!(name: 'Band', amount: 1000, pricing_type: 'fixed')
|
||||
Expense.create!(name: 'Wedding planner', amount: 2000, pricing_type: 'fixed')
|
||||
Expense.create!(name: 'Dress', amount: 1000, pricing_type: 'fixed')
|
||||
Expense.create!(name: 'Suit', amount: 500, pricing_type: 'fixed')
|
||||
Expense.create!(name: 'Rings', amount: 1000, pricing_type: 'fixed')
|
||||
Expense.create!(name: 'Makeup', amount: 200, pricing_type: 'fixed')
|
||||
Expense.create!(name: 'Hair', amount: 200, pricing_type: 'fixed')
|
||||
Expense.create!(name: 'Transportation', amount: 3000, pricing_type: 'fixed')
|
||||
Expense.create!(name: 'Invitations', amount: 200, pricing_type: 'fixed')
|
||||
Expense.create!(name: 'Cake', amount: 500, pricing_type: 'fixed')
|
||||
|
||||
Group.create!(name: "Jim's guests", icon: 'pi pi-heart').tap do |parent|
|
||||
parent.children.create!(name: "Jim's family", icon: 'pi pi-users').tap do |family|
|
||||
family.children.create!(name: "Jim's close family", icon: 'pi pi-home')
|
||||
family.children.create!(name: "Jim's cousins", icon: 'pi pi-home')
|
||||
family.children.create!(name: "Jim's relatives", icon: 'pi pi-home')
|
||||
Group.create!(name: "Jim's guests", icon: 'pi pi-heart').tap do |parent|
|
||||
parent.children.create!(name: "Jim's family", icon: 'pi pi-users').tap do |family|
|
||||
family.children.create!(name: "Jim's close family", icon: 'pi pi-home')
|
||||
family.children.create!(name: "Jim's cousins", icon: 'pi pi-home')
|
||||
family.children.create!(name: "Jim's relatives", icon: 'pi pi-home')
|
||||
end
|
||||
parent.children.create!(name: "Jim's friends", icon: 'pi pi-bullseye')
|
||||
parent.children.create!(name: "Jim's work", icon: 'pi pi-desktop').tap do |work|
|
||||
work.children.create!(name: "Jim's besties at work", icon: 'pi pi-briefcase')
|
||||
end
|
||||
end
|
||||
parent.children.create!(name: "Jim's friends", icon: 'pi pi-bullseye')
|
||||
parent.children.create!(name: "Jim's work", icon: 'pi pi-desktop').tap do |work|
|
||||
work.children.create!(name: "Jim's besties at work", icon: 'pi pi-briefcase')
|
||||
|
||||
Group.create!(name: "Pam's guests", icon: 'pi pi-heart-fill').tap do |parent|
|
||||
parent.children.create!(name: "Pam's family", icon: 'pi pi-users').tap do |family|
|
||||
family.children.create!(name: "Pam's close family", icon: 'pi pi-home')
|
||||
family.children.create!(name: "Pam's cousins", icon: 'pi pi-home')
|
||||
family.children.create!(name: "Pam's relatives", icon: 'pi pi-home')
|
||||
end
|
||||
parent.children.create!(name: "Pam's friends", icon: 'pi pi-bullseye')
|
||||
parent.children.create!(name: "Pam's work", icon: 'pi pi-desktop').tap do |work|
|
||||
work.children.create!(name: "Pam's besties at work", icon: 'pi pi-briefcase')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Group.create!(name: "Pam's guests", icon: 'pi pi-heart-fill').tap do |parent|
|
||||
parent.children.create!(name: "Pam's family", icon: 'pi pi-users').tap do |family|
|
||||
family.children.create!(name: "Pam's close family", icon: 'pi pi-home')
|
||||
family.children.create!(name: "Pam's cousins", icon: 'pi pi-home')
|
||||
family.children.create!(name: "Pam's relatives", icon: 'pi pi-home')
|
||||
Group.create!(name: 'Common guests', icon: 'pi pi-users').tap do |parent|
|
||||
parent.children.create!(name: 'College friends', icon: 'pi pi-calculator')
|
||||
parent.children.create!(name: 'High school friends', icon: 'pi pi-crown')
|
||||
parent.children.create!(name: 'Childhood friends', icon: 'pi pi-envelope')
|
||||
end
|
||||
parent.children.create!(name: "Pam's friends", icon: 'pi pi-bullseye')
|
||||
parent.children.create!(name: "Pam's work", icon: 'pi pi-desktop').tap do |work|
|
||||
work.children.create!(name: "Pam's besties at work", icon: 'pi pi-briefcase')
|
||||
|
||||
groups = Group.all
|
||||
|
||||
NUMBER_OF_GUESTS.times do
|
||||
Guest.create!(
|
||||
name: Faker::Name.name,
|
||||
phone: Faker::PhoneNumber.cell_phone,
|
||||
group: groups.sample,
|
||||
status: Guest.statuses.keys.sample
|
||||
)
|
||||
end
|
||||
|
||||
ActiveJob.perform_all_later(3.times.map { TableSimulatorJob.new })
|
||||
|
||||
'red'.paint.palette.triad(as: :hex).zip(Group.roots).each { |(color, group)| group.update!(color: color.paint.desaturate(40)) }
|
||||
|
||||
Group.roots.each(&:colorize_children)
|
||||
end
|
||||
|
||||
Group.create!(name: 'Common guests', icon: 'pi pi-users').tap do |parent|
|
||||
parent.children.create!(name: 'College friends', icon: 'pi pi-calculator')
|
||||
parent.children.create!(name: 'High school friends', icon: 'pi pi-crown')
|
||||
parent.children.create!(name: 'Childhood friends', icon: 'pi pi-envelope')
|
||||
end
|
||||
|
||||
groups = Group.all
|
||||
|
||||
NUMBER_OF_GUESTS.times do
|
||||
Guest.create!(
|
||||
name: Faker::Name.name,
|
||||
phone: Faker::PhoneNumber.cell_phone,
|
||||
group: groups.sample,
|
||||
status: Guest.statuses.keys.sample
|
||||
)
|
||||
end
|
||||
|
||||
ActiveJob.perform_all_later(3.times.map { TableSimulatorJob.new })
|
||||
|
||||
'red'.paint.palette.triad(as: :hex).zip(Group.roots).each { |(color, group)| group.update!(color: color.paint.desaturate(40)) }
|
||||
|
||||
Group.roots.each(&:colorize_children)
|
||||
|
||||
User.create!(
|
||||
email: 'development@example.com',
|
||||
confirmed_at: Time.zone.now,
|
||||
|
Loading…
x
Reference in New Issue
Block a user