Files
redux-scraper/app/controllers/domain/inkbunny/posts_controller.rb
2025-01-01 03:29:53 +00:00

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