Sha256: da4a11ec73556f3baa4ed6de93b79f1370ef6713b4faa99793d1fcb164fe2d63

Contents?: true

Size: 1.5 KB

Versions: 1

Compression:

Stored size: 1.5 KB

Contents

# Database initial data
ModelDiscovery::Engine.load_seed

#Underworld::Workflows::Discovery.build_table_list
Underworld::Discovery::Permissions.create_all_permissions

case Underworld::ORM.current
when 'active_record'
  admin_group = Underworld::Group.create(name: 'Admin', role: 'admin')
  guest_group = Underworld::Group.create(name: 'Guest', role: 'guest')

  admin_group.permissions = Underworld::Permission.all

  admin = Underworld::User.create(email: 'admin@example.com',
                              password: 'changeme',
                              password_confirmation: 'changeme')
  admin.groups << admin_group


  user = Underworld::User.create(email: 'user@example.com',
                             password: '123123123',
                             password_confirmation: '123123123')

when 'mongoid'
  admin_group = Underworld::Group.create(name: 'Admin', role: 'admin')
  Underworld::Permission.each do |perm|
    admin_group.permissions << perm
  end
  admin_group.save!

  guest_group = Underworld::Group.create(name: 'Guest', role: 'guest')

  admin = Underworld::User.new(email: 'admin@example.com',
                           password: 'changeme',
                           password_confirmation: 'changeme')


  admin.groups << admin_group

  user = Underworld::User.new(email: 'user@example.com',
                          password: '123123123',
                          password_confirmation: '123123123')

  guest_group = Underworld::Group.new(name: 'Guest', role: 'guest')

end

admin.save
user.save

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
underworld-1.0.0 db/seeds.rb