repo stringlengths 5 92 | file_url stringlengths 80 287 | file_path stringlengths 5 197 | content stringlengths 0 32.8k | language stringclasses 1
value | license stringclasses 7
values | commit_sha stringlengths 40 40 | retrieved_at stringdate 2026-01-04 15:37:27 2026-01-04 17:58:21 | truncated bool 2
classes |
|---|---|---|---|---|---|---|---|---|
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionpack/lib/action_controller/log_subscriber.rb | actionpack/lib/action_controller/log_subscriber.rb | # frozen_string_literal: true
module ActionController
class LogSubscriber < ActiveSupport::EventReporter::LogSubscriber # :nodoc:
INTERNAL_PARAMS = %w(controller action format _method only_path)
class_attribute :backtrace_cleaner, default: ActiveSupport::BacktraceCleaner.new
self.namespace = "action_co... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionpack/lib/action_controller/structured_event_subscriber.rb | actionpack/lib/action_controller/structured_event_subscriber.rb | # frozen_string_literal: true
module ActionController
class StructuredEventSubscriber < ActiveSupport::StructuredEventSubscriber # :nodoc:
INTERNAL_PARAMS = %w(controller action format _method only_path)
def start_processing(event)
payload = event.payload
params = {}
payload[:params].each_... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionpack/lib/action_controller/railtie.rb | actionpack/lib/action_controller/railtie.rb | # frozen_string_literal: true
# :markup: markdown
require "rails"
require "action_controller"
require "action_dispatch/railtie"
require "abstract_controller/railties/routes_helpers"
require "action_controller/railties/helpers"
require "action_view/railtie"
module ActionController
class Railtie < Rails::Railtie # :... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionpack/lib/action_controller/api.rb | actionpack/lib/action_controller/api.rb | # frozen_string_literal: true
# :markup: markdown
require "action_view"
require "action_controller"
require "action_controller/log_subscriber"
require "action_controller/structured_event_subscriber"
module ActionController
# # Action Controller API
#
# API Controller is a lightweight version of ActionControlle... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionpack/lib/action_controller/base.rb | actionpack/lib/action_controller/base.rb | # frozen_string_literal: true
# :markup: markdown
require "action_view"
require "action_controller/log_subscriber"
require "action_controller/structured_event_subscriber"
require "action_controller/metal/params_wrapper"
module ActionController
# # Action Controller Base
#
# Action Controllers are the core of a... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionpack/lib/action_controller/template_assertions.rb | actionpack/lib/action_controller/template_assertions.rb | # frozen_string_literal: true
# :markup: markdown
module ActionController
module TemplateAssertions # :nodoc:
def assert_template(options = {}, message = nil)
raise NoMethodError,
'assert_template has been extracted to a gem. To continue using it,
add `gem "rails-controller-testing"` to yo... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionpack/lib/action_controller/form_builder.rb | actionpack/lib/action_controller/form_builder.rb | # frozen_string_literal: true
# :markup: markdown
module ActionController
# # Action Controller Form Builder
#
# Override the default form builder for all views rendered by this controller
# and any of its descendants. Accepts a subclass of
# ActionView::Helpers::FormBuilder.
#
# For example, given a fo... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionpack/lib/action_controller/renderer.rb | actionpack/lib/action_controller/renderer.rb | # frozen_string_literal: true
# :markup: markdown
module ActionController
# # Action Controller Renderer
#
# ActionController::Renderer allows you to render arbitrary templates without
# being inside a controller action.
#
# You can get a renderer instance by calling `renderer` on a controller class:
#
... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionpack/lib/action_controller/deprecator.rb | actionpack/lib/action_controller/deprecator.rb | # frozen_string_literal: true
# :markup: markdown
module ActionController
def self.deprecator # :nodoc:
AbstractController.deprecator
end
end
| ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionpack/lib/action_controller/caching.rb | actionpack/lib/action_controller/caching.rb | # frozen_string_literal: true
# :markup: markdown
module ActionController
# # Action Controller Caching
#
# Caching is a cheap way of speeding up slow applications by keeping the result
# of calculations, renderings, and database calls around for subsequent
# requests.
#
# Note: To turn off all caching ... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionpack/lib/action_controller/metal.rb | actionpack/lib/action_controller/metal.rb | # frozen_string_literal: true
# :markup: markdown
require "active_support/core_ext/array/extract_options"
require "action_dispatch/middleware/stack"
module ActionController
# # Action Controller MiddlewareStack
#
# Extend ActionDispatch middleware stack to make it aware of options allowing
# the following sy... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionpack/lib/action_controller/api/api_rendering.rb | actionpack/lib/action_controller/api/api_rendering.rb | # frozen_string_literal: true
# :markup: markdown
module ActionController
module ApiRendering
extend ActiveSupport::Concern
included do
include Rendering
end
def render_to_body(options = {})
_process_options(options)
super
end
end
end
| ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionpack/lib/action_controller/metal/parameter_encoding.rb | actionpack/lib/action_controller/metal/parameter_encoding.rb | # frozen_string_literal: true
# :markup: markdown
module ActionController
# Specify binary encoding for parameters for a given action.
module ParameterEncoding
extend ActiveSupport::Concern
module ClassMethods
def inherited(klass) # :nodoc:
super
klass.setup_param_encode
end
... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionpack/lib/action_controller/metal/content_security_policy.rb | actionpack/lib/action_controller/metal/content_security_policy.rb | # frozen_string_literal: true
# :markup: markdown
module ActionController # :nodoc:
module ContentSecurityPolicy
extend ActiveSupport::Concern
include AbstractController::Helpers
include AbstractController::Callbacks
included do
helper_method :content_security_policy?
helper_method :co... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionpack/lib/action_controller/metal/redirecting.rb | actionpack/lib/action_controller/metal/redirecting.rb | # frozen_string_literal: true
# :markup: markdown
module ActionController
module Redirecting
extend ActiveSupport::Concern
include AbstractController::Logger
include ActionController::UrlFor
class UnsafeRedirectError < StandardError; end
class OpenRedirectError < UnsafeRedirectError
def... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionpack/lib/action_controller/metal/flash.rb | actionpack/lib/action_controller/metal/flash.rb | # frozen_string_literal: true
# :markup: markdown
module ActionController # :nodoc:
module Flash
extend ActiveSupport::Concern
included do
class_attribute :_flash_types, instance_accessor: false, default: []
delegate :flash, to: :request
add_flash_types(:alert, :notice)
end
modu... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionpack/lib/action_controller/metal/cookies.rb | actionpack/lib/action_controller/metal/cookies.rb | # frozen_string_literal: true
# :markup: markdown
module ActionController # :nodoc:
module Cookies
extend ActiveSupport::Concern
included do
helper_method :cookies if defined?(helper_method)
end
private
# The cookies for the current request. See ActionDispatch::Cookies for more
#... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionpack/lib/action_controller/metal/conditional_get.rb | actionpack/lib/action_controller/metal/conditional_get.rb | # frozen_string_literal: true
# :markup: markdown
require "active_support/core_ext/object/try"
require "active_support/core_ext/integer/time"
module ActionController
module ConditionalGet
extend ActiveSupport::Concern
include Head
included do
class_attribute :etaggers, default: []
end
... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionpack/lib/action_controller/metal/exceptions.rb | actionpack/lib/action_controller/metal/exceptions.rb | # frozen_string_literal: true
# :markup: markdown
module ActionController
class ActionControllerError < StandardError # :nodoc:
end
class BadRequest < ActionControllerError # :nodoc:
def initialize(msg = nil)
super(msg)
set_backtrace $!.backtrace if $!
end
end
class RenderError < Actio... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionpack/lib/action_controller/metal/mime_responds.rb | actionpack/lib/action_controller/metal/mime_responds.rb | # frozen_string_literal: true
# :markup: markdown
require "abstract_controller/collector"
module ActionController # :nodoc:
module MimeResponds
# Without web-service support, an action which collects the data for displaying
# a list of people might look something like this:
#
# def index
# ... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionpack/lib/action_controller/metal/renderers.rb | actionpack/lib/action_controller/metal/renderers.rb | # frozen_string_literal: true
# :markup: markdown
module ActionController
# See Renderers.add
def self.add_renderer(key, &block)
Renderers.add(key, &block)
end
# See Renderers.remove
def self.remove_renderer(key)
Renderers.remove(key)
end
# See `Responder#api_behavior`
class MissingRenderer ... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionpack/lib/action_controller/metal/strong_parameters.rb | actionpack/lib/action_controller/metal/strong_parameters.rb | # frozen_string_literal: true
# :markup: markdown
require "active_support/core_ext/hash/indifferent_access"
require "active_support/core_ext/array/wrap"
require "active_support/core_ext/string/filters"
require "active_support/core_ext/object/to_query"
require "active_support/deep_mergeable"
require "action_dispatch/h... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | true |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionpack/lib/action_controller/metal/basic_implicit_render.rb | actionpack/lib/action_controller/metal/basic_implicit_render.rb | # frozen_string_literal: true
# :markup: markdown
module ActionController
module BasicImplicitRender # :nodoc:
def send_action(method, *args)
ret = super
default_render unless performed?
ret
end
def default_render
head :no_content
end
end
end
| ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionpack/lib/action_controller/metal/url_for.rb | actionpack/lib/action_controller/metal/url_for.rb | # frozen_string_literal: true
# :markup: markdown
module ActionController
# # Action Controller UrlFor
#
# Includes `url_for` into the host class. The class has to provide a `RouteSet`
# by implementing the `_routes` method. Otherwise, an exception will be raised.
#
# In addition to AbstractController::Ur... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionpack/lib/action_controller/metal/logging.rb | actionpack/lib/action_controller/metal/logging.rb | # frozen_string_literal: true
# :markup: markdown
module ActionController
module Logging
extend ActiveSupport::Concern
module ClassMethods
# Set a different log level per request.
#
# # Use the debug log level if a particular cookie is set.
# class ApplicationController < Ac... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionpack/lib/action_controller/metal/default_headers.rb | actionpack/lib/action_controller/metal/default_headers.rb | # frozen_string_literal: true
# :markup: markdown
module ActionController
# # Action Controller Default Headers
#
# Allows configuring default headers that will be automatically merged into each
# response.
module DefaultHeaders
extend ActiveSupport::Concern
module ClassMethods
def make_respo... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionpack/lib/action_controller/metal/params_wrapper.rb | actionpack/lib/action_controller/metal/params_wrapper.rb | # frozen_string_literal: true
# :markup: markdown
require "active_support/core_ext/hash/slice"
require "active_support/core_ext/hash/except"
require "active_support/core_ext/module/anonymous"
require "action_dispatch/http/mime_type"
module ActionController
# # Action Controller Params Wrapper
#
# Wraps the par... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionpack/lib/action_controller/metal/etag_with_template_digest.rb | actionpack/lib/action_controller/metal/etag_with_template_digest.rb | # frozen_string_literal: true
# :markup: markdown
module ActionController
# # Action Controller Etag With Template Digest
#
# When our views change, they should bubble up into HTTP cache freshness and
# bust browser caches. So the template digest for the current action is
# automatically included in the ETa... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionpack/lib/action_controller/metal/head.rb | actionpack/lib/action_controller/metal/head.rb | # frozen_string_literal: true
# :markup: markdown
module ActionController
module Head
# Returns a response that has no content (merely headers). The options argument
# is interpreted to be a hash of header names and values. This allows you to
# easily return a response that consists only of significant ... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionpack/lib/action_controller/metal/rendering.rb | actionpack/lib/action_controller/metal/rendering.rb | # frozen_string_literal: true
# :markup: markdown
module ActionController
module Rendering
extend ActiveSupport::Concern
RENDER_FORMATS_IN_PRIORITY = [:body, :plain, :html]
module ClassMethods
# Documentation at ActionController::Renderer#render
delegate :render, to: :renderer
# Ret... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionpack/lib/action_controller/metal/allow_browser.rb | actionpack/lib/action_controller/metal/allow_browser.rb | # frozen_string_literal: true
# :markup: markdown
module ActionController # :nodoc:
module AllowBrowser
extend ActiveSupport::Concern
module ClassMethods
# Specify the browser versions that will be allowed to access all actions (or
# some, as limited by `only:` or `except:`). Only browsers matc... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionpack/lib/action_controller/metal/helpers.rb | actionpack/lib/action_controller/metal/helpers.rb | # frozen_string_literal: true
# :markup: markdown
module ActionController
# # Action Controller Helpers
#
# The Rails framework provides a large number of helpers for working with
# assets, dates, forms, numbers and model objects, to name a few. These helpers
# are available to all templates by default.
#... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionpack/lib/action_controller/metal/data_streaming.rb | actionpack/lib/action_controller/metal/data_streaming.rb | # frozen_string_literal: true
# :markup: markdown
require "action_controller/metal/exceptions"
require "action_dispatch/http/content_disposition"
module ActionController # :nodoc:
# # Action Controller Data Streaming
#
# Methods for sending arbitrary data and for streaming files to the browser,
# instead of ... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionpack/lib/action_controller/metal/etag_with_flash.rb | actionpack/lib/action_controller/metal/etag_with_flash.rb | # frozen_string_literal: true
# :markup: markdown
module ActionController
# # Action Controller Etag With Flash
#
# When you're using the flash, it's generally used as a conditional on the view.
# This means the content of the view depends on the flash. Which in turn means
# that the ETag for a response sho... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionpack/lib/action_controller/metal/live.rb | actionpack/lib/action_controller/metal/live.rb | # frozen_string_literal: true
# :markup: markdown
require "action_dispatch/http/response"
require "delegate"
require "active_support/json"
module ActionController
# # Action Controller Live
#
# Mix this module into your controller, and all actions in that controller will
# be able to stream data to the clien... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionpack/lib/action_controller/metal/permissions_policy.rb | actionpack/lib/action_controller/metal/permissions_policy.rb | # frozen_string_literal: true
# :markup: markdown
module ActionController # :nodoc:
module PermissionsPolicy
extend ActiveSupport::Concern
module ClassMethods
# Overrides parts of the globally configured `Feature-Policy` header:
#
# class PagesController < ApplicationController
... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionpack/lib/action_controller/metal/implicit_render.rb | actionpack/lib/action_controller/metal/implicit_render.rb | # frozen_string_literal: true
# :markup: markdown
module ActionController
# # Action Controller Implicit Render
#
# Handles implicit rendering for a controller action that does not explicitly
# respond with `render`, `respond_to`, `redirect`, or `head`.
#
# For API controllers, the implicit response is al... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionpack/lib/action_controller/metal/streaming.rb | actionpack/lib/action_controller/metal/streaming.rb | # frozen_string_literal: true
# :markup: markdown
module ActionController # :nodoc:
# # Action Controller Streaming
#
# Allows views to be streamed back to the client as they are rendered.
#
# By default, Rails renders views by first rendering the template and then the
# layout. The response is sent to th... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionpack/lib/action_controller/metal/rescue.rb | actionpack/lib/action_controller/metal/rescue.rb | # frozen_string_literal: true
# :markup: markdown
module ActionController # :nodoc:
# # Action Controller Rescue
#
# This module is responsible for providing
# [rescue_from](rdoc-ref:ActiveSupport::Rescuable::ClassMethods#rescue_from) to
# controllers, wrapping actions to handle configured errors, and confi... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionpack/lib/action_controller/metal/http_authentication.rb | actionpack/lib/action_controller/metal/http_authentication.rb | # frozen_string_literal: true
# :markup: markdown
require "base64"
require "active_support/security_utils"
require "active_support/core_ext/array/access"
module ActionController
# HTTP Basic, Digest, and Token authentication.
module HttpAuthentication
# # HTTP Basic authentication
#
# ### Simple Basi... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionpack/lib/action_controller/metal/instrumentation.rb | actionpack/lib/action_controller/metal/instrumentation.rb | # frozen_string_literal: true
# :markup: markdown
require "abstract_controller/logger"
module ActionController
# # Action Controller Instrumentation
#
# Adds instrumentation to several ends in ActionController::Base. It also
# provides some hooks related with process_action. This allows an ORM like
# Activ... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionpack/lib/action_controller/metal/request_forgery_protection.rb | actionpack/lib/action_controller/metal/request_forgery_protection.rb | # frozen_string_literal: true
# :markup: markdown
require "rack/session/abstract/id"
require "action_controller/metal/exceptions"
require "active_support/security_utils"
module ActionController # :nodoc:
class InvalidCrossOriginRequest < ActionControllerError # :nodoc:
end
include ActiveSupport::Deprecation::... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | true |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionpack/lib/action_controller/metal/testing.rb | actionpack/lib/action_controller/metal/testing.rb | # frozen_string_literal: true
# :markup: markdown
module ActionController
module Testing
# Behavior specific to functional tests
module Functional # :nodoc:
def clear_instance_variables_between_requests
if defined?(@_ivars)
new_ivars = instance_variables - @_ivars
new_ivars... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionpack/lib/action_controller/metal/rate_limiting.rb | actionpack/lib/action_controller/metal/rate_limiting.rb | # frozen_string_literal: true
# :markup: markdown
module ActionController # :nodoc:
module RateLimiting
extend ActiveSupport::Concern
module ClassMethods
# Applies a rate limit to all actions or those specified by the normal
# `before_action` filters with `only:` and `except:`.
#
# ... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actionpack/lib/action_controller/railties/helpers.rb | actionpack/lib/action_controller/railties/helpers.rb | # frozen_string_literal: true
# :markup: markdown
module ActionController
module Railties
module Helpers
def inherited(klass)
super
return unless klass.respond_to?(:helpers_path=)
if namespace = klass.module_parents.detect { |m| m.respond_to?(:railtie_helpers_paths) }
pa... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activejob/test/helper.rb | activejob/test/helper.rb | # frozen_string_literal: true
require_relative "../../tools/strict_warnings"
require "active_job"
require "support/job_buffer"
GlobalID.app = "aj"
@adapter = ENV["AJ_ADAPTER"] ||= "inline"
puts "Using #{@adapter}"
if ENV["AJ_INTEGRATION_TESTS"]
require "support/integration/helper"
else
ActiveJob::Base.logger = ... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activejob/test/jobs/hello_job.rb | activejob/test/jobs/hello_job.rb | # frozen_string_literal: true
require_relative "../support/job_buffer"
class HelloJob < ActiveJob::Base
def perform(greeter = "David")
JobBuffer.add("#{greeter} says hello")
end
end
| ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activejob/test/jobs/inherited_job.rb | activejob/test/jobs/inherited_job.rb | # frozen_string_literal: true
require_relative "application_job"
class InheritedJob < ApplicationJob
self.queue_adapter = :inline
end
| ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activejob/test/jobs/retry_job.rb | activejob/test/jobs/retry_job.rb | # frozen_string_literal: true
require_relative "../support/job_buffer"
require "active_support/core_ext/integer/inflections"
class DefaultsError < StandardError; end
class DisabledJitterError < StandardError; end
class ZeroJitterError < StandardError; end
class FirstRetryableErrorOfTwo < StandardError; end
class Seco... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activejob/test/jobs/raising_job.rb | activejob/test/jobs/raising_job.rb | # frozen_string_literal: true
class RaisingJob < ActiveJob::Base
MyError = Class.new(StandardError)
retry_on(MyError, attempts: 2)
def perform(error = "RaisingJob::MyError")
raise error.constantize
end
end
| ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activejob/test/jobs/enqueue_error_job.rb | activejob/test/jobs/enqueue_error_job.rb | # frozen_string_literal: true
class EnqueueErrorJob < ActiveJob::Base
class EnqueueErrorAdapter
class << self
attr_accessor :should_raise_sequence
end
self.should_raise_sequence = []
def enqueue(*)
raise ActiveJob::EnqueueError, "There was an error enqueuing the job" if should_raise?
... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activejob/test/jobs/configuration_job.rb | activejob/test/jobs/configuration_job.rb | # frozen_string_literal: true
require_relative "../support/job_buffer"
class ConfigurationJob < ActiveJob::Base
def perform
JobBuffer.add(self)
end
end
| ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activejob/test/jobs/disable_log_job.rb | activejob/test/jobs/disable_log_job.rb | # frozen_string_literal: true
class DisableLogJob < ActiveJob::Base
self.log_arguments = false
def perform(dummy)
logger.info "Dummy, here is it: #{dummy}"
end
def job_id
"LOGGING-JOB-ID"
end
end
| ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activejob/test/jobs/timezone_dependent_job.rb | activejob/test/jobs/timezone_dependent_job.rb | # frozen_string_literal: true
require_relative "../support/job_buffer"
require "active_support/time"
class TimezoneDependentJob < ActiveJob::Base
def perform(now)
now = now.in_time_zone
new_year = localtime(2018, 1, 1)
if now >= new_year
JobBuffer.add("Happy New Year!")
else
JobBuffer.a... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activejob/test/jobs/retries_job.rb | activejob/test/jobs/retries_job.rb | # frozen_string_literal: true
class BeforeEnqueueError < StandardError; end
class RetriesJob < ActiveJob::Base
attr_accessor :raise_before_enqueue
# The job fails in before_enqueue the first time it retries itself.
before_perform do
self.raise_before_enqueue = true
end
# The job fails once to enqueue/... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activejob/test/jobs/translated_raising_job.rb | activejob/test/jobs/translated_raising_job.rb | # frozen_string_literal: true
require_relative "../support/job_buffer"
class TranslatedRaisingJob < ActiveJob::Base
rescue_from(StandardError) do
JobBuffer.add(I18n.locale)
end
def perform
raise "boom"
end
end
| ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activejob/test/jobs/multiple_kwargs_job.rb | activejob/test/jobs/multiple_kwargs_job.rb | # frozen_string_literal: true
require_relative "../support/job_buffer"
class MultipleKwargsJob < ActiveJob::Base
def perform(argument1:, argument2:)
JobBuffer.add("Job with argument1: #{argument1}, argument2: #{argument2}")
end
end
| ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activejob/test/jobs/gid_job.rb | activejob/test/jobs/gid_job.rb | # frozen_string_literal: true
require_relative "../support/job_buffer"
class GidJob < ActiveJob::Base
def perform(person)
JobBuffer.add("Person with ID: #{person.id}")
end
end
| ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activejob/test/jobs/application_job.rb | activejob/test/jobs/application_job.rb | # frozen_string_literal: true
class ApplicationJob < ActiveJob::Base
end
| ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activejob/test/jobs/overridden_logging_job.rb | activejob/test/jobs/overridden_logging_job.rb | # frozen_string_literal: true
class OverriddenLoggingJob < ActiveJob::Base
def perform(dummy)
logger.info "Dummy, here is it: #{dummy}"
end
def logger
@logger ||= ActiveSupport::TaggedLogging.new(ActiveSupport::Logger.new(nil))
end
end
| ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activejob/test/jobs/after_discard_retry_job.rb | activejob/test/jobs/after_discard_retry_job.rb | # frozen_string_literal: true
require_relative "../support/job_buffer"
require "active_support/core_ext/integer/inflections"
class AfterDiscardRetryJob < ActiveJob::Base
class UnhandledError < StandardError; end
class DefaultsError < StandardError; end
class CustomCatchError < StandardError; end
class Discard... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activejob/test/jobs/nested_job.rb | activejob/test/jobs/nested_job.rb | # frozen_string_literal: true
class NestedJob < ActiveJob::Base
def perform
LoggingJob.perform_later "NestedJob"
end
def job_id
"NESTED-JOB-ID"
end
end
| ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activejob/test/jobs/translated_hello_job.rb | activejob/test/jobs/translated_hello_job.rb | # frozen_string_literal: true
require_relative "../support/job_buffer"
class TranslatedHelloJob < ActiveJob::Base
def perform(greeter = "David")
translations = { en: "Hello", de: "Guten Tag" }
hello = translations[I18n.locale]
JobBuffer.add("#{greeter} says #{hello}")
end
end
| ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activejob/test/jobs/rescue_job.rb | activejob/test/jobs/rescue_job.rb | # frozen_string_literal: true
require_relative "../support/job_buffer"
class RescueJob < ActiveJob::Base
class OtherError < StandardError; end
rescue_from(ArgumentError) do
JobBuffer.add("rescued from ArgumentError")
arguments[0] = "DIFFERENT!"
job = retry_job
JobBuffer.add("Retried job #{job.arg... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activejob/test/jobs/prefixed_job.rb | activejob/test/jobs/prefixed_job.rb | # frozen_string_literal: true
class PrefixedJob < ActiveJob::Base
self.queue_name_prefix = "production"
def perform; end
end
| ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activejob/test/jobs/queue_adapter_job.rb | activejob/test/jobs/queue_adapter_job.rb | # frozen_string_literal: true
class QueueAdapterJob < ActiveJob::Base
self.queue_adapter = :inline
end
| ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activejob/test/jobs/kwargs_job.rb | activejob/test/jobs/kwargs_job.rb | # frozen_string_literal: true
require_relative "../support/job_buffer"
class KwargsJob < ActiveJob::Base
def perform(argument: 1)
JobBuffer.add("Job with argument: #{argument}")
end
end
| ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activejob/test/jobs/provider_jid_job.rb | activejob/test/jobs/provider_jid_job.rb | # frozen_string_literal: true
require_relative "../support/job_buffer"
class ProviderJidJob < ActiveJob::Base
def perform
JobBuffer.add("Provider Job ID: #{provider_job_id}")
end
end
| ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activejob/test/jobs/arguments_round_trip_job.rb | activejob/test/jobs/arguments_round_trip_job.rb | # frozen_string_literal: true
class ArgumentsRoundTripJob < ActiveJob::Base
def perform(*arguments)
JobBuffer.add(arguments)
end
end
| ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activejob/test/jobs/abort_before_enqueue_job.rb | activejob/test/jobs/abort_before_enqueue_job.rb | # frozen_string_literal: true
class AbortBeforeEnqueueJob < ActiveJob::Base
MyError = Class.new(StandardError)
before_enqueue :throw_or_raise
after_enqueue { self.flag = "after_enqueue" }
before_perform { throw(:abort) }
after_perform { self.flag = "after_perform" }
attr_accessor :flag
def perform
... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activejob/test/jobs/logging_job.rb | activejob/test/jobs/logging_job.rb | # frozen_string_literal: true
class LoggingJob < ActiveJob::Base
def perform(*dummy)
logger.info "Dummy, here is it: #{dummy.join(" ")}"
end
def job_id
"LOGGING-JOB-ID"
end
end
| ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activejob/test/jobs/timezone_raising_job.rb | activejob/test/jobs/timezone_raising_job.rb | # frozen_string_literal: true
require_relative "../support/job_buffer"
require "active_support/time"
class TimezoneRaisingJob < ActiveJob::Base
rescue_from(StandardError) do
JobBuffer.add(Time.zone.name)
end
def perform
raise "boom"
end
end
| ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activejob/test/jobs/callback_job.rb | activejob/test/jobs/callback_job.rb | # frozen_string_literal: true
class CallbackJob < ActiveJob::Base
before_perform ->(job) { job.history << "CallbackJob ran before_perform" }
after_perform ->(job) { job.history << "CallbackJob ran after_perform" }
before_enqueue ->(job) { job.history << "CallbackJob ran before_enqueue" }
after_enqueue ->(job)... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activejob/test/support/job_buffer.rb | activejob/test/support/job_buffer.rb | # frozen_string_literal: true
module JobBuffer
class << self
def clear
values.clear
end
def add(value)
values << value
end
def values
@values ||= []
end
def last_value
values.last
end
end
end
class ActiveSupport::TestCase
teardown do
JobBuffer.clear... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activejob/test/support/do_not_perform_enqueued_jobs.rb | activejob/test/support/do_not_perform_enqueued_jobs.rb | # frozen_string_literal: true
module DoNotPerformEnqueuedJobs
extend ActiveSupport::Concern
included do
setup do
# /rails/activejob/test/adapters/test.rb sets these configs to true, but
# in this specific case we want to test enqueueing behavior.
@perform_enqueued_jobs = queue_adapter.perfor... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activejob/test/support/test_logger.rb | activejob/test/support/test_logger.rb | # frozen_string_literal: true
class TestLogger < ActiveSupport::Logger
def initialize
@file = StringIO.new
super(@file)
end
def messages
@file.rewind
@file.read
end
end
module TestLoggerHelper
def setup
super
JobBuffer.clear
@old_logger = ActiveJob::Base.logger
@logger = Act... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activejob/test/support/integration/dummy_app_template.rb | activejob/test/support/integration/dummy_app_template.rb | # frozen_string_literal: true
if ENV["AJ_ADAPTER"] == "delayed_job"
generate "delayed_job:active_record", "--quiet"
end
initializer "activejob.rb", <<-CODE
require "#{File.expand_path("jobs_manager.rb", __dir__)}"
JobsManager.current_manager.setup
CODE
initializer "i18n.rb", <<-CODE
I18n.available_locales = [:en,... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activejob/test/support/integration/jobs_manager.rb | activejob/test/support/integration/jobs_manager.rb | # frozen_string_literal: true
class JobsManager
@@managers = {}
attr :adapter_name
def self.current_manager
@@managers[ENV["AJ_ADAPTER"]] ||= new(ENV["AJ_ADAPTER"])
end
def initialize(adapter_name)
@adapter_name = adapter_name
require_relative "adapters/#{adapter_name}"
extend "#{adapter_na... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activejob/test/support/integration/helper.rb | activejob/test/support/integration/helper.rb | # frozen_string_literal: true
ENV["RAILS_ENV"] = "test"
ActiveJob::Base.queue_name_prefix = nil
require "rails/generators/rails/app/app_generator"
require "tmpdir"
dummy_app_path = Dir.mktmpdir + "/dummy"
dummy_app_template = File.expand_path("dummy_app_template.rb", __dir__)
args = Rails::Generators::ARGVScrub... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activejob/test/support/integration/test_case_helpers.rb | activejob/test/support/integration/test_case_helpers.rb | # frozen_string_literal: true
require "support/integration/jobs_manager"
module TestCaseHelpers
extend ActiveSupport::Concern
included do
self.use_transactional_tests = false
setup do
clear_jobs
@id = "AJ-#{SecureRandom.uuid}"
end
teardown do
clear_jobs
end
end
privat... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activejob/test/support/integration/adapters/queue_classic.rb | activejob/test/support/integration/adapters/queue_classic.rb | # frozen_string_literal: true
module QueueClassicJobsManager
def setup
ENV["QC_DATABASE_URL"] ||= "postgres:///active_jobs_qc_int_test"
ENV["QC_RAILS_DATABASE"] = "false"
ENV["QC_LISTEN_TIME"] = "0.5"
ActiveJob::Base.queue_adapter = :queue_classic
end
def clear_jobs
QC::Queue.new("integra... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activejob/test/support/integration/adapters/inline.rb | activejob/test/support/integration/adapters/inline.rb | # frozen_string_literal: true
module InlineJobsManager
def setup
ActiveJob::Base.queue_adapter = :inline
end
def clear_jobs
end
def start_workers
end
def stop_workers
end
end
| ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activejob/test/support/integration/adapters/sidekiq.rb | activejob/test/support/integration/adapters/sidekiq.rb | # frozen_string_literal: true
require "sidekiq/api"
require "sidekiq/testing"
Sidekiq::Testing.disable!
module SidekiqJobsManager
def setup
ActiveJob::Base.queue_adapter = :sidekiq
unless can_run?
puts "Cannot run integration tests for Sidekiq. To be able to run integration tests for Sidekiq you need... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activejob/test/support/integration/adapters/resque.rb | activejob/test/support/integration/adapters/resque.rb | # frozen_string_literal: true
module ResqueJobsManager
def setup
ActiveJob::Base.queue_adapter = :resque
Resque.redis = Redis::Namespace.new "active_jobs_int_test", redis: Redis.new(url: ENV["REDIS_URL"] || "redis://127.0.0.1:6379/12")
Resque.logger = Rails.logger
unless can_run?
puts "Cannot r... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activejob/test/support/integration/adapters/backburner.rb | activejob/test/support/integration/adapters/backburner.rb | # frozen_string_literal: true
module BackburnerJobsManager
def setup
ActiveJob::Base.queue_adapter = :backburner
Backburner.configure do |config|
config.beanstalk_url = ENV["BEANSTALK_URL"] if ENV["BEANSTALK_URL"]
config.logger = Rails.logger
end
unless can_run?
puts "Cannot run int... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activejob/test/support/integration/adapters/delayed_job.rb | activejob/test/support/integration/adapters/delayed_job.rb | # frozen_string_literal: true
require "delayed_job"
require "delayed_job_active_record"
module DelayedJobJobsManager
def setup
ActiveJob::Base.queue_adapter = :delayed_job
end
def clear_jobs
Delayed::Job.delete_all
end
def start_workers
@worker = Delayed::Worker.new(quiet: true, sleep_delay: 0.... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activejob/test/support/integration/adapters/sneakers.rb | activejob/test/support/integration/adapters/sneakers.rb | # frozen_string_literal: true
require "sneakers/runner"
require "timeout"
module SneakersJobsManager
def setup
ActiveJob::Base.queue_adapter = :sneakers
Sneakers.configure heartbeat: 2,
amqp: ENV["RABBITMQ_URL"] || "amqp://guest:guest@localhost:5672",
vhost: ... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activejob/test/support/integration/adapters/async.rb | activejob/test/support/integration/adapters/async.rb | # frozen_string_literal: true
module AsyncJobsManager
def setup
ActiveJob::Base.queue_adapter = :async
ActiveJob::Base.queue_adapter.immediate = false
end
def clear_jobs
ActiveJob::Base.queue_adapter.shutdown
end
end
| ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activejob/test/support/queue_classic/inline.rb | activejob/test/support/queue_classic/inline.rb | # frozen_string_literal: true
require "queue_classic"
require "active_support/core_ext/module/redefine_method"
module QC
class Queue
redefine_method(:enqueue) do |method, *args|
receiver_str, _, message = method.rpartition(".")
receiver = eval(receiver_str)
receiver.public_send(message, *args)... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activejob/test/support/sneakers/inline.rb | activejob/test/support/sneakers/inline.rb | # frozen_string_literal: true
require "sneakers"
require "active_support/core_ext/module/redefine_method"
module Sneakers
module Worker
module ClassMethods
redefine_method(:enqueue) do |msg|
worker = new(nil, nil, {})
worker.work(*msg)
end
end
end
end
| ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activejob/test/support/delayed_job/delayed/backend/test.rb | activejob/test/support/delayed_job/delayed/backend/test.rb | # frozen_string_literal: true
# copied from https://github.com/collectiveidea/delayed_job/blob/master/spec/delayed/backend/test.rb
# An in-memory backend suitable only for testing. Tries to behave as if it were an ORM.
module Delayed
module Backend
module Test
class Job
attr_accessor :id
a... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activejob/test/support/delayed_job/delayed/serialization/test.rb | activejob/test/support/delayed_job/delayed/serialization/test.rb | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false | |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activejob/test/support/backburner/inline.rb | activejob/test/support/backburner/inline.rb | # frozen_string_literal: true
require "backburner"
Backburner::Worker.class_eval do
class << self; alias_method :original_enqueue, :enqueue; end
def self.enqueue(job_class, args = [], opts = {})
job_class.perform(*args)
end
end
| ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activejob/test/support/stubs/strong_parameters.rb | activejob/test/support/stubs/strong_parameters.rb | # frozen_string_literal: true
class Parameters
def initialize(parameters = {})
@parameters = parameters.with_indifferent_access
end
def permitted?
true
end
def to_h
@parameters.to_h
end
end
| ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activejob/test/serializers/time_with_zone_serializer_test.rb | activejob/test/serializers/time_with_zone_serializer_test.rb | # frozen_string_literal: true
require "helper"
class TimeWithZoneSerializerTest < ActiveSupport::TestCase
test "#deserialize preserves serialized time zone" do
time_zone_before = Time.zone
Time.zone = "America/Los_Angeles"
time_with_zone = Time.parse("08:00").in_time_zone
assert_equal "America/Los... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activejob/test/integration/queuing_test.rb | activejob/test/integration/queuing_test.rb | # frozen_string_literal: true
require "helper"
require "jobs/logging_job"
require "jobs/hello_job"
require "jobs/provider_jid_job"
require "active_support/core_ext/numeric/time"
return unless ENV["AJ_INTEGRATION_TESTS"] == "1"
class QueuingTest < ActiveSupport::TestCase
test "should run jobs enqueued on a listenin... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activejob/test/cases/serializers_test.rb | activejob/test/cases/serializers_test.rb | # frozen_string_literal: true
require "helper"
require "active_job/serializers"
class SerializersTest < ActiveSupport::TestCase
class DummyValueObject
attr_accessor :value
def initialize(value)
@value = value
end
def ==(other)
self.value == other.value
end
end
class DummySeria... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activejob/test/cases/instrumentation_test.rb | activejob/test/cases/instrumentation_test.rb | # frozen_string_literal: true
require "helper"
require "jobs/hello_job"
require "jobs/retry_job"
class InstrumentationTest < ActiveSupport::TestCase
include ActiveJob::TestHelper
setup do
JobBuffer.clear
end
test "perform_now emits perform events" do
events = capture_notifications(/perform.*\.active... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activejob/test/cases/structured_event_subscriber_test.rb | activejob/test/cases/structured_event_subscriber_test.rb | # frozen_string_literal: true
require "helper"
require "active_support/testing/event_reporter_assertions"
require "active_job/structured_event_subscriber"
require "active_job/continuable"
module ActiveJob
class StructuredEventSubscriberTest < ActiveSupport::TestCase
include ActiveSupport::Testing::EventReporter... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activejob/test/cases/enqueue_after_transaction_commit_test.rb | activejob/test/cases/enqueue_after_transaction_commit_test.rb | # frozen_string_literal: true
require "helper"
require "jobs/enqueue_error_job"
class EnqueueAfterTransactionCommitTest < ActiveSupport::TestCase
class FakeActiveRecord
attr_reader :calls
def initialize(should_yield = true)
@calls = 0
@yield = should_yield
@callbacks = []
end
def... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.