Sha256: 276156d9e982e32c2bf690b87f798ea320591920a840e67520fbf3f25e36ceb0

Contents?: true

Size: 262 Bytes

Versions: 3

Compression:

Stored size: 262 Bytes

Contents

Rails.root.join('data').children.each do |path|
  id, slug = path.basename('.*').to_s.split('-', 2)
  title, rest = path.read.split("\n", 2)

  post = Post.find_or_initialize_by(id: id)
  post.body = rest
  post.slug = slug
  post.title = title
  post.save!
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
parklife-0.4.0 examples/rails/db/seeds.rb
parklife-0.3.0 examples/rails/db/seeds.rb
parklife-0.2.0 examples/rails/db/seeds.rb