class

ActionController::Base

Inherits CRails::Routes::UrlHelpers < ActionController::ConditionalGet < ActionView::Helpers < ActionView::Helpers::RecordIdentifier < ActionView::Helpers::ViteHelper < ActionView::Helpers::CsrfHelper < ActionView::Helpers::CacheHelper < ActionView::Helpers::FormHelper < ActionView::Helpers::FormTagHelper < ActionView::Helpers::FormOptionsHelper < ActionView::Helpers::TagHelper < ActionView::Helpers::TagHelper < ActionView::Helpers::TagHelper < ActionView::Helpers::FormOptionsHelper < ActionView::Helpers::TagHelper < ActionView::Helpers::FormTagHelper < ActionView::Helpers::FormOptionsHelper < ActionView::Helpers::TagHelper < ActionView::Helpers::TagHelper < ActionView::Helpers::EmbedFileHelper < ActionView::Helpers::TagHelper < ActionView::Helpers::AssetTagHelper < ActionView::Helpers::TagHelper < ActionView::Helpers::UrlHelper < ActionView::Helpers::TagHelper < ActionView::Helpers::NumberHelper < ActiveSupport::NumberHelper < ActionView::Helpers::TextHelper < ActionView::Helpers::TagHelper < ERB::Rendering < ActionController::DataStreaming < ActionController::RequestForgeryProtection < ActionController::RateLimiting < Reference < Object

Constructors

Instance methods

__default_render(action : String) : Nil
Source
__jb_render_template(path : String) : String

Overwritten by codegen in concrete controllers: .json.jbuilder-шаблоны этого контроллера для render(template:) — полный путь ("posts/show.json.jbuilder" / "posts/show") или имя экшена ("show").

Source
__jb_template?(action : String) : Bool

Overwritten by codegen in concrete controllers: true для экшенов, у которых есть #{action}.json.jbuilder (implicit render по format=json).

Source
__layout?
Source
__live_dispatch

ActionController::Live hook (Iteration 9): перекрывается методом __live_dispatch модуля Live — экшен уходит в отдельный fiber, ответ стримится с backpressure. Без include — прямой вызов.

Source
__render_view(action : String) : String

Overwritten by codegen in concrete controllers.

Source
__render_view_json(action : String) : String

Overwritten by codegen in concrete controllers.

Source
__run_action(action : String) : Nil

Overwritten by codegen in concrete controllers.

Source
__set_params(route_params : Hash(String, String), controller_name : String | Nil = nil, action_name : String | Nil = nil) : Nil

Rails parity: route params merge with the query/body, and the dispatched controller/action names land in params too (CanCanCan's controller resource reads params["action"]/params["controller"]).

Source
__verify_same_origin_request

Overridden by RequestForgeryProtection (protect_from_forgery): non-XHR JavaScript responses to GET after a marked request raise InvalidCrossOriginRequest. Runs right before the body is committed, where a raise can still map to 422.

Source
context
cookies
Source
flash
Source
head(status) : Nil
Source
params
redirect_back(fallback_location : String, status = 302) : Nil
Source
redirect_to(location : String, status = 302, notice : String | Nil = nil, alert : String | Nil = nil) : Nil
Source
render(json : String, status = nil) : Nil
Source
render(plain : String | Nil = nil, html : String | Nil = nil, status = nil, content_type : String | Nil = nil) : Nil

Rails parity: render не сбрасывает уже назначенный response.status — статус ставится только явным :status (паттерн «response.status = X; render(plain:)» в контроллерах должен отдавать X, а не 200).

Source
render(*, template : String, status = nil) : Nil

render(template:) — .json.jbuilder-шаблон, скомпилированный на этапе сборки через JbuilderHandler (шард jbuilder.cr; приложение с .json.jbuilder-вьюхами обязано require "jbuilder_cr" — без шарда хендлер не разрешится, как в Rails без гема хендлер не зарегистриро- ван). Путь — полный относительно корня вьюх с расширением или без ("posts/show.json.jbuilder" / "posts/show") либо имя экшена ("show"). Только именованный аргумент: перегрузка с позиционной строкой (Rails render "posts/show", formats: :json) конфликтует с render(json : String) — позиционная строка занята телом JSON-ответа (документированное отклонение).

Source
request
Source
respond_to
Source
response
Source
session
Source

Macros

__callback_condition(only = nil, except = nil, cond_if = nil, cond_unless = nil)

Shared only/except/if/unless condition for filter callbacks; expands to a boolean expression over the action method argument. Args arrive pre-extracted (nil when absent) so empty opts never round-trip through generated code.

Source
around_action(*names, **opts, &block)

around_action :set_time_zone / around_action only: [:show] do ... end The filter method (or block) receives the action continuation via yield and MUST call it.

Source
before_action(*names, **opts)

before_action :authenticate, only: [:index] / except: / if: / unless: Unknown keys are a compile error (see protect_from_forgery): a silently ignored option masks a filter that never runs as intended.

Source
rescue_from(exception, **opts)
Source
skip_before_action(*names, **opts)
Source
typed_params(*actions, &block)

Declare the typed params schema for one or more actions:

typed_params(:create, :update) do
  required :title, String, min_size: 3
  optional :admin, Bool?
  required :author do
    required :name, String
  end
end

Generates a <Action>Params result class with typed getters and an <action>_params controller helper (raises TypedParams::Invalid → 422). Schemas are registered for the OpenAPI builder.

Source

Nested types