Download app/controllers/categories_controller.rb from denise-oneill-inbox-ru/Rails-8-API-Image-Processing: direct link, hf CLI and curl.
- Browser
- Download file 516 Bytes
-
https://huggingface.co/spaces/denise-oneill-inbox-ru/Rails-8-API-Image-Processing/resolve/main/app/controllers/categories_controller.rb
- Command line
-
hf download hf://spaces/denise-oneill-inbox-ru/Rails-8-API-Image-Processing/app/controllers/categories_controller.rb
-
curl -L -o categories_controller.rb https://huggingface.co/spaces/denise-oneill-inbox-ru/Rails-8-API-Image-Processing/resolve/main/app/controllers/categories_controller.rb
516 Bytes
| class CategoriesController < ApplicationController | |
| before_action :authenticate_user!, only: [] | |
| def index | |
| @pagy, @categories = pagy(Category.all) | |
| end | |
| def show | |
| @category = Category.friendly.find(params[:slug]) | |
| authorize @category | |
| posts = policy_scope(@category.posts).publicly_visible | |
| .includes(:category, :tags, :user, :post_translations) | |
| .order(published_at: :desc) | |
| @pagy, @posts = pagy(posts) | |
| end | |
| end | |