about summary refs log tree commit diff stats
path: root/app/controllers/admin/blogs_controller.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/controllers/admin/blogs_controller.rb')
-rw-r--r--app/controllers/admin/blogs_controller.rb8
1 files changed, 6 insertions, 2 deletions
diff --git a/app/controllers/admin/blogs_controller.rb b/app/controllers/admin/blogs_controller.rb index fa46ab8..9706df3 100644 --- a/app/controllers/admin/blogs_controller.rb +++ b/app/controllers/admin/blogs_controller.rb
@@ -2,7 +2,11 @@ class Admin::BlogsController < Admin::AdminController
2 before_action :set_section 2 before_action :set_section
3 3
4 def index 4 def index
5 @blogs = Blog.order(created_at: :desc) 5 @blogs = Blog.where(published: true).order(published_at: :desc)
6 end
7
8 def drafts
9 @blogs = Blog.where(published: false).order(updated_at: :desc)
6 end 10 end
7 11
8 def new 12 def new
@@ -42,7 +46,7 @@ class Admin::BlogsController < Admin::AdminController
42 private 46 private
43 47
44 def blog_params 48 def blog_params
45 params.require(:blog).permit(:title, :body, :slug, records_attributes: [:description, :_destroy]) 49 params.require(:blog).permit(:title, :body, :slug, :published, records_attributes: [:description, :_destroy])
46 end 50 end
47 51
48 def set_section 52 def set_section