20 lines
551 B
Ruby
20 lines
551 B
Ruby
# typed: false
|
|
class Domain::Inkbunny::PostsController < ApplicationController
|
|
skip_before_action :authenticate_user!, only: %i[show index]
|
|
|
|
def index
|
|
relation = Domain::Inkbunny::Post.includes(:creator, :files)
|
|
|
|
if params[:user_id].present?
|
|
@user = Domain::Inkbunny::User.find(params[:user_id])
|
|
relation = relation.where(creator: @user)
|
|
end
|
|
|
|
@posts = relation.order(ib_post_id: :desc).page(params[:page]).per(50)
|
|
end
|
|
|
|
def show
|
|
@post = Domain::Inkbunny::Post.find_by!(ib_post_id: params[:ib_post_id])
|
|
end
|
|
end
|