From d48adb741c5c30ba3f2d3c039a7e342b43add352 Mon Sep 17 00:00:00 2001 From: Kelly Rauchenberger Date: Wed, 4 Jul 2018 10:42:21 -0400 Subject: Added blog drafts An unpublished post is not viewable unless you are logged in. The "Create record" field is disabled for unpublished posts, though this is only in JavaScript and the backend will not disallow creating records for unpublished posts if forced to. Unpublishing a post does not destroy records for that post. This only applies to blog posts, currently; streams and stream updates cannot be drafted. Unpublished posts still require titles and slugs. There is no autosaving functionality yet. refs #1 --- db/migrate/20180704125527_add_blog_drafts.rb | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 db/migrate/20180704125527_add_blog_drafts.rb (limited to 'db/migrate') diff --git a/db/migrate/20180704125527_add_blog_drafts.rb b/db/migrate/20180704125527_add_blog_drafts.rb new file mode 100644 index 0000000..07c5078 --- /dev/null +++ b/db/migrate/20180704125527_add_blog_drafts.rb @@ -0,0 +1,17 @@ +class AddBlogDrafts < ActiveRecord::Migration[5.1] + def change + add_column :blogs, :published, :boolean, null: false, default: false + add_column :blogs, :published_at, :datetime, null: true + + reversible do |dir| + dir.up do + Blog.all.each do |blog| + blog.published = true + blog.published_at = blog.created_at + + blog.save! + end + end + end + end +end -- cgit 1.4.1