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/activerecord/lib/active_record/associations/join_dependency.rb | activerecord/lib/active_record/associations/join_dependency.rb | # frozen_string_literal: true
module ActiveRecord
module Associations
class JoinDependency # :nodoc:
extend ActiveSupport::Autoload
eager_autoload do
autoload :JoinBase
autoload :JoinAssociation
end
class Aliases # :nodoc:
def initialize(tables)
@tables... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/lib/active_record/associations/has_one_association.rb | activerecord/lib/active_record/associations/has_one_association.rb | # frozen_string_literal: true
module ActiveRecord
module Associations
# = Active Record Has One Association
class HasOneAssociation < SingularAssociation # :nodoc:
include ForeignAssociation
def handle_dependency
case options[:dependent]
when :restrict_with_exception
ra... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/lib/active_record/associations/nested_error.rb | activerecord/lib/active_record/associations/nested_error.rb | # frozen_string_literal: true
# Validation error class to wrap association records' errors,
# with index_errors support.
module ActiveRecord
module Associations
class NestedError < ::ActiveModel::NestedError
def initialize(association, inner_error)
@base = association.owner
@association = a... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/lib/active_record/associations/has_many_through_association.rb | activerecord/lib/active_record/associations/has_many_through_association.rb | # frozen_string_literal: true
module ActiveRecord
module Associations
# = Active Record Has Many Through Association
class HasManyThroughAssociation < HasManyAssociation # :nodoc:
include ThroughAssociation
def initialize(owner, reflection)
super
@through_records = {}.compare_by_... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/lib/active_record/associations/has_many_association.rb | activerecord/lib/active_record/associations/has_many_association.rb | # frozen_string_literal: true
module ActiveRecord
module Associations
# = Active Record Has Many Association
#
# This is the proxy that handles a has many association.
#
# If the association has a <tt>:through</tt> option further specialization
# is provided by its child HasManyThroughAssocia... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/lib/active_record/associations/deprecation.rb | activerecord/lib/active_record/associations/deprecation.rb | # frozen_string_literal: true
require "active_support/notifications"
require "active_support/core_ext/array/conversions"
module ActiveRecord::Associations::Deprecation # :nodoc:
EVENT = "deprecated_association.active_record"
private_constant :EVENT
MODES = [:warn, :raise, :notify].freeze
private_constant :MO... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/lib/active_record/associations/belongs_to_association.rb | activerecord/lib/active_record/associations/belongs_to_association.rb | # frozen_string_literal: true
module ActiveRecord
module Associations
# = Active Record Belongs To Association
class BelongsToAssociation < SingularAssociation # :nodoc:
def handle_dependency
return unless load_target
case options[:dependent]
when :destroy
raise Activ... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/lib/active_record/associations/collection_proxy.rb | activerecord/lib/active_record/associations/collection_proxy.rb | # frozen_string_literal: true
module ActiveRecord
module Associations
# = Active Record Collection Proxy
#
# Collection proxies in Active Record are middlemen between an
# <tt>association</tt>, and its <tt>target</tt> result set.
#
# For example, given
#
# class Blog < ActiveRecord:... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | true |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/lib/active_record/associations/errors.rb | activerecord/lib/active_record/associations/errors.rb | # frozen_string_literal: true
module ActiveRecord
class AssociationNotFoundError < ConfigurationError # :nodoc:
attr_reader :record, :association_name
def initialize(record = nil, association_name = nil)
@record = record
@association_name = association_name
if record && associati... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/lib/active_record/associations/singular_association.rb | activerecord/lib/active_record/associations/singular_association.rb | # frozen_string_literal: true
module ActiveRecord
module Associations
class SingularAssociation < Association # :nodoc:
# Implements the reader method, e.g. foo.bar for Foo.has_one :bar
def reader
ensure_klass_exists!
if !loaded? || stale_target?
reload
end
... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/lib/active_record/associations/has_one_through_association.rb | activerecord/lib/active_record/associations/has_one_through_association.rb | # frozen_string_literal: true
module ActiveRecord
module Associations
# = Active Record Has One Through Association
class HasOneThroughAssociation < HasOneAssociation # :nodoc:
include ThroughAssociation
private
def replace(record, save = true)
create_through_record(record, sav... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/lib/active_record/associations/disable_joins_association_scope.rb | activerecord/lib/active_record/associations/disable_joins_association_scope.rb | # frozen_string_literal: true
module ActiveRecord
module Associations
class DisableJoinsAssociationScope < AssociationScope # :nodoc:
def scope(association)
source_reflection = association.reflection
owner = association.owner
unscoped = association.klass.unscoped
reverse_cha... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/lib/active_record/associations/association_scope.rb | activerecord/lib/active_record/associations/association_scope.rb | # frozen_string_literal: true
module ActiveRecord
module Associations
class AssociationScope # :nodoc:
def self.scope(association)
INSTANCE.scope(association)
end
def self.create(&block)
block ||= lambda { |val| val }
new(block)
end
def initialize(value_tra... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/lib/active_record/associations/through_association.rb | activerecord/lib/active_record/associations/through_association.rb | # frozen_string_literal: true
module ActiveRecord
module Associations
# = Active Record Through Association
module ThroughAssociation # :nodoc:
delegate :source_reflection, to: :reflection
private
def transaction(&block)
through_reflection.klass.transaction(&block)
end
... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/lib/active_record/associations/collection_association.rb | activerecord/lib/active_record/associations/collection_association.rb | # frozen_string_literal: true
require "active_support/core_ext/enumerable"
module ActiveRecord
module Associations
# = Active Record Association Collection
#
# CollectionAssociation is an abstract class that provides common stuff to
# ease the implementation of association proxies that represent
... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/lib/active_record/associations/belongs_to_polymorphic_association.rb | activerecord/lib/active_record/associations/belongs_to_polymorphic_association.rb | # frozen_string_literal: true
module ActiveRecord
module Associations
# = Active Record Belongs To Polymorphic Association
class BelongsToPolymorphicAssociation < BelongsToAssociation # :nodoc:
def klass
type = owner[reflection.foreign_type]
type.presence && owner.class.polymorphic_clas... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/lib/active_record/associations/association.rb | activerecord/lib/active_record/associations/association.rb | # frozen_string_literal: true
module ActiveRecord
module Associations
# = Active Record Associations
#
# This is the root class of all associations ('+ Foo' signifies an included module Foo):
#
# Association
# SingularAssociation
# HasOneAssociation + ForeignAssociation
# ... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/lib/active_record/associations/alias_tracker.rb | activerecord/lib/active_record/associations/alias_tracker.rb | # frozen_string_literal: true
require "active_support/core_ext/string/conversions"
module ActiveRecord
module Associations
# Keeps track of table aliases for ActiveRecord::Associations::JoinDependency
class AliasTracker # :nodoc:
def self.create(pool, initial_table, joins, aliases = nil)
pool.... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/lib/active_record/associations/foreign_association.rb | activerecord/lib/active_record/associations/foreign_association.rb | # frozen_string_literal: true
module ActiveRecord::Associations
module ForeignAssociation # :nodoc:
def foreign_key_present?
if reflection.klass.primary_key
owner.attribute_present?(reflection.active_record_primary_key)
else
false
end
end
def nullified_owner_attributes
... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/lib/active_record/associations/builder/has_one.rb | activerecord/lib/active_record/associations/builder/has_one.rb | # frozen_string_literal: true
module ActiveRecord::Associations::Builder # :nodoc:
class HasOne < SingularAssociation # :nodoc:
def self.macro
:has_one
end
def self.valid_options(options)
valid = super + [:class_name, :as, :through]
valid += [:foreign_type] if options[:as]
valid ... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/lib/active_record/associations/builder/singular_association.rb | activerecord/lib/active_record/associations/builder/singular_association.rb | # frozen_string_literal: true
# This class is inherited by the has_one and belongs_to association classes
module ActiveRecord::Associations::Builder # :nodoc:
class SingularAssociation < Association # :nodoc:
def self.valid_options(options)
super + [:required, :touch]
end
def self.define_accessor... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/lib/active_record/associations/builder/has_and_belongs_to_many.rb | activerecord/lib/active_record/associations/builder/has_and_belongs_to_many.rb | # frozen_string_literal: true
module ActiveRecord::Associations::Builder # :nodoc:
class HasAndBelongsToMany # :nodoc:
attr_reader :lhs_model, :association_name, :options
def initialize(association_name, lhs_model, options)
@association_name = association_name
@lhs_model = lhs_model
@optio... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/lib/active_record/associations/builder/has_many.rb | activerecord/lib/active_record/associations/builder/has_many.rb | # frozen_string_literal: true
module ActiveRecord::Associations::Builder # :nodoc:
class HasMany < CollectionAssociation # :nodoc:
def self.macro
:has_many
end
def self.valid_options(options)
valid = super + [:counter_cache, :join_table, :index_errors, :as, :through]
valid += [:foreign... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/lib/active_record/associations/builder/collection_association.rb | activerecord/lib/active_record/associations/builder/collection_association.rb | # frozen_string_literal: true
require "active_record/associations"
module ActiveRecord::Associations::Builder # :nodoc:
class CollectionAssociation < Association # :nodoc:
CALLBACKS = [:before_add, :after_add, :before_remove, :after_remove]
def self.valid_options(options)
super + [:class_name, :befor... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/lib/active_record/associations/builder/belongs_to.rb | activerecord/lib/active_record/associations/builder/belongs_to.rb | # frozen_string_literal: true
module ActiveRecord::Associations::Builder # :nodoc:
class BelongsTo < SingularAssociation # :nodoc:
def self.macro
:belongs_to
end
def self.valid_options(options)
valid = super + [:polymorphic, :counter_cache, :optional, :default]
valid << :class_name unl... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/lib/active_record/associations/builder/association.rb | activerecord/lib/active_record/associations/builder/association.rb | # frozen_string_literal: true
# This is the parent Association class which defines the variables
# used by all associations.
#
# The hierarchy is defined as follows:
# Association
# - SingularAssociation
# - BelongsToAssociation
# - HasOneAssociation
# - CollectionAssociation
# - HasManyAssociati... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/lib/active_record/associations/preloader/batch.rb | activerecord/lib/active_record/associations/preloader/batch.rb | # frozen_string_literal: true
module ActiveRecord
module Associations
class Preloader
class Batch # :nodoc:
def initialize(preloaders, available_records:)
@preloaders = preloaders.reject(&:empty?)
@available_records = available_records.flatten.group_by { |r| r.class.base_class }... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/lib/active_record/associations/preloader/through_association.rb | activerecord/lib/active_record/associations/preloader/through_association.rb | # frozen_string_literal: true
module ActiveRecord
module Associations
class Preloader
class ThroughAssociation < Association # :nodoc:
def preloaded_records
@preloaded_records ||= source_preloaders.flat_map(&:preloaded_records)
end
def records_by_owner
@records_... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/lib/active_record/associations/preloader/branch.rb | activerecord/lib/active_record/associations/preloader/branch.rb | # frozen_string_literal: true
module ActiveRecord
module Associations
class Preloader
class Branch # :nodoc:
attr_reader :association, :children, :parent
attr_reader :scope, :associate_by_default
attr_writer :preloaded_records
def initialize(association:, children:, parent:... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/lib/active_record/associations/preloader/association.rb | activerecord/lib/active_record/associations/preloader/association.rb | # frozen_string_literal: true
# :enddoc:
module ActiveRecord
module Associations
class Preloader
class Association # :nodoc:
class LoaderQuery
attr_reader :scope, :association_key_name
def initialize(scope, association_key_name)
@scope = scope
@associat... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/lib/active_record/associations/join_dependency/join_association.rb | activerecord/lib/active_record/associations/join_dependency/join_association.rb | # frozen_string_literal: true
require "active_record/associations/join_dependency/join_part"
require "active_support/core_ext/array/extract"
module ActiveRecord
module Associations
class JoinDependency # :nodoc:
class JoinAssociation < JoinPart # :nodoc:
attr_reader :reflection, :tables
at... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/lib/active_record/associations/join_dependency/join_base.rb | activerecord/lib/active_record/associations/join_dependency/join_base.rb | # frozen_string_literal: true
require "active_record/associations/join_dependency/join_part"
module ActiveRecord
module Associations
class JoinDependency # :nodoc:
class JoinBase < JoinPart # :nodoc:
attr_reader :table
def initialize(base_klass, table, children)
super(base_klass... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/lib/active_record/associations/join_dependency/join_part.rb | activerecord/lib/active_record/associations/join_dependency/join_part.rb | # frozen_string_literal: true
module ActiveRecord
module Associations
class JoinDependency # :nodoc:
# A JoinPart represents a part of a JoinDependency. It is inherited
# by JoinBase and JoinAssociation. A JoinBase represents the Active Record which
# everything else is being joined onto. A Joi... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/lib/active_record/relation/spawn_methods.rb | activerecord/lib/active_record/relation/spawn_methods.rb | # frozen_string_literal: true
require "active_support/core_ext/hash/except"
require "active_support/core_ext/hash/slice"
require "active_record/relation/merger"
module ActiveRecord
module SpawnMethods
def spawn # :nodoc:
already_in_scope?(model.scope_registry) ? model.all : clone
end
# Merges in ... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/lib/active_record/relation/merger.rb | activerecord/lib/active_record/relation/merger.rb | # frozen_string_literal: true
require "active_support/core_ext/hash/keys"
module ActiveRecord
class Relation
class HashMerger # :nodoc:
attr_reader :relation, :hash
def initialize(relation, hash)
hash.assert_valid_keys(*Relation::VALUE_METHODS)
@relation = relation
@hash ... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/lib/active_record/relation/batches.rb | activerecord/lib/active_record/relation/batches.rb | # frozen_string_literal: true
require "active_record/relation/batches/batch_enumerator"
module ActiveRecord
# = Active Record \Batches
module Batches
ORDER_IGNORE_MESSAGE = "Scoped order is ignored, use :cursor with :order to configure custom order."
DEFAULT_ORDER = :asc
# Looping through a collectio... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/lib/active_record/relation/from_clause.rb | activerecord/lib/active_record/relation/from_clause.rb | # frozen_string_literal: true
module ActiveRecord
class Relation
class FromClause # :nodoc:
attr_reader :value, :name
def initialize(value, name)
@value = value
@name = name
end
def merge(other)
self
end
def empty?
value.nil?
end
... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/lib/active_record/relation/query_methods.rb | activerecord/lib/active_record/relation/query_methods.rb | # frozen_string_literal: true
require "active_record/relation/from_clause"
require "active_record/relation/query_attribute"
require "active_record/relation/where_clause"
require "active_support/core_ext/array/wrap"
module ActiveRecord
module QueryMethods
include ActiveModel::ForbiddenAttributesProtection
#... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | true |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/lib/active_record/relation/where_clause.rb | activerecord/lib/active_record/relation/where_clause.rb | # frozen_string_literal: true
require "active_support/core_ext/array/extract"
module ActiveRecord
class Relation
class WhereClause # :nodoc:
delegate :any?, :empty?, to: :predicates
def initialize(predicates)
@predicates = predicates
end
def +(other)
WhereClause.new(pre... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/lib/active_record/relation/predicate_builder.rb | activerecord/lib/active_record/relation/predicate_builder.rb | # frozen_string_literal: true
module ActiveRecord
class PredicateBuilder # :nodoc:
require "active_record/relation/predicate_builder/array_handler"
require "active_record/relation/predicate_builder/basic_object_handler"
require "active_record/relation/predicate_builder/range_handler"
require "active_... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/lib/active_record/relation/calculations.rb | activerecord/lib/active_record/relation/calculations.rb | # frozen_string_literal: true
require "active_support/core_ext/enumerable"
module ActiveRecord
# = Active Record \Calculations
module Calculations
class ColumnAliasTracker # :nodoc:
def initialize(connection)
@connection = connection
@aliases = Hash.new(0)
end
def alias_for(... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/lib/active_record/relation/finder_methods.rb | activerecord/lib/active_record/relation/finder_methods.rb | # frozen_string_literal: true
require "active_support/core_ext/string/filters"
module ActiveRecord
module FinderMethods
ONE_AS_ONE = "1 AS one"
# Find by id - This can either be a specific id (ID), a list of ids (ID, ID, ID), or an array of ids ([ID, ID, ID]).
# `ID` refers to an "identifier". For mode... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/lib/active_record/relation/delegation.rb | activerecord/lib/active_record/relation/delegation.rb | # frozen_string_literal: true
module ActiveRecord
module Delegation # :nodoc:
class << self
def delegated_classes
[
ActiveRecord::Relation,
ActiveRecord::Associations::CollectionProxy,
ActiveRecord::AssociationRelation,
ActiveRecord::DisableJoinsAssociationR... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/lib/active_record/relation/query_attribute.rb | activerecord/lib/active_record/relation/query_attribute.rb | # frozen_string_literal: true
require "active_model/attribute"
module ActiveRecord
class Relation
class QueryAttribute < ActiveModel::Attribute # :nodoc:
def initialize(...)
super
# The query attribute value may be mutated before we actually "compile" the query.
# To avoid that if... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/lib/active_record/relation/batches/batch_enumerator.rb | activerecord/lib/active_record/relation/batches/batch_enumerator.rb | # frozen_string_literal: true
module ActiveRecord
module Batches
class BatchEnumerator
include Enumerable
def initialize(of: 1000, start: nil, finish: nil, relation:, cursor:, order: :asc, use_ranges: nil) # :nodoc:
@of = of
@relation = relation
@start = start
@... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/lib/active_record/relation/predicate_builder/basic_object_handler.rb | activerecord/lib/active_record/relation/predicate_builder/basic_object_handler.rb | # frozen_string_literal: true
module ActiveRecord
class PredicateBuilder
class BasicObjectHandler # :nodoc:
def initialize(predicate_builder)
@predicate_builder = predicate_builder
end
def call(attribute, value)
bind = predicate_builder.build_bind_attribute(attribute.name, valu... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/lib/active_record/relation/predicate_builder/relation_handler.rb | activerecord/lib/active_record/relation/predicate_builder/relation_handler.rb | # frozen_string_literal: true
module ActiveRecord
class PredicateBuilder
class RelationHandler # :nodoc:
def call(attribute, value)
if value.eager_loading?
value = value.send(:apply_join_dependency)
end
if value.select_values.empty?
model = value.model
... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/lib/active_record/relation/predicate_builder/polymorphic_array_value.rb | activerecord/lib/active_record/relation/predicate_builder/polymorphic_array_value.rb | # frozen_string_literal: true
module ActiveRecord
class PredicateBuilder
class PolymorphicArrayValue # :nodoc:
def initialize(reflection, values)
@reflection = reflection
@values = values
end
def queries
return [ reflection.join_foreign_key => values ] if values.empty?
... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/lib/active_record/relation/predicate_builder/range_handler.rb | activerecord/lib/active_record/relation/predicate_builder/range_handler.rb | # frozen_string_literal: true
module ActiveRecord
class PredicateBuilder
class RangeHandler # :nodoc:
RangeWithBinds = Struct.new(:begin, :end, :exclude_end?)
def initialize(predicate_builder)
@predicate_builder = predicate_builder
end
def call(attribute, value)
begin_bi... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/lib/active_record/relation/predicate_builder/array_handler.rb | activerecord/lib/active_record/relation/predicate_builder/array_handler.rb | # frozen_string_literal: true
require "active_support/core_ext/array/extract"
module ActiveRecord
class PredicateBuilder
class ArrayHandler # :nodoc:
def initialize(predicate_builder)
@predicate_builder = predicate_builder
end
def call(attribute, value)
return attribute.in([])... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/lib/active_record/relation/predicate_builder/association_query_value.rb | activerecord/lib/active_record/relation/predicate_builder/association_query_value.rb | # frozen_string_literal: true
module ActiveRecord
class PredicateBuilder
class AssociationQueryValue # :nodoc:
def initialize(reflection, value)
@reflection = reflection
@value = value
end
def queries
if reflection.join_foreign_key.is_a?(Array)
id_list = ids
... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actioncable/test/test_helper_test.rb | actioncable/test/test_helper_test.rb | # frozen_string_literal: true
require "test_helper"
class BroadcastChannel < ActionCable::Channel::Base
end
class TransmissionsTest < ActionCable::TestCase
def test_assert_broadcasts
assert_nothing_raised do
assert_broadcasts("test", 1) do
ActionCable.server.broadcast "test", "message"
end
... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actioncable/test/test_helper.rb | actioncable/test/test_helper.rb | # frozen_string_literal: true
require_relative "../../tools/strict_warnings"
require "action_cable"
require "active_support/testing/autorun"
require "active_support/testing/method_call_assertions"
require "puma"
require "rack/mock"
# Require all the stubs and models
Dir[File.expand_path("stubs/*.rb", __dir__)].each ... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actioncable/test/client_test.rb | actioncable/test/client_test.rb | # frozen_string_literal: true
require "test_helper"
require "concurrent"
require "websocket-client-simple"
require "json"
require "active_support/hash_with_indifferent_access"
class ClientTest < ActionCable::TestCase
WAIT_WHEN_EXPECTING_EVENT = 2
WAIT_WHEN_NOT_EXPECTING_EVENT = 0.5
class Connection < ActionC... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actioncable/test/worker_test.rb | actioncable/test/worker_test.rb | # frozen_string_literal: true
require "test_helper"
class WorkerTest < ActionCable::TestCase
class Receiver
attr_accessor :last_action
def run
@last_action = :run
end
def process(message)
@last_action = [ :process, message ]
end
def connection
self
end
def logge... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actioncable/test/javascript_package_test.rb | actioncable/test/javascript_package_test.rb | # frozen_string_literal: true
require "test_helper"
class JavascriptPackageTest < ActiveSupport::TestCase
def test_compiled_code_is_in_sync_with_source_code
compiled_files = %w[
app/assets/javascripts/actioncable.js
app/assets/javascripts/actioncable.esm.js
app/assets/javascripts/action_cable.... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actioncable/test/connection/identifier_test.rb | actioncable/test/connection/identifier_test.rb | # frozen_string_literal: true
require "test_helper"
require "stubs/test_server"
require "stubs/user"
class ActionCable::Connection::IdentifierTest < ActionCable::TestCase
class Connection < ActionCable::Connection::Base
identified_by :current_user
attr_reader :websocket
public :process_internal_message... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actioncable/test/connection/subscriptions_test.rb | actioncable/test/connection/subscriptions_test.rb | # frozen_string_literal: true
require "test_helper"
class ActionCable::Connection::SubscriptionsTest < ActionCable::TestCase
class ChatChannelError < Exception; end
class Connection < ActionCable::Connection::Base
attr_reader :websocket, :exceptions
rescue_from ChatChannelError, with: :error_handler
... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actioncable/test/connection/string_identifier_test.rb | actioncable/test/connection/string_identifier_test.rb | # frozen_string_literal: true
require "test_helper"
require "stubs/test_server"
class ActionCable::Connection::StringIdentifierTest < ActionCable::TestCase
class Connection < ActionCable::Connection::Base
identified_by :current_token
def connect
self.current_token = "random-string"
end
def s... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actioncable/test/connection/test_case_test.rb | actioncable/test/connection/test_case_test.rb | # frozen_string_literal: true
require "test_helper"
class SimpleConnection < ActionCable::Connection::Base
identified_by :user_id
class << self
attr_accessor :disconnected_user_id
end
def connect
self.user_id = request.params[:user_id] || cookies[:user_id]
end
def disconnect
self.class.disc... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actioncable/test/connection/cross_site_forgery_test.rb | actioncable/test/connection/cross_site_forgery_test.rb | # frozen_string_literal: true
require "test_helper"
require "stubs/test_server"
class ActionCable::Connection::CrossSiteForgeryTest < ActionCable::TestCase
HOST = "rubyonrails.com"
class Connection < ActionCable::Connection::Base
def send_async(method, *args)
send method, *args
end
end
setup d... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actioncable/test/connection/stream_test.rb | actioncable/test/connection/stream_test.rb | # frozen_string_literal: true
require "test_helper"
require "minitest/mock"
require "stubs/test_server"
class ActionCable::Connection::StreamTest < ActionCable::TestCase
class Connection < ActionCable::Connection::Base
attr_reader :connected, :websocket, :errors
def initialize(*)
super
@errors ... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actioncable/test/connection/client_socket_test.rb | actioncable/test/connection/client_socket_test.rb | # frozen_string_literal: true
require "test_helper"
require "stubs/test_server"
class ActionCable::Connection::ClientSocketTest < ActionCable::TestCase
class Connection < ActionCable::Connection::Base
attr_reader :connected, :websocket, :errors
def initialize(*)
super
@errors = []
end
... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actioncable/test/connection/base_test.rb | actioncable/test/connection/base_test.rb | # frozen_string_literal: true
require "test_helper"
require "stubs/test_server"
require "active_support/core_ext/object/json"
class ActionCable::Connection::BaseTest < ActionCable::TestCase
class Connection < ActionCable::Connection::Base
attr_reader :websocket, :subscriptions, :message_buffer, :connected
... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actioncable/test/connection/multiple_identifiers_test.rb | actioncable/test/connection/multiple_identifiers_test.rb | # frozen_string_literal: true
require "test_helper"
require "stubs/test_server"
require "stubs/user"
class ActionCable::Connection::MultipleIdentifiersTest < ActionCable::TestCase
class Connection < ActionCable::Connection::Base
identified_by :current_user, :current_room
def connect
self.current_user... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actioncable/test/connection/callbacks_test.rb | actioncable/test/connection/callbacks_test.rb | # frozen_string_literal: true
require "test_helper"
require "stubs/test_server"
class ActionCable::Connection::CallbacksTest < ActionCable::TestCase
class Connection < ActionCable::Connection::Base
identified_by :context
attr_reader :commands_counter
before_command do
throw :abort unless context... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actioncable/test/connection/authorization_test.rb | actioncable/test/connection/authorization_test.rb | # frozen_string_literal: true
require "test_helper"
require "stubs/test_server"
class ActionCable::Connection::AuthorizationTest < ActionCable::TestCase
class Connection < ActionCable::Connection::Base
attr_reader :websocket
def connect
reject_unauthorized_connection
end
def send_async(metho... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actioncable/test/subscription_adapter/common.rb | actioncable/test/subscription_adapter/common.rb | # frozen_string_literal: true
require "test_helper"
require "concurrent"
require "active_support/core_ext/hash/indifferent_access"
require "pathname"
module CommonSubscriptionAdapterTest
WAIT_WHEN_EXPECTING_EVENT = 3
WAIT_WHEN_NOT_EXPECTING_EVENT = 0.2
def setup
server = ActionCable::Server::Base.new
... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actioncable/test/subscription_adapter/redis_test.rb | actioncable/test/subscription_adapter/redis_test.rb | # frozen_string_literal: true
require "test_helper"
require_relative "common"
require_relative "channel_prefix"
class RedisAdapterTest < ActionCable::TestCase
include CommonSubscriptionAdapterTest
include ChannelPrefixTest
def cable_config
{ adapter: "redis", driver: "ruby" }.tap do |x|
if host = ENV... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actioncable/test/subscription_adapter/postgresql_test.rb | actioncable/test/subscription_adapter/postgresql_test.rb | # frozen_string_literal: true
require "test_helper"
require_relative "common"
require_relative "channel_prefix"
require "active_record"
class PostgresqlAdapterTest < ActionCable::TestCase
include CommonSubscriptionAdapterTest
include ChannelPrefixTest
def setup
database_config = { "adapter" => "postgresql... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actioncable/test/subscription_adapter/inline_test.rb | actioncable/test/subscription_adapter/inline_test.rb | # frozen_string_literal: true
require "test_helper"
require_relative "common"
class InlineAdapterTest < ActionCable::TestCase
include CommonSubscriptionAdapterTest
def setup
super
@tx_adapter.shutdown
@tx_adapter = @rx_adapter
end
def cable_config
{ adapter: "inline" }
end
end
| ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actioncable/test/subscription_adapter/channel_prefix.rb | actioncable/test/subscription_adapter/channel_prefix.rb | # frozen_string_literal: true
require "test_helper"
module ChannelPrefixTest
def test_channel_prefix
server2 = ActionCable::Server::Base.new(config: ActionCable::Server::Configuration.new)
server2.config.cable = alt_cable_config.with_indifferent_access
server2.config.logger = Logger.new(StringIO.new).ta... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actioncable/test/subscription_adapter/test_adapter_test.rb | actioncable/test/subscription_adapter/test_adapter_test.rb | # frozen_string_literal: true
require "test_helper"
require_relative "common"
class ActionCable::SubscriptionAdapter::TestTest < ActionCable::TestCase
include CommonSubscriptionAdapterTest
def setup
super
@tx_adapter.shutdown
@tx_adapter = @rx_adapter
end
def cable_config
{ adapter: "test" ... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actioncable/test/subscription_adapter/async_test.rb | actioncable/test/subscription_adapter/async_test.rb | # frozen_string_literal: true
require "test_helper"
require_relative "common"
class AsyncAdapterTest < ActionCable::TestCase
include CommonSubscriptionAdapterTest
def setup
super
@tx_adapter.shutdown
@tx_adapter = @rx_adapter
end
def cable_config
{ adapter: "async" }
end
end
| ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actioncable/test/subscription_adapter/subscriber_map_test.rb | actioncable/test/subscription_adapter/subscriber_map_test.rb | # frozen_string_literal: true
require "test_helper"
class SubscriberMapTest < ActionCable::TestCase
test "broadcast should not change subscribers" do
setup_subscription_map
origin = @subscription_map.instance_variable_get(:@subscribers).dup
@subscription_map.broadcast("not_exist_channel", "")
asse... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actioncable/test/subscription_adapter/base_test.rb | actioncable/test/subscription_adapter/base_test.rb | # frozen_string_literal: true
require "test_helper"
require "stubs/test_server"
class ActionCable::SubscriptionAdapter::BaseTest < ActionCable::TestCase
## TEST THAT ERRORS ARE RETURNED FOR INHERITORS THAT DON'T OVERRIDE METHODS
class BrokenAdapter < ActionCable::SubscriptionAdapter::Base
end
setup do
@... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actioncable/test/server/health_check_test.rb | actioncable/test/server/health_check_test.rb | # frozen_string_literal: true
require "test_helper"
require "active_support/core_ext/hash/indifferent_access"
class HealthCheckTest < ActionCable::TestCase
def setup
@config = ActionCable::Server::Configuration.new
@config.logger = Logger.new(nil)
@server = ActionCable::Server::Base.new config: @config
... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actioncable/test/server/base_test.rb | actioncable/test/server/base_test.rb | # frozen_string_literal: true
require "test_helper"
require "stubs/test_server"
require "active_support/core_ext/hash/indifferent_access"
class BaseTest < ActionCable::TestCase
def setup
@server = ActionCable::Server::Base.new
@server.config.cable = { adapter: "async" }.with_indifferent_access
end
clas... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actioncable/test/server/broadcasting_test.rb | actioncable/test/server/broadcasting_test.rb | # frozen_string_literal: true
require "test_helper"
require "stubs/test_server"
class BroadcastingTest < ActionCable::TestCase
setup do
@server = TestServer.new
@broadcasting = "test_queue"
@broadcaster = server.broadcaster_for(@broadcasting)
end
attr_reader :server, :broadcasting, :broadcaster
... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actioncable/test/channel/naming_test.rb | actioncable/test/channel/naming_test.rb | # frozen_string_literal: true
require "test_helper"
class ActionCable::Channel::NamingTest < ActionCable::TestCase
class ChatChannel < ActionCable::Channel::Base
end
test "channel_name" do
assert_equal "action_cable:channel:naming_test:chat", ChatChannel.channel_name
end
end
| ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actioncable/test/channel/rejection_test.rb | actioncable/test/channel/rejection_test.rb | # frozen_string_literal: true
require "test_helper"
require "minitest/mock"
require "stubs/test_connection"
require "stubs/room"
class ActionCable::Channel::RejectionTest < ActionCable::TestCase
class SecretChannel < ActionCable::Channel::Base
def subscribed
reject if params[:id] > 0
end
def secr... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actioncable/test/channel/test_case_test.rb | actioncable/test/channel/test_case_test.rb | # frozen_string_literal: true
require "test_helper"
class TestTestChannel < ActionCable::Channel::Base
end
class NonInferrableExplicitClassChannelTest < ActionCable::Channel::TestCase
tests TestTestChannel
def test_set_channel_class_manual
assert_equal TestTestChannel, self.class.channel_class
end
end
cl... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actioncable/test/channel/stream_test.rb | actioncable/test/channel/stream_test.rb | # frozen_string_literal: true
require "test_helper"
require "minitest/mock"
require "stubs/test_connection"
require "stubs/room"
require "concurrent/atomic/cyclic_barrier"
module ActionCable::StreamTests
class Connection < ActionCable::Connection::Base
attr_reader :websocket
def send_async(method, *args)
... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actioncable/test/channel/periodic_timers_test.rb | actioncable/test/channel/periodic_timers_test.rb | # frozen_string_literal: true
require "test_helper"
require "stubs/test_connection"
require "stubs/room"
require "active_support/time"
class ActionCable::Channel::PeriodicTimersTest < ActionCable::TestCase
class ChatChannel < ActionCable::Channel::Base
# Method name arg
periodically :send_updates, every: 1
... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actioncable/test/channel/base_test.rb | actioncable/test/channel/base_test.rb | # frozen_string_literal: true
require "test_helper"
require "minitest/mock"
require "stubs/test_connection"
require "stubs/room"
class ActionCable::Channel::BaseTest < ActionCable::TestCase
class ActionCable::Channel::Base
def kick
@last_action = [ :kick ]
end
def topic
end
end
class Bas... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actioncable/test/channel/broadcasting_test.rb | actioncable/test/channel/broadcasting_test.rb | # frozen_string_literal: true
require "test_helper"
require "stubs/test_connection"
require "stubs/room"
class ActionCable::Channel::BroadcastingTest < ActionCable::TestCase
class ChatChannel < ActionCable::Channel::Base
end
setup do
@connection = TestConnection.new
end
test "broadcasts_to with an obj... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actioncable/test/stubs/global_id.rb | actioncable/test/stubs/global_id.rb | # frozen_string_literal: true
class GlobalID
attr_reader :uri
delegate :to_param, :to_s, to: :uri
def initialize(gid, options = {})
@uri = gid
end
end
| ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actioncable/test/stubs/room.rb | actioncable/test/stubs/room.rb | # frozen_string_literal: true
class Room
attr_reader :id, :name
def initialize(id, name = "Campfire")
@id = id
@name = name
end
def to_global_id
GlobalID.new("Room##{id}-#{name}")
end
def to_gid_param
to_global_id.to_param
end
end
| ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actioncable/test/stubs/test_server.rb | actioncable/test/stubs/test_server.rb | # frozen_string_literal: true
class TestServer
include ActionCable::Server::Connections
include ActionCable::Server::Broadcasting
attr_reader :logger, :config, :mutex
class FakeConfiguration < ActionCable::Server::Configuration
attr_accessor :subscription_adapter, :log_tags, :filter_parameters
def i... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actioncable/test/stubs/test_connection.rb | actioncable/test/stubs/test_connection.rb | # frozen_string_literal: true
require "stubs/user"
class TestConnection
attr_reader :identifiers, :logger, :current_user, :server, :subscriptions, :transmissions
delegate :pubsub, :config, to: :server
def initialize(user = User.new("lifo"), coder: ActiveSupport::JSON, subscription_adapter: SuccessAdapter)
... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actioncable/test/stubs/test_adapter.rb | actioncable/test/stubs/test_adapter.rb | # frozen_string_literal: true
class SuccessAdapter < ActionCable::SubscriptionAdapter::Base
attr_accessor :unsubscribe_latency
def initialize(...)
super
@unsubscribe_latency = nil
end
def broadcast(channel, payload)
end
def subscribe(channel, callback, success_callback = nil)
subscriber_map[... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actioncable/test/stubs/user.rb | actioncable/test/stubs/user.rb | # frozen_string_literal: true
class User
attr_reader :name
def initialize(name)
@name = name
end
def to_global_id
GlobalID.new("User##{name}")
end
def to_gid_param
to_global_id.to_param
end
end
| ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actioncable/lib/action_cable.rb | actioncable/lib/action_cable.rb | # frozen_string_literal: true
#--
# Copyright (c) 37signals LLC
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy,... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actioncable/lib/rails/generators/test_unit/channel_generator.rb | actioncable/lib/rails/generators/test_unit/channel_generator.rb | # frozen_string_literal: true
# :markup: markdown
module TestUnit
module Generators
class ChannelGenerator < ::Rails::Generators::NamedBase
source_root File.expand_path("templates", __dir__)
check_class_collision suffix: "ChannelTest"
def create_test_files
template "channel_test.rb",... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actioncable/lib/rails/generators/channel/channel_generator.rb | actioncable/lib/rails/generators/channel/channel_generator.rb | # frozen_string_literal: true
# :markup: markdown
module Rails
module Generators
class ChannelGenerator < NamedBase
source_root File.expand_path("templates", __dir__)
argument :actions, type: :array, default: [], banner: "method method"
class_option :assets, type: :boolean
check_class... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actioncable/lib/action_cable/test_case.rb | actioncable/lib/action_cable/test_case.rb | # frozen_string_literal: true
# :markup: markdown
require "active_support/test_case"
module ActionCable
class TestCase < ActiveSupport::TestCase
include ActionCable::TestHelper
ActiveSupport.run_load_hooks(:action_cable_test_case, self)
end
end
| ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actioncable/lib/action_cable/version.rb | actioncable/lib/action_cable/version.rb | # frozen_string_literal: true
# :markup: markdown
require_relative "gem_version"
module ActionCable
# Returns the currently loaded version of Action Cable as a `Gem::Version`.
def self.version
gem_version
end
end
| ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actioncable/lib/action_cable/remote_connections.rb | actioncable/lib/action_cable/remote_connections.rb | # frozen_string_literal: true
# :markup: markdown
require "active_support/core_ext/module/redefine_method"
module ActionCable
# # Action Cable Remote Connections
#
# If you need to disconnect a given connection, you can go through the
# RemoteConnections. You can find the connections you're looking for by
... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actioncable/lib/action_cable/test_helper.rb | actioncable/lib/action_cable/test_helper.rb | # frozen_string_literal: true
# :markup: markdown
module ActionCable
# Provides helper methods for testing Action Cable broadcasting
module TestHelper
def before_setup # :nodoc:
server = ActionCable.server
test_adapter = ActionCable::SubscriptionAdapter::Test.new(server)
@old_pubsub_adapter... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/actioncable/lib/action_cable/deprecator.rb | actioncable/lib/action_cable/deprecator.rb | # frozen_string_literal: true
# :markup: markdown
module ActionCable
def self.deprecator # :nodoc:
@deprecator ||= ActiveSupport::Deprecation.new
end
end
| 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.