about summary refs log tree commit diff stats
path: root/app/controllers/entries_controller.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/controllers/entries_controller.rb')
-rw-r--r--app/controllers/entries_controller.rb21
1 files changed, 1 insertions, 20 deletions
diff --git a/app/controllers/entries_controller.rb b/app/controllers/entries_controller.rb index 366de53..14d779a 100644 --- a/app/controllers/entries_controller.rb +++ b/app/controllers/entries_controller.rb
@@ -1,26 +1,7 @@
1class EntriesController < ApplicationController 1class EntriesController < ApplicationController
2 before_action :authenticate_user!, only: [:edit, :update]
3 2
4 def show 3 def show
5 @entry = Entry.where(slug: params[:slug]).first 4 @entry = Entry.find_by_slug(params[:slug])
6 end 5 end
7 6
8 def edit
9 @entry = Entry.where(slug: params[:slug]).first
10 end
11
12 def update
13 @entry = Entry.where(slug: params[:slug]).first
14
15 if @entry.update_attributes(entry_params)
16 flash.notice = ""
17 end
18 end
19
20 private
21
22 def entry_params
23 params.require(:blog).permit(:title, :body, :slug)
24 end
25
26end 7end