summaryrefslogtreecommitdiff
path: root/app/controllers/posts/source_changes_controller.rb
blob: 26b50e1a3af9e64a3658ee6e89e78d9d493c06fa (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
26
# frozen_string_literal: true

class Posts::SourceChangesController < ApplicationController
  before_action :load_post
  before_action :load_source_changes

  skip_authorization_check

  respond_to :html, :json

  def index
    @title = "Source Changes: ##{@post.id}"
    respond_with @source_changes
  end

  private

  def load_post
    @post = Post.find(params[:post_id])
  end

  def load_source_changes
    @source_changes = SourceChange.where(post: @post).includes(:post)
    @source_changes = @source_changes.page(params[:page]).per(20)
  end
end