diff options
author | Kelly Rauchenberger <fefferburbia@gmail.com> | 2017-06-29 14:53:15 -0400 |
---|---|---|
committer | Kelly Rauchenberger <fefferburbia@gmail.com> | 2017-06-29 14:53:15 -0400 |
commit | 5ff9457ee3d2f1c636da8d13c47c608543d2e5f7 (patch) | |
tree | 1f573d03fe248a01a420a809a1a3a325c80774f7 /app/controllers | |
parent | 5a82b1a0bdf24cdf0a05a84183106ff106f88626 (diff) | |
download | thoughts-5ff9457ee3d2f1c636da8d13c47c608543d2e5f7.tar.gz thoughts-5ff9457ee3d2f1c636da8d13c47c608543d2e5f7.tar.bz2 thoughts-5ff9457ee3d2f1c636da8d13c47c608543d2e5f7.zip |
Worked on style of blog posts
Diffstat (limited to 'app/controllers')
-rw-r--r-- | app/controllers/entries_controller.rb | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/app/controllers/entries_controller.rb b/app/controllers/entries_controller.rb index 89d06c0..366de53 100644 --- a/app/controllers/entries_controller.rb +++ b/app/controllers/entries_controller.rb | |||
@@ -1,7 +1,26 @@ | |||
1 | class EntriesController < ApplicationController | 1 | class EntriesController < ApplicationController |
2 | before_action :authenticate_user!, only: [:edit, :update] | ||
2 | 3 | ||
3 | def show | 4 | def show |
4 | @entry = Entry.where(directory: params[:directory], slug: params[:slug]).first | 5 | @entry = Entry.where(slug: params[:slug]).first |
5 | end | 6 | end |
6 | 7 | ||
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 | |||
7 | end | 26 | end |