| 1 | # frozen_string_literal: true |
| 2 | |
| 3 | # Public changelog: an index of releases at /changelog and one page per release |
| 4 | # at /changelog/v1.0.0. Entries come from `Changelog` (Markdown files under |
| 5 | # config/changelog). No auth — the changelog is marketing/reference content. |
| 6 | class ChangelogController < ApplicationController |
| 7 | def index |
| 8 | @entries = Changelog.all |
| 9 | expires_in 1.hour, public: true |
| 10 | end |
| 11 | |
| 12 | def show |
| 13 | @entry = Changelog.find(params[:version]) |
| 14 | return render_not_found if @entry.nil? |
| 15 | |
| 16 | @entries = Changelog.all |
| 17 | expires_in 1.hour, public: true |
| 18 | end |
| 19 | |
| 20 | private |
| 21 | |
| 22 | def render_not_found |
| 23 | render file: Rails.public_path.join("404.html"), status: :not_found, layout: false |
| 24 | end |
| 25 | end |