Sha256: 8570a1bccc361558621b176694b2cb896775c5853f18d3a8ddd139890f5d7a68

Contents?: true

Size: 1.04 KB

Versions: 1

Compression:

Stored size: 1.04 KB

Contents

# frozen_string_literal: true

require 'csv'

# frozen_string_literal: true
# This file should contain all the record creation needed to seed the database with its default values.
# The data can then be loaded with the rails db:seed command (or created alongside the database with db:setup).
#
# Examples:
#
#   movies = Movie.create([{ name: 'Star Wars' }, { name: 'Lord of the Rings' }])
#   Character.create(name: 'Luke', movie: movies.first)

# Elements
CSV.foreach(File.expand_path('seeds_elements.csv', File.dirname(__FILE__)), headers: true) do |row|
  hash = row.to_hash
  # YES, I'm calling eval - It's hard to seed a serialized field via a CSV file
  hash['html_attributes'] = eval(hash['html_attributes']) if hash['html_attributes'].present?
  Element.create!(hash)
end

# FormElements
CSV.foreach(File.expand_path('seeds_form_elements.csv', File.dirname(__FILE__)), headers: true) do |row|
  FormElement.create!(row.to_hash)
end

# Users
User.create(email: 'admin@geoblacklight.org', password: '123456', password_confirmation: '123456', admin: true)

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
geoblacklight_admin-0.1.0 db/seeds.rb