commit ed22141051c6fefe837dc70503c5e1130a3f6a5e
parent e45fc2231d3b186d4ba4e6d17b4a5e1727f33f24
Author: Ryan Jeffrey <ryan@ryanmj.xyz>
Date: Fri, 18 Feb 2022 12:40:39 -0800
Init server
Diffstat:
3 files changed, 13 insertions(+), 10 deletions(-)
diff --git a/config/database.yml b/config/database.yml
@@ -4,6 +4,8 @@
# Ensure the SQLite 3 gem is defined in your Gemfile
# gem "sqlite3"
#
+encoding: utf8
+
default: &default
adapter: sqlite3
pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
diff --git a/db/schema.rb b/db/schema.rb
@@ -14,8 +14,8 @@ ActiveRecord::Schema[7.0].define(version: 2022_02_17_225631) do
create_table "active_storage_attachments", force: :cascade do |t|
t.string "name", null: false
t.string "record_type", null: false
- t.bigint "record_id", null: false
- t.bigint "blob_id", null: false
+ t.integer "record_id", null: false
+ t.integer "blob_id", null: false
t.datetime "created_at", null: false
t.index ["blob_id"], name: "index_active_storage_attachments_on_blob_id"
t.index ["record_type", "record_id", "name", "blob_id"], name: "index_active_storage_attachments_uniqueness", unique: true
@@ -34,7 +34,7 @@ ActiveRecord::Schema[7.0].define(version: 2022_02_17_225631) do
end
create_table "active_storage_variant_records", force: :cascade do |t|
- t.bigint "blob_id", null: false
+ t.integer "blob_id", null: false
t.string "variation_digest", null: false
t.index ["blob_id", "variation_digest"], name: "index_active_storage_variant_records_uniqueness", unique: true
end
diff --git a/db/seeds.rb b/db/seeds.rb
@@ -1,7 +1,8 @@
-# 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 bin/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)
+
+#post.content.attach(io: File.open('/home/ryan/TODO.org'), filename: "TODO.org", content_type: 'text')
+Dir.glob("#{Rails.root}/app/orgs/*.org") do |filename|
+ post = Post.new
+ post.content.attach(io: File.open(filename, "r:UTF-8"), filename: File.basename(filename),
+ content_type: 'text')
+ post.save
+end