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/test/models/cpk/car.rb | activerecord/test/models/cpk/car.rb | # frozen_string_literal: true
module Cpk
class Car < ActiveRecord::Base
self.table_name = :cpk_cars
has_many :car_reviews, foreign_key: [:car_make, :car_model]
end
end
| ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/test/models/cpk/chapter_destroy_async.rb | activerecord/test/models/cpk/chapter_destroy_async.rb | # frozen_string_literal: true
module Cpk
class ChapterDestroyAsync < ActiveRecord::Base
self.table_name = :cpk_chapters
self.primary_key = [:author_id, :id]
belongs_to :book, foreign_key: [:author_id, :book_id], class_name: "Cpk::BookDestroyAsync"
end
end
| ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/test/models/cpk/posts_tag.rb | activerecord/test/models/cpk/posts_tag.rb | # frozen_string_literal: true
module Cpk
class PostsTag < ActiveRecord::Base
self.table_name = :cpk_posts_tags
belongs_to :post, class_name: "Cpk:Post", foreign_key: %i[post_title post_author]
belongs_to :tag, class_name: "Cpk::Tag"
end
end
| ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/test/models/cpk/car_review.rb | activerecord/test/models/cpk/car_review.rb | # frozen_string_literal: true
module Cpk
class CarReview < ActiveRecord::Base
self.table_name = :cpk_car_reviews
belongs_to :car, foreign_key: [:car_make, :car_model]
end
end
| ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/test/migrations/scope/1_unscoped.rb | activerecord/test/migrations/scope/1_unscoped.rb | # frozen_string_literal: true
class Unscoped < ActiveRecord::Migration::Current
def self.change
create_table "unscoped"
end
end
| ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/test/migrations/scope/2_mysql_only.mysql.rb | activerecord/test/migrations/scope/2_mysql_only.mysql.rb | # frozen_string_literal: true
class MysqlOnly < ActiveRecord::Migration::Current
def self.change
create_table "mysql_only"
end
end
| ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/test/migrations/to_copy_with_timestamps2/20090101010202_create_comments.rb | activerecord/test/migrations/to_copy_with_timestamps2/20090101010202_create_comments.rb | # frozen_string_literal: true
class CreateComments < ActiveRecord::Migration::Current
def self.up
end
def self.down
end
end
| ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/test/migrations/to_copy_with_timestamps2/20090101010101_create_articles.rb | activerecord/test/migrations/to_copy_with_timestamps2/20090101010101_create_articles.rb | # frozen_string_literal: true
class CreateArticles < ActiveRecord::Migration::Current
def self.up
end
def self.down
end
end
| ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/test/migrations/valid/1_valid_people_have_last_names.rb | activerecord/test/migrations/valid/1_valid_people_have_last_names.rb | # frozen_string_literal: true
class ValidPeopleHaveLastNames < ActiveRecord::Migration::Current
def self.up
add_column "people", "last_name", :string
end
def self.down
remove_column "people", "last_name"
end
end
| ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/test/migrations/valid/3_innocent_jointable.rb | activerecord/test/migrations/valid/3_innocent_jointable.rb | # frozen_string_literal: true
class InnocentJointable < ActiveRecord::Migration::Current
def self.up
create_table("people_reminders", id: false) do |t|
t.column :reminder_id, :integer
t.column :person_id, :integer
end
end
def self.down
drop_table "people_reminders"
end
end
| ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/test/migrations/valid/2_we_need_reminders.rb | activerecord/test/migrations/valid/2_we_need_reminders.rb | # frozen_string_literal: true
class WeNeedReminders < ActiveRecord::Migration::Current
def self.up
create_table("reminders") do |t|
t.column :content, :text
t.column :remind_at, :datetime
end
end
def self.down
drop_table "reminders"
end
end
| ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/test/migrations/to_copy_with_timestamps/20090101010101_people_have_hobbies.rb | activerecord/test/migrations/to_copy_with_timestamps/20090101010101_people_have_hobbies.rb | # frozen_string_literal: true
class PeopleHaveHobbies < ActiveRecord::Migration::Current
def self.up
add_column "people", "hobbies", :text
end
def self.down
remove_column "people", "hobbies"
end
end
| ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/test/migrations/to_copy_with_timestamps/20090101010202_people_have_descriptions.rb | activerecord/test/migrations/to_copy_with_timestamps/20090101010202_people_have_descriptions.rb | # frozen_string_literal: true
class PeopleHaveDescriptions < ActiveRecord::Migration::Current
def self.up
add_column "people", "description", :text
end
def self.down
remove_column "people", "description"
end
end
| ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/test/migrations/missing/4_innocent_jointable.rb | activerecord/test/migrations/missing/4_innocent_jointable.rb | # frozen_string_literal: true
class InnocentJointable < ActiveRecord::Migration::Current
def self.up
create_table("people_reminders", id: false) do |t|
t.column :reminder_id, :integer
t.column :person_id, :integer
end
end
def self.down
drop_table "people_reminders"
end
end
| ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/test/migrations/missing/3_we_need_reminders.rb | activerecord/test/migrations/missing/3_we_need_reminders.rb | # frozen_string_literal: true
class WeNeedReminders < ActiveRecord::Migration::Current
def self.up
create_table("reminders") do |t|
t.column :content, :text
t.column :remind_at, :datetime
end
end
def self.down
drop_table "reminders"
end
end
| ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/test/migrations/missing/1_people_have_last_names.rb | activerecord/test/migrations/missing/1_people_have_last_names.rb | # frozen_string_literal: true
class PeopleHaveLastNames < ActiveRecord::Migration::Current
def self.up
add_column "people", "last_name", :string
end
def self.down
remove_column "people", "last_name"
end
end
| ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/test/migrations/missing/1000_people_have_middle_names.rb | activerecord/test/migrations/missing/1000_people_have_middle_names.rb | # frozen_string_literal: true
class PeopleHaveMiddleNames < ActiveRecord::Migration::Current
def self.up
add_column "people", "middle_name", :string
end
def self.down
remove_column "people", "middle_name"
end
end
| ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/test/migrations/rename/2_rename_things.rb | activerecord/test/migrations/rename/2_rename_things.rb | # frozen_string_literal: true
class RenameThings < ActiveRecord::Migration::Current
def self.up
rename_table "things", "awesome_things"
end
def self.down
rename_table "awesome_things", "things"
end
end
| ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/test/migrations/rename/1_we_need_things.rb | activerecord/test/migrations/rename/1_we_need_things.rb | # frozen_string_literal: true
class WeNeedThings < ActiveRecord::Migration::Current
def self.up
create_table("things") do |t|
t.column :content, :text
end
end
def self.down
drop_table "things"
end
end
| ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/test/migrations/version_check/20131219224947_migration_version_check.rb | activerecord/test/migrations/version_check/20131219224947_migration_version_check.rb | # frozen_string_literal: true
class MigrationVersionCheck < ActiveRecord::Migration::Current
def self.up
raise "incorrect migration version" unless version == 20131219224947
end
def self.down
end
end
| ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/test/migrations/to_copy_with_name_collision/1_people_have_hobbies.rb | activerecord/test/migrations/to_copy_with_name_collision/1_people_have_hobbies.rb | # frozen_string_literal: true
class PeopleHaveHobbies < ActiveRecord::Migration::Current
def self.up
add_column "people", "hobbies", :string
end
def self.down
remove_column "people", "hobbies"
end
end
| ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/test/migrations/10_urban/9_add_expressions.rb | activerecord/test/migrations/10_urban/9_add_expressions.rb | # frozen_string_literal: true
class AddExpressions < ActiveRecord::Migration::Current
def self.up
create_table("expressions") do |t|
t.column :expression, :string
end
end
def self.down
drop_table "expressions"
end
end
| ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/test/migrations/magic/1_currencies_have_symbols.rb | activerecord/test/migrations/magic/1_currencies_have_symbols.rb | # frozen_string_literal: true
# coding: ISO-8859-15
class CurrenciesHaveSymbols < ActiveRecord::Migration::Current
def self.up
# We use € for default currency symbol
add_column "currencies", "symbol", :string, default: "€"
end
def self.down
remove_column "currencies", "symbol"
end
end
| ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/test/migrations/valid_with_subdirectories/1_valid_people_have_last_names.rb | activerecord/test/migrations/valid_with_subdirectories/1_valid_people_have_last_names.rb | # frozen_string_literal: true
class ValidPeopleHaveLastNames < ActiveRecord::Migration::Current
def self.up
add_column "people", "last_name", :string
end
def self.down
remove_column "people", "last_name"
end
end
| ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/test/migrations/valid_with_subdirectories/sub1/3_innocent_jointable.rb | activerecord/test/migrations/valid_with_subdirectories/sub1/3_innocent_jointable.rb | # frozen_string_literal: true
class InnocentJointable < ActiveRecord::Migration::Current
def self.up
create_table("people_reminders", id: false) do |t|
t.column :reminder_id, :integer
t.column :person_id, :integer
end
end
def self.down
drop_table "people_reminders"
end
end
| ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/test/migrations/valid_with_subdirectories/sub/2_we_need_reminders.rb | activerecord/test/migrations/valid_with_subdirectories/sub/2_we_need_reminders.rb | # frozen_string_literal: true
class WeNeedReminders < ActiveRecord::Migration::Current
def self.up
create_table("reminders") do |t|
t.column :content, :text
t.column :remind_at, :datetime
end
end
def self.down
drop_table "reminders"
end
end
| ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/test/migrations/to_copy/2_people_have_descriptions.rb | activerecord/test/migrations/to_copy/2_people_have_descriptions.rb | # frozen_string_literal: true
class PeopleHaveDescriptions < ActiveRecord::Migration::Current
def self.up
add_column "people", "description", :text
end
def self.down
remove_column "people", "description"
end
end
| ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/test/migrations/to_copy/1_people_have_hobbies.rb | activerecord/test/migrations/to_copy/1_people_have_hobbies.rb | # frozen_string_literal: true
class PeopleHaveHobbies < ActiveRecord::Migration::Current
def self.up
add_column "people", "hobbies", :text
end
def self.down
remove_column "people", "hobbies"
end
end
| ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/test/migrations/decimal/1_give_me_big_numbers.rb | activerecord/test/migrations/decimal/1_give_me_big_numbers.rb | # frozen_string_literal: true
class GiveMeBigNumbers < ActiveRecord::Migration::Current
def self.up
create_table :big_numbers do |table|
table.column :bank_balance, :decimal, precision: 10, scale: 2
table.column :big_bank_balance, :decimal, precision: 15, scale: 2
table.column :world_population... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/test/migrations/to_copy2/2_create_comments.rb | activerecord/test/migrations/to_copy2/2_create_comments.rb | # frozen_string_literal: true
class CreateComments < ActiveRecord::Migration::Current
def self.up
end
def self.down
end
end
| ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/test/migrations/to_copy2/1_create_articles.rb | activerecord/test/migrations/to_copy2/1_create_articles.rb | # frozen_string_literal: true
class CreateArticles < ActiveRecord::Migration::Current
def self.up
end
def self.down
end
end
| ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/test/migrations/old_and_new_versions/20210716122844_add_people_description.rb | activerecord/test/migrations/old_and_new_versions/20210716122844_add_people_description.rb | # frozen_string_literal: true
class AddPeopleDescription < ActiveRecord::Migration::Current
add_column :people, :description, :string
end
| ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/test/migrations/old_and_new_versions/230_add_people_hobby.rb | activerecord/test/migrations/old_and_new_versions/230_add_people_hobby.rb | # frozen_string_literal: true
class AddPeopleHobby < ActiveRecord::Migration::Current
add_column :people, :hobby, :string
end
| ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/test/migrations/old_and_new_versions/231_add_people_last_name.rb | activerecord/test/migrations/old_and_new_versions/231_add_people_last_name.rb | # frozen_string_literal: true
class AddPeopleLastName < ActiveRecord::Migration::Current
add_column :people, :last_name, :string
end
| ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/test/migrations/old_and_new_versions/20210716123013_add_people_number_of_legs.rb | activerecord/test/migrations/old_and_new_versions/20210716123013_add_people_number_of_legs.rb | # frozen_string_literal: true
class AddPeopleNumberOfLegs < ActiveRecord::Migration::Current
add_column :people, :number_of_legs, :integer
end
| ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/test/migrations/valid_with_timestamps/20100301010101_valid_with_timestamps_innocent_jointable.rb | activerecord/test/migrations/valid_with_timestamps/20100301010101_valid_with_timestamps_innocent_jointable.rb | # frozen_string_literal: true
class ValidWithTimestampsInnocentJointable < ActiveRecord::Migration::Current
def self.up
create_table("people_reminders", id: false) do |t|
t.column :reminder_id, :integer
t.column :person_id, :integer
end
end
def self.down
drop_table "people_reminders"
e... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/test/migrations/valid_with_timestamps/20100101010101_valid_with_timestamps_people_have_last_names.rb | activerecord/test/migrations/valid_with_timestamps/20100101010101_valid_with_timestamps_people_have_last_names.rb | # frozen_string_literal: true
class ValidWithTimestampsPeopleHaveLastNames < ActiveRecord::Migration::Current
def self.up
add_column "people", "last_name", :string
end
def self.down
remove_column "people", "last_name"
end
end
| ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/test/migrations/valid_with_timestamps/20100201010101_valid_with_timestamps_we_need_reminders.rb | activerecord/test/migrations/valid_with_timestamps/20100201010101_valid_with_timestamps_we_need_reminders.rb | # frozen_string_literal: true
class ValidWithTimestampsWeNeedReminders < ActiveRecord::Migration::Current
def self.up
create_table("reminders") do |t|
t.column :content, :text
t.column :remind_at, :datetime
end
end
def self.down
drop_table "reminders"
end
end
| ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/test/activejob/destroy_association_async_job_test.rb | activerecord/test/activejob/destroy_association_async_job_test.rb | # frozen_string_literal: true
require "cases/helper"
class UndefinedConstantAsync < ActiveRecord::Base
self.destroy_association_async_job = "UndefinedConstantJob"
end
autoload :UnloadableBaseJob, "activejob/unloadable_base_job"
class UnloadableBaseAsync < ActiveRecord::Base
self.destroy_association_async_job = "... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/test/activejob/destroy_association_async_test.rb | activerecord/test/activejob/destroy_association_async_test.rb | # frozen_string_literal: true
require "activejob/helper"
require "models/book_destroy_async"
require "models/essay_destroy_async"
require "models/tag"
require "models/tagging"
require "models/author"
require "models/essay"
require "models/category"
require "models/post"
require "models/content"
require "models/destro... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/test/activejob/unloadable_base_job.rb | activerecord/test/activejob/unloadable_base_job.rb | # frozen_string_literal: true
class UnloadableBaseJob < PretendActiveJobIsNotPresent; end
| ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/test/activejob/job_runtime_test.rb | activerecord/test/activejob/job_runtime_test.rb | # frozen_string_literal: true
require "activejob/helper"
require "active_record/railties/job_runtime"
class JobRuntimeTest < ActiveSupport::TestCase
class TestJob < ActiveJob::Base
include ActiveRecord::Railties::JobRuntime
def perform(*)
ActiveRecord::RuntimeRegistry.stats.sql_runtime += 42.0
en... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/test/activejob/helper.rb | activerecord/test/activejob/helper.rb | # frozen_string_literal: true
require "cases/helper"
require "global_id"
GlobalID.app = "ActiveRecordExampleApp"
ActiveRecord::Base.include GlobalID::Identification
require "active_job"
ActiveJob::Base.queue_adapter = :test
ActiveJob::Base.logger = ActiveSupport::Logger.new(nil)
require_relative "../../../tools/tes... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/test/activejob/job_checkpoints_test.rb | activerecord/test/activejob/job_checkpoints_test.rb | # frozen_string_literal: true
require "activejob/helper"
require "active_job/continuable"
require "active_record/railties/job_checkpoints"
class JobCheckpointTest < ActiveSupport::TestCase
class CheckpointInTransactionJob < ActiveJob::Base
include ActiveJob::Continuable
include ActiveRecord::Railties::JobCh... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/test/active_record/connection_adapters/fake_legacy_adapter.rb | activerecord/test/active_record/connection_adapters/fake_legacy_adapter.rb | # frozen_string_literal: true
module ActiveRecord
module ConnectionHandling
def fake_legacy_connection(config)
ConnectionAdapters::FakeLegacyAdapter.new nil, logger
end
end
module ConnectionAdapters
class FakeLegacyAdapter < AbstractAdapter
def active?
true
end
end
en... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/test/active_record/connection_adapters/fake_misleading_legacy_adapter.rb | activerecord/test/active_record/connection_adapters/fake_misleading_legacy_adapter.rb | # frozen_string_literal: true
module ActiveRecord
module ConnectionAdapters
class FakeMisleadingLegacyAdapter < AbstractAdapter
end
end
end
| ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/test/schema/mysql2_specific_schema.rb | activerecord/test/schema/mysql2_specific_schema.rb | # frozen_string_literal: true
ActiveRecord::Schema.define do
create_table :datetime_defaults, force: true do |t|
t.datetime :modified_datetime, precision: nil, default: -> { "CURRENT_TIMESTAMP" }
t.datetime :precise_datetime, default: -> { "CURRENT_TIMESTAMP(6)" }
t.datetime :updated_datetime, default: -... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/test/schema/sqlite_specific_schema.rb | activerecord/test/schema/sqlite_specific_schema.rb | # frozen_string_literal: true
ActiveRecord::Schema.define do
create_table :defaults, force: true do |t|
t.integer :random_number, default: -> { "ABS(RANDOM())" }
t.string :ruby_on_rails, default: -> { "('Ruby ' || 'on ' || 'Rails')" }
t.date :modified_date, default: -> { "CURRENT_DATE" }
t.da... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/test/schema/postgresql_specific_schema.rb | activerecord/test/schema/postgresql_specific_schema.rb | # frozen_string_literal: true
ActiveRecord::Schema.define do
ActiveRecord::TestCase.enable_extension!("uuid-ossp", connection)
ActiveRecord::TestCase.enable_extension!("pgcrypto", connection) if supports_pgcrypto_uuid?
uuid_default = supports_pgcrypto_uuid? ? {} : { default: "uuid_generate_v4()" }
create_ta... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/test/schema/trilogy_specific_schema.rb | activerecord/test/schema/trilogy_specific_schema.rb | # frozen_string_literal: true
ActiveRecord::Schema.define do
create_table :datetime_defaults, force: true do |t|
t.datetime :modified_datetime, precision: nil, default: -> { "CURRENT_TIMESTAMP" }
t.datetime :precise_datetime, default: -> { "CURRENT_TIMESTAMP(6)" }
t.datetime :updated_datetime, default: -... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/test/schema/schema.rb | activerecord/test/schema/schema.rb | # frozen_string_literal: true
ActiveRecord::Schema.define do
# ------------------------------------------------------------------- #
# #
# Please keep these create table statements in alphabetical order #
# unless the ordering matters. ... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | true |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/examples/performance.rb | activerecord/examples/performance.rb | # frozen_string_literal: true
require "active_record"
require "benchmark/ips"
TIME = (ENV["BENCHMARK_TIME"] || 20).to_i
RECORDS = (ENV["BENCHMARK_RECORDS"] || TIME * 1000).to_i
conn = { adapter: "sqlite3", database: ":memory:" }
ActiveRecord::Base.establish_connection(conn)
class User < ActiveRecord::Base
con... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/examples/simple.rb | activerecord/examples/simple.rb | # frozen_string_literal: true
require "active_record"
class Person < ActiveRecord::Base
establish_connection adapter: "sqlite3", database: "foobar.db"
connection.create_table table_name, force: true do |t|
t.string :name
end
end
bob = Person.create!(name: "bob")
puts Person.all.inspect
bob.destroy
puts Per... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/lib/active_record.rb | activerecord/lib/active_record.rb | # frozen_string_literal: true
#--
# Copyright (c) David Heinemeier Hansson
#
# 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... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/lib/arel.rb | activerecord/lib/arel.rb | # frozen_string_literal: true
require "arel/errors"
require "arel/crud"
require "arel/factory_methods"
require "arel/expressions"
require "arel/predications"
require "arel/filter_predications"
require "arel/window_predications"
require "arel/math"
require "arel/alias_predication"
require "arel/order_predications"
re... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/lib/rails/generators/active_record.rb | activerecord/lib/rails/generators/active_record.rb | # frozen_string_literal: true
require "rails/generators/named_base"
require "rails/generators/active_model"
require "rails/generators/active_record/migration"
require "active_record"
module ActiveRecord
module Generators # :nodoc:
class Base < Rails::Generators::NamedBase # :nodoc:
include ActiveRecord::G... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/lib/rails/generators/active_record/migration.rb | activerecord/lib/rails/generators/active_record/migration.rb | # frozen_string_literal: true
require "rails/generators/migration"
module ActiveRecord
module Generators # :nodoc:
module Migration
extend ActiveSupport::Concern
include Rails::Generators::Migration
module ClassMethods
# Implement the required interface for Rails::Generators::Migratio... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/lib/rails/generators/active_record/model/model_generator.rb | activerecord/lib/rails/generators/active_record/model/model_generator.rb | # frozen_string_literal: true
require "rails/generators/active_record"
module ActiveRecord
module Generators # :nodoc:
class ModelGenerator < Base # :nodoc:
argument :attributes, type: :array, default: [], banner: "field[:type][:index] field[:type][:index]"
check_class_collision
class_option... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/lib/rails/generators/active_record/multi_db/multi_db_generator.rb | activerecord/lib/rails/generators/active_record/multi_db/multi_db_generator.rb | # frozen_string_literal: true
require "rails/generators/active_record"
module ActiveRecord
module Generators # :nodoc:
class MultiDbGenerator < ::Rails::Generators::Base # :nodoc:
source_root File.expand_path("templates", __dir__)
def create_multi_db
filename = "multi_db.rb"
templat... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/lib/rails/generators/active_record/application_record/application_record_generator.rb | activerecord/lib/rails/generators/active_record/application_record/application_record_generator.rb | # frozen_string_literal: true
require "rails/generators/active_record"
module ActiveRecord
module Generators # :nodoc:
class ApplicationRecordGenerator < ::Rails::Generators::Base # :nodoc:
source_root File.expand_path("templates", __dir__)
# FIXME: Change this file to a symlink once RubyGems 2.5.0... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/lib/rails/generators/active_record/migration/migration_generator.rb | activerecord/lib/rails/generators/active_record/migration/migration_generator.rb | # frozen_string_literal: true
require "rails/generators/active_record"
module ActiveRecord
module Generators # :nodoc:
class MigrationGenerator < Base # :nodoc:
argument :attributes, type: :array, default: [], banner: "field[:type][:index] field[:type][:index]"
class_option :timestamps, type: :bool... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/lib/arel/predications.rb | activerecord/lib/arel/predications.rb | # frozen_string_literal: true
module Arel # :nodoc: all
module Predications
def not_eq(other)
Nodes::NotEqual.new self, quoted_node(other)
end
def not_eq_any(others)
grouping_any :not_eq, others
end
def not_eq_all(others)
grouping_all :not_eq, others
end
def eq(other)... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/lib/arel/table.rb | activerecord/lib/arel/table.rb | # frozen_string_literal: true
module Arel # :nodoc: all
class Table
include Arel::FactoryMethods
include Arel::AliasPredication
@engine = nil
class << self; attr_accessor :engine; end
attr_accessor :name
attr_reader :table_alias
def initialize(name, as: nil, klass: nil, type_caster: kl... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/lib/arel/errors.rb | activerecord/lib/arel/errors.rb | # frozen_string_literal: true
module Arel # :nodoc: all
class ArelError < StandardError
end
class EmptyJoinError < ArelError
end
class BindError < ArelError
def initialize(message, sql = nil)
if sql
super("#{message} in: #{sql.inspect}")
else
super(message)
end
end... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/lib/arel/nodes.rb | activerecord/lib/arel/nodes.rb | # frozen_string_literal: true
# node
require "arel/nodes/node"
require "arel/nodes/node_expression"
require "arel/nodes/select_statement"
require "arel/nodes/select_core"
require "arel/nodes/insert_statement"
require "arel/nodes/update_statement"
require "arel/nodes/bind_param"
require "arel/nodes/fragments"
# termin... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/lib/arel/math.rb | activerecord/lib/arel/math.rb | # frozen_string_literal: true
module Arel # :nodoc: all
module Math
def *(other)
Arel::Nodes::Multiplication.new(self, other)
end
def +(other)
Arel::Nodes::Grouping.new(Arel::Nodes::Addition.new(self, other))
end
def -(other)
Arel::Nodes::Grouping.new(Arel::Nodes::Subtraction.... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/lib/arel/expressions.rb | activerecord/lib/arel/expressions.rb | # frozen_string_literal: true
module Arel # :nodoc: all
module Expressions
def count(distinct = false)
Nodes::Count.new [self], distinct
end
def sum
Nodes::Sum.new [self]
end
def maximum
Nodes::Max.new [self]
end
def minimum
Nodes::Min.new [self]
end
de... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/lib/arel/tree_manager.rb | activerecord/lib/arel/tree_manager.rb | # frozen_string_literal: true
module Arel # :nodoc: all
class TreeManager
include Arel::FactoryMethods
module StatementMethods
def take(limit)
@ast.limit = Nodes::Limit.new(Nodes.build_quoted(limit)) if limit
self
end
def offset(offset)
@ast.offset = Nodes::Offset.... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/lib/arel/update_manager.rb | activerecord/lib/arel/update_manager.rb | # frozen_string_literal: true
module Arel # :nodoc: all
class UpdateManager < Arel::TreeManager
include TreeManager::StatementMethods
def initialize(table = nil)
@ast = Nodes::UpdateStatement.new(table)
end
###
# UPDATE +table+
def table(table)
@ast.relation = table
self
... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/lib/arel/crud.rb | activerecord/lib/arel/crud.rb | # frozen_string_literal: true
module Arel # :nodoc: all
###
# FIXME hopefully we can remove this
module Crud
def compile_insert(values)
im = create_insert
im.insert values
im
end
def create_insert
InsertManager.new
end
def compile_update(values, key = nil)
um =... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/lib/arel/delete_manager.rb | activerecord/lib/arel/delete_manager.rb | # frozen_string_literal: true
module Arel # :nodoc: all
class DeleteManager < Arel::TreeManager
include TreeManager::StatementMethods
def initialize(table = nil)
@ast = Nodes::DeleteStatement.new(table)
end
def from(relation)
@ast.relation = relation
self
end
def group(co... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/lib/arel/factory_methods.rb | activerecord/lib/arel/factory_methods.rb | # frozen_string_literal: true
module Arel # :nodoc: all
###
# Methods for creating various nodes
module FactoryMethods
def create_true
Arel::Nodes::True.new
end
def create_false
Arel::Nodes::False.new
end
def create_table_alias(relation, name)
Nodes::TableAlias.new(relatio... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/lib/arel/window_predications.rb | activerecord/lib/arel/window_predications.rb | # frozen_string_literal: true
module Arel # :nodoc: all
module WindowPredications
def over(expr = nil)
Nodes::Over.new(self, expr)
end
end
end
| ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/lib/arel/filter_predications.rb | activerecord/lib/arel/filter_predications.rb | # frozen_string_literal: true
module Arel # :nodoc: all
module FilterPredications
def filter(expr)
Nodes::Filter.new(self, expr)
end
end
end
| ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/lib/arel/insert_manager.rb | activerecord/lib/arel/insert_manager.rb | # frozen_string_literal: true
module Arel # :nodoc: all
class InsertManager < Arel::TreeManager
def initialize(table = nil)
@ast = Nodes::InsertStatement.new(table)
end
def into(table)
@ast.relation = table
self
end
def columns; @ast.columns end
def values=(val); @ast.valu... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/lib/arel/alias_predication.rb | activerecord/lib/arel/alias_predication.rb | # frozen_string_literal: true
module Arel # :nodoc: all
module AliasPredication
def as(other)
other = other.name if other.is_a?(Symbol)
Nodes::As.new self, Nodes::SqlLiteral.new(other, retryable: true)
end
end
end
| ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/lib/arel/visitors.rb | activerecord/lib/arel/visitors.rb | # frozen_string_literal: true
require "arel/visitors/visitor"
require "arel/visitors/to_sql"
require "arel/visitors/sqlite"
require "arel/visitors/postgresql"
require "arel/visitors/mysql"
require "arel/visitors/dot"
module Arel # :nodoc: all
module Visitors
end
end
| ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/lib/arel/select_manager.rb | activerecord/lib/arel/select_manager.rb | # frozen_string_literal: true
module Arel # :nodoc: all
class SelectManager < Arel::TreeManager
include Arel::Crud
STRING_OR_SYMBOL_CLASS = [Symbol, String]
def initialize(table = nil)
@ast = Nodes::SelectStatement.new(table)
@ctx = @ast.cores.last
end
def initialize_copy(other)
... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/lib/arel/order_predications.rb | activerecord/lib/arel/order_predications.rb | # frozen_string_literal: true
module Arel # :nodoc: all
module OrderPredications
def asc
Nodes::Ascending.new self
end
def desc
Nodes::Descending.new self
end
end
end
| ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/lib/arel/nodes/right_outer_join.rb | activerecord/lib/arel/nodes/right_outer_join.rb | # frozen_string_literal: true
module Arel # :nodoc: all
module Nodes
class RightOuterJoin < Arel::Nodes::Join
end
end
end
| ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/lib/arel/nodes/leading_join.rb | activerecord/lib/arel/nodes/leading_join.rb | # frozen_string_literal: true
module Arel # :nodoc: all
module Nodes
class LeadingJoin < Arel::Nodes::InnerJoin
end
end
end
| ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/lib/arel/nodes/join_source.rb | activerecord/lib/arel/nodes/join_source.rb | # frozen_string_literal: true
module Arel # :nodoc: all
module Nodes
###
# Class that represents a join source
#
# https://www.sqlite.org/syntaxdiagrams.html#join-source
class JoinSource < Arel::Nodes::Binary
def initialize(single_source, joinop = [])
super
end
def e... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/lib/arel/nodes/update_statement.rb | activerecord/lib/arel/nodes/update_statement.rb | # frozen_string_literal: true
module Arel # :nodoc: all
module Nodes
class UpdateStatement < Arel::Nodes::Node
attr_accessor :relation, :wheres, :values, :groups, :havings, :orders, :limit, :offset, :comment, :key
def initialize(relation = nil)
super()
@relation = relation
@w... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/lib/arel/nodes/extract.rb | activerecord/lib/arel/nodes/extract.rb | # frozen_string_literal: true
module Arel # :nodoc: all
module Nodes
class Extract < Arel::Nodes::Unary
attr_accessor :field
def initialize(expr, field)
super(expr)
@field = field
end
def hash
super ^ @field.hash
end
def eql?(other)
super &&
... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/lib/arel/nodes/delete_statement.rb | activerecord/lib/arel/nodes/delete_statement.rb | # frozen_string_literal: true
module Arel # :nodoc: all
module Nodes
class DeleteStatement < Arel::Nodes::Node
attr_accessor :relation, :wheres, :groups, :havings, :orders, :limit, :offset, :comment, :key
def initialize(relation = nil, wheres = [])
super()
@relation = relation
... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/lib/arel/nodes/ascending.rb | activerecord/lib/arel/nodes/ascending.rb | # frozen_string_literal: true
module Arel # :nodoc: all
module Nodes
class Ascending < Ordering
def reverse
Descending.new(expr)
end
def direction
:asc
end
def ascending?
true
end
def descending?
false
end
end
end
end
| ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/lib/arel/nodes/binary.rb | activerecord/lib/arel/nodes/binary.rb | # frozen_string_literal: true
module Arel # :nodoc: all
module Nodes
class Binary < Arel::Nodes::NodeExpression
attr_accessor :left, :right
def initialize(left, right)
super()
@left = left
@right = right
end
def initialize_copy(other)
super
@left... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/lib/arel/nodes/count.rb | activerecord/lib/arel/nodes/count.rb | # frozen_string_literal: true
module Arel # :nodoc: all
module Nodes
class Count < Arel::Nodes::Function
def initialize(expr, distinct = false)
super(expr)
@distinct = distinct
end
end
end
end
| ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/lib/arel/nodes/named_function.rb | activerecord/lib/arel/nodes/named_function.rb | # frozen_string_literal: true
module Arel # :nodoc: all
module Nodes
class NamedFunction < Arel::Nodes::Function
attr_accessor :name
def initialize(name, expr)
super(expr)
@name = name
end
def hash
super ^ @name.hash
end
def eql?(other)
super... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/lib/arel/nodes/insert_statement.rb | activerecord/lib/arel/nodes/insert_statement.rb | # frozen_string_literal: true
module Arel # :nodoc: all
module Nodes
class InsertStatement < Arel::Nodes::Node
attr_accessor :relation, :columns, :values, :select
def initialize(relation = nil)
super()
@relation = relation
@columns = []
@values = nil
@selec... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/lib/arel/nodes/unary_operation.rb | activerecord/lib/arel/nodes/unary_operation.rb | # frozen_string_literal: true
module Arel # :nodoc: all
module Nodes
class UnaryOperation < Unary
attr_reader :operator
def initialize(operator, operand)
super(operand)
@operator = operator
end
end
class BitwiseNot < UnaryOperation
def initialize(operand)
... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/lib/arel/nodes/full_outer_join.rb | activerecord/lib/arel/nodes/full_outer_join.rb | # frozen_string_literal: true
module Arel # :nodoc: all
module Nodes
class FullOuterJoin < Arel::Nodes::Join
end
end
end
| ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/lib/arel/nodes/in.rb | activerecord/lib/arel/nodes/in.rb | # frozen_string_literal: true
module Arel # :nodoc: all
module Nodes
class In < Arel::Nodes::Binary
include FetchAttribute
def equality?; true; end
def invert
Arel::Nodes::NotIn.new(left, right)
end
end
end
end
| ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/lib/arel/nodes/inner_join.rb | activerecord/lib/arel/nodes/inner_join.rb | # frozen_string_literal: true
module Arel # :nodoc: all
module Nodes
class InnerJoin < Arel::Nodes::Join
end
end
end
| ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/lib/arel/nodes/select_statement.rb | activerecord/lib/arel/nodes/select_statement.rb | # frozen_string_literal: true
module Arel # :nodoc: all
module Nodes
class SelectStatement < Arel::Nodes::NodeExpression
attr_reader :cores
attr_accessor :limit, :orders, :lock, :offset, :with
def initialize(relation = nil)
super()
@cores = [SelectCore.new(relation)]
... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/lib/arel/nodes/over.rb | activerecord/lib/arel/nodes/over.rb | # frozen_string_literal: true
module Arel # :nodoc: all
module Nodes
class Over < Binary
include Arel::AliasPredication
def initialize(left, right = nil)
super(left, right)
end
def operator; "OVER" end
end
end
end
| ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/lib/arel/nodes/nary.rb | activerecord/lib/arel/nodes/nary.rb | # frozen_string_literal: true
module Arel # :nodoc: all
module Nodes
class Nary < Arel::Nodes::NodeExpression
attr_reader :children
def initialize(children)
super()
@children = children
end
def left
children.first
end
def right
children[1]
... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/lib/arel/nodes/window.rb | activerecord/lib/arel/nodes/window.rb | # frozen_string_literal: true
module Arel # :nodoc: all
module Nodes
class Window < Arel::Nodes::Node
attr_accessor :orders, :framing, :partitions
def initialize
@orders = []
@partitions = []
@framing = nil
end
def order(*expr)
# FIXME: We SHOULD NOT be c... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/lib/arel/nodes/node.rb | activerecord/lib/arel/nodes/node.rb | # frozen_string_literal: true
module Arel # :nodoc: all
module Nodes
# = Using +Arel::Nodes::Node+
#
# Active Record uses Arel to compose SQL statements. Instead of building SQL strings directly, it's building an
# abstract syntax tree (AST) of the statement using various types of Arel::Nodes::Node. ... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activerecord/lib/arel/nodes/filter.rb | activerecord/lib/arel/nodes/filter.rb | # frozen_string_literal: true
module Arel # :nodoc: all
module Nodes
class Filter < Binary
include Arel::WindowPredications
include Arel::AliasPredication
end
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.