# 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