blob: 9a7f6d53f472f37786465dcd6c87068c8862c023 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
# frozen_string_literal: true
class Posts::ScratchpadsController < ApplicationController
before_action :load_post
before_action :check_auth
def edit
@title = "Editing Scratchpad: Post ##{@post.id}"
end
def update
@post.update(scratchpad: params[:scratchpad])
redirect_to post_path(@post)
end
private
def load_post
@post = Post.find(params[:post_id])
end
def check_auth
authorize! :edit_scratchpad, @post
end
end
|