From cc551d3c2d6805fffe1d435df54b483ba15fd217 Mon Sep 17 00:00:00 2001 From: enterteg Date: Tue, 19 Apr 2016 22:11:29 +0200 Subject: [PATCH] everything ok --- app/controllers/public_controller.rb | 3 ++- db/seeds.rb | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/app/controllers/public_controller.rb b/app/controllers/public_controller.rb index fbe9fd9..d372936 100644 --- a/app/controllers/public_controller.rb +++ b/app/controllers/public_controller.rb @@ -25,7 +25,8 @@ def life end def about - @post = Post.includes(:photo_files).find(1) + @post = Post.includes(:photo_files).find_by(id: 1) + render :nothing unless @post end def search diff --git a/db/seeds.rb b/db/seeds.rb index 6f2f1ad..cb7e33d 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -6,4 +6,4 @@ # cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }]) # Mayor.create(name: 'Emanuel', city: cities.first) -Category.create([{id: 1, name: 'travels'}, {id:3, name: 'life'},{id: 2, name: 'food'}, {id: 4, name: 'about'}]) \ No newline at end of file +Category.create([{id: 1, name: 'travels'}, {id:3, name: 'life'},{id: 2, name: 'food'}, {id: 4, name: 'about'}])