Sha256: dc84ea3b4c8c4079d9e3b12449b1e8a3d7495b09324b61b88fffd37a5dab3100

Contents?: true

Size: 1.18 KB

Versions: 8

Compression:

Stored size: 1.18 KB

Contents

# rubocop:disable Rails/Output
module Seeder
  module_function

<% if config[:using_devise] -%>
  def admin_user
    puts '-----> Creating Admin User'

    # Remove all admins
    User.admins.destroy_all

    create(:user, :admin)
  end

  def all_users
    puts '-----> Resetting to a clean user list with all Users'

    # Remove all users
    User.destroy_all

    create(:user)

    # list user traits from factory_girl here
    %w(admin).each do |name|
      create(:user, name.to_sym)
    end
  end
<% else -%>
  # Change 'resource' to something real
  def seed_resource
    puts '-----> Creating Resource'

    # Remove all resources
    Resource.destroy_all

    create(:resource)
  end
<% end -%>
end

# rubocop:disable Metrics/LineLength
if Rails.env == 'production'
  unless ENV['FORCE_SEED']
    puts
    puts '================================================================================='
    puts 'WARNING: You are trying to run db:seed on production. This is a DESTRUCTIVE task.'
    puts 'If you know what you are doing, you can override by setting environment variable '
    puts 'FORCE_SEED=1'
    abort('Exiting now...')
  end
end
# rubocop:enable Rails/Output, Metrics/LineLength

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
voyage-1.44.0.14 lib/voyage/templates/seeder.rb.erb
voyage-1.44.0.13 lib/voyage/templates/seeder.rb.erb
voyage-1.44.0.11 lib/voyage/templates/seeder.rb.erb
voyage-1.44.0.12 lib/voyage/templates/seeder.rb.erb
voyage-1.44.0.10 lib/voyage/templates/seeder.rb.erb
voyage-1.44.0.9 lib/voyage/templates/seeder.rb.erb
voyage-1.44.0.8 lib/voyage/templates/seeder.rb.erb
voyage-1.44.0.7 lib/voyage/templates/seeder.rb.erb