Skip to content

Controllers

  • Trek::BaseController — the base for all admin controllers: authentication, authorization, localization, the admin layout and Trek's form builder.
  • Trek::ResourceController — extends BaseController with the full CRUD (index, show, new, create, edit, update, destroy), wired to ActionPolicy (authorized_scope, authorize!) and ordering. Scaffolded controllers inherit from it and only need to declare their model:
ruby
module Admin
  class BooksController < Trek::ResourceController
    private

    def model
      Book
    end
  end
end
  • Panel controllers (Trek::Panels::*) — support endpoints used by the admin UI: image uploads (Uppy), link insertion and content editor prompts.

Mixins

  • include Trek::Pagination — paginates the index with Kaminari
  • include Trek::Search — filters the index by params[:search] when the model is Searchable

Released under the MIT License.