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/activestorage/test/models/presence_validation_test.rb | activestorage/test/models/presence_validation_test.rb | # frozen_string_literal: true
require "test_helper"
require "database/setup"
class ActiveStorage::PresenceValidationTest < ActiveSupport::TestCase
class Admin < User; end
teardown do
Admin.clear_validators!
end
test "validates_presence_of has_one_attached" do
Admin.validates_presence_of :avatar
... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activestorage/test/models/variant_with_record_test.rb | activestorage/test/models/variant_with_record_test.rb | # frozen_string_literal: true
require "test_helper"
require "database/setup"
class ActiveStorage::VariantWithRecordTest < ActiveSupport::TestCase
include ActiveJob::TestHelper
setup do
@was_tracking, ActiveStorage.track_variants = ActiveStorage.track_variants, true
end
teardown do
ActiveStorage.trac... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activestorage/test/models/preview_test.rb | activestorage/test/models/preview_test.rb | # frozen_string_literal: true
require "test_helper"
require "database/setup"
class ActiveStorage::PreviewTest < ActiveSupport::TestCase
test "previewing a PDF" do
blob = create_file_blob(filename: "report.pdf", content_type: "application/pdf")
preview = blob.preview(resize_to_limit: [640, 280]).processed
... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activestorage/test/models/representation_test.rb | activestorage/test/models/representation_test.rb | # frozen_string_literal: true
require "test_helper"
require "database/setup"
class ActiveStorage::RepresentationTest < ActiveSupport::TestCase
test "representing an image" do
blob = create_file_blob
representation = blob.representation(resize_to_limit: [100, 100]).processed
image = read_image(represent... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activestorage/test/models/attached/many_test.rb | activestorage/test/models/attached/many_test.rb | # frozen_string_literal: true
require "test_helper"
require "database/setup"
class ActiveStorage::ManyAttachedTest < ActiveSupport::TestCase
include ActiveJob::TestHelper
setup do
@user = User.create!(name: "Josh")
end
teardown do
ActiveStorage::Blob.all.each(&:delete)
end
test "attaching exist... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | true |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activestorage/test/models/attached/one_test.rb | activestorage/test/models/attached/one_test.rb | # frozen_string_literal: true
require "test_helper"
require "database/setup"
require "active_support/testing/method_call_assertions"
class ActiveStorage::OneAttachedTest < ActiveSupport::TestCase
include ActiveJob::TestHelper
include ActiveSupport::Testing::MethodCallAssertions
setup do
@user = User.create... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activestorage/test/analyzer/video_analyzer_test.rb | activestorage/test/analyzer/video_analyzer_test.rb | # frozen_string_literal: true
require "test_helper"
require "database/setup"
require "active_storage/analyzer/video_analyzer"
class ActiveStorage::Analyzer::VideoAnalyzerTest < ActiveSupport::TestCase
test "analyzing a video" do
blob = create_file_blob(filename: "video.mp4", content_type: "video/mp4")
meta... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activestorage/test/analyzer/audio_analyzer_test.rb | activestorage/test/analyzer/audio_analyzer_test.rb | # frozen_string_literal: true
require "test_helper"
require "database/setup"
require "active_storage/analyzer/audio_analyzer"
class ActiveStorage::Analyzer::AudioAnalyzerTest < ActiveSupport::TestCase
test "analyzing an audio" do
blob = create_file_blob(filename: "audio.mp3", content_type: "audio/mp3")
met... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activestorage/test/analyzer/image_analyzer/vips_test.rb | activestorage/test/analyzer/image_analyzer/vips_test.rb | # frozen_string_literal: true
require "test_helper"
require "database/setup"
require "active_storage/analyzer/image_analyzer"
class ActiveStorage::Analyzer::ImageAnalyzer::VipsTest < ActiveSupport::TestCase
test "analyzing a JPEG image" do
analyze_with_vips do
blob = create_file_blob(filename: "racecar.j... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activestorage/test/analyzer/image_analyzer/image_magick_test.rb | activestorage/test/analyzer/image_analyzer/image_magick_test.rb | # frozen_string_literal: true
require "test_helper"
require "database/setup"
require "active_storage/analyzer/image_analyzer"
class ActiveStorage::Analyzer::ImageAnalyzer::ImageMagickTest < ActiveSupport::TestCase
test "analyzing a JPEG image" do
analyze_with_image_magick do
blob = create_file_blob(filen... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activestorage/test/dummy/app/jobs/application_job.rb | activestorage/test/dummy/app/jobs/application_job.rb | class ApplicationJob < ActiveJob::Base
# Automatically retry jobs that encountered a deadlock
# retry_on ActiveRecord::Deadlocked
# Most jobs are safe to ignore if the underlying records are no longer available
# discard_on ActiveJob::DeserializationError
end
| ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activestorage/test/dummy/app/helpers/application_helper.rb | activestorage/test/dummy/app/helpers/application_helper.rb | module ApplicationHelper
end
| ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activestorage/test/dummy/app/controllers/application_controller.rb | activestorage/test/dummy/app/controllers/application_controller.rb | class ApplicationController < ActionController::Base
end
| ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activestorage/test/dummy/app/models/application_record.rb | activestorage/test/dummy/app/models/application_record.rb | class ApplicationRecord < ActiveRecord::Base
primary_abstract_class
end
| ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activestorage/test/dummy/app/mailers/application_mailer.rb | activestorage/test/dummy/app/mailers/application_mailer.rb | class ApplicationMailer < ActionMailer::Base
default from: "from@example.com"
layout "mailer"
end
| ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activestorage/test/dummy/app/channels/application_cable/channel.rb | activestorage/test/dummy/app/channels/application_cable/channel.rb | module ApplicationCable
class Channel < ActionCable::Channel::Base
end
end
| ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activestorage/test/dummy/app/channels/application_cable/connection.rb | activestorage/test/dummy/app/channels/application_cable/connection.rb | module ApplicationCable
class Connection < ActionCable::Connection::Base
end
end
| ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activestorage/test/dummy/config/application.rb | activestorage/test/dummy/config/application.rb | require_relative "boot"
require "rails/all"
# Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(*Rails.groups)
module Dummy
class Application < Rails::Application
config.load_defaults Rails::VERSION::STRING.to_f
# For compatibil... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activestorage/test/dummy/config/environment.rb | activestorage/test/dummy/config/environment.rb | # Load the Rails application.
require_relative "application"
# Initialize the Rails application.
Rails.application.initialize!
| ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activestorage/test/dummy/config/puma.rb | activestorage/test/dummy/config/puma.rb | # This configuration file will be evaluated by Puma. The top-level methods that
# are invoked here are part of Puma's configuration DSL. For more information
# about methods provided by the DSL, see https://puma.io/puma/Puma/DSL.html.
# Puma can serve each request in a thread from an internal thread pool.
# The `threa... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activestorage/test/dummy/config/routes.rb | activestorage/test/dummy/config/routes.rb | Rails.application.routes.draw do
end
| ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activestorage/test/dummy/config/boot.rb | activestorage/test/dummy/config/boot.rb | # Set up gems listed in the Gemfile.
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../../../Gemfile", __dir__)
require "bundler/setup" if File.exist?(ENV["BUNDLE_GEMFILE"])
$LOAD_PATH.unshift File.expand_path("../../../lib", __dir__)
| ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activestorage/test/dummy/config/initializers/content_security_policy.rb | activestorage/test/dummy/config/initializers/content_security_policy.rb | # Be sure to restart your server when you modify this file.
# Define an application-wide content security policy.
# See the Securing Rails Applications Guide for more information:
# https://guides.rubyonrails.org/security.html#content-security-policy-header
# Rails.application.configure do
# config.content_security... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activestorage/test/dummy/config/initializers/filter_parameter_logging.rb | activestorage/test/dummy/config/initializers/filter_parameter_logging.rb | # Be sure to restart your server when you modify this file.
# Configure parameters to be filtered from the log file. Use this to limit dissemination of
# sensitive information. See the ActiveSupport::ParameterFilter documentation for supported
# notations and behaviors.
Rails.application.config.filter_parameters += [
... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activestorage/test/dummy/config/initializers/inflections.rb | activestorage/test/dummy/config/initializers/inflections.rb | # Be sure to restart your server when you modify this file.
# Add new inflection rules using the following format. Inflections
# are locale specific, and you may define rules for as many different
# locales as you wish. All of these examples are active by default:
# ActiveSupport::Inflector.inflections(:en) do |inflec... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activestorage/test/dummy/config/initializers/assets.rb | activestorage/test/dummy/config/initializers/assets.rb | # Be sure to restart your server when you modify this file.
# Version of your assets, change this if you want to expire all your assets.
Rails.application.config.assets.version = "1.0"
# Add additional assets to the asset load path.
# Rails.application.config.assets.paths << Emoji.images_path
# Precompile additional... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activestorage/test/dummy/config/environments/test.rb | activestorage/test/dummy/config/environments/test.rb | require "active_support/core_ext/integer/time"
# The test environment is used exclusively to run your application's
# test suite. You never need to work with it otherwise. Remember that
# your test database is "scratch space" for the test suite and is wiped
# and recreated between test runs. Don't rely on the data the... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activestorage/test/dummy/config/environments/development.rb | activestorage/test/dummy/config/environments/development.rb | require "active_support/core_ext/integer/time"
Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# In the development environment your application's code is reloaded any time
# it changes. This slows down response time but is perfect for developme... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activestorage/test/dummy/config/environments/production.rb | activestorage/test/dummy/config/environments/production.rb | require "active_support/core_ext/integer/time"
Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# Code is not reloaded between requests.
config.enable_reloading = false
# Eager load code on boot. This eager loads most of Rails and
# your app... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activestorage/test/template/video_tag_test.rb | activestorage/test/template/video_tag_test.rb | # frozen_string_literal: true
require "test_helper"
require "database/setup"
class ActiveStorage::VideoTagTest < ActionView::TestCase
tests ActionView::Helpers::AssetTagHelper
setup do
@blob = create_file_blob filename: "video.mp4"
end
test "blob" do
assert_dom_equal %(<video src="#{polymorphic_url ... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activestorage/test/template/audio_tag_test.rb | activestorage/test/template/audio_tag_test.rb | # frozen_string_literal: true
require "test_helper"
require "database/setup"
class ActiveStorage::AudioTagTest < ActionView::TestCase
tests ActionView::Helpers::AssetTagHelper
setup do
@blob = create_file_blob filename: "audio.mp3"
end
test "blob" do
assert_dom_equal %(<audio src="#{polymorphic_url ... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activestorage/test/template/image_tag_test.rb | activestorage/test/template/image_tag_test.rb | # frozen_string_literal: true
require "test_helper"
require "database/setup"
class ActiveStorage::ImageTagTest < ActionView::TestCase
tests ActionView::Helpers::AssetTagHelper
setup do
@blob = create_file_blob filename: "racecar.jpg"
end
test "blob" do
assert_dom_equal %(<img src="#{polymorphic_url ... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activestorage/test/database/create_users_migration.rb | activestorage/test/database/create_users_migration.rb | # frozen_string_literal: true
class ActiveStorageCreateUsers < ActiveRecord::Migration[5.2]
def change
create_table :users do |t|
t.string :name
t.integer :group_id
t.timestamps
end
end
end
| ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activestorage/test/database/setup.rb | activestorage/test/database/setup.rb | # frozen_string_literal: true
require_relative "create_users_migration"
require_relative "create_groups_migration"
# Writing and reading roles are required for the "previewing on the writer DB" test
ActiveRecord::Base.connects_to(database: { writing: :primary, reading: :replica })
ActiveRecord::Base.connection_pool.m... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activestorage/test/database/create_groups_migration.rb | activestorage/test/database/create_groups_migration.rb | # frozen_string_literal: true
class ActiveStorageCreateGroups < ActiveRecord::Migration[6.0]
def change
create_table :groups do |t|
end
end
end
| ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activestorage/test/urls/rails_storage_proxy_url_test.rb | activestorage/test/urls/rails_storage_proxy_url_test.rb | # frozen_string_literal: true
require "test_helper"
require "database/setup"
class RailsStorageProxyUrlTest < ActiveSupport::TestCase
include Rails.application.routes.url_helpers
setup do
@blob = create_file_blob filename: "racecar.jpg"
@was_resolve_model_to_route, ActiveStorage.resolve_model_to_route = ... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activestorage/test/urls/rails_storage_redirect_url_test.rb | activestorage/test/urls/rails_storage_redirect_url_test.rb | # frozen_string_literal: true
require "test_helper"
require "database/setup"
class RailsStorageRedirectUrlTest < ActiveSupport::TestCase
include Rails.application.routes.url_helpers
setup do
@blob = create_file_blob filename: "racecar.jpg"
@was_resolve_model_to_route, ActiveStorage.resolve_model_to_route... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activestorage/lib/active_storage.rb | activestorage/lib/active_storage.rb | # frozen_string_literal: true
#--
# Copyright (c) David Heinemeier Hansson, 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 limitatio... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activestorage/lib/active_storage/version.rb | activestorage/lib/active_storage/version.rb | # frozen_string_literal: true
require_relative "gem_version"
module ActiveStorage
# Returns the currently loaded version of Active Storage 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/activestorage/lib/active_storage/log_subscriber.rb | activestorage/lib/active_storage/log_subscriber.rb | # frozen_string_literal: true
require "active_support/log_subscriber"
module ActiveStorage
class LogSubscriber < ActiveSupport::EventReporter::LogSubscriber # :nodoc:
self.namespace = "active_storage"
def service_upload(event)
message = "Uploaded file to key: #{key_in(event)}"
message += " (che... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activestorage/lib/active_storage/errors.rb | activestorage/lib/active_storage/errors.rb | # frozen_string_literal: true
module ActiveStorage
# Generic base class for all Active Storage exceptions.
class Error < StandardError; end
# Raised when ActiveStorage::Blob#variant is called on a blob that isn't variable.
# Use ActiveStorage::Blob#variable? to determine whether a blob is variable.
class In... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activestorage/lib/active_storage/previewer.rb | activestorage/lib/active_storage/previewer.rb | # frozen_string_literal: true
module ActiveStorage
# = Active Storage \Previewer
#
# This is an abstract base class for previewers, which generate images from blobs. See
# ActiveStorage::Previewer::MuPDFPreviewer and ActiveStorage::Previewer::VideoPreviewer for
# examples of concrete subclasses.
class Prev... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activestorage/lib/active_storage/structured_event_subscriber.rb | activestorage/lib/active_storage/structured_event_subscriber.rb | # frozen_string_literal: true
require "active_support/structured_event_subscriber"
module ActiveStorage
class StructuredEventSubscriber < ActiveSupport::StructuredEventSubscriber # :nodoc:
def service_upload(event)
emit_event("active_storage.service_upload",
key: event.payload[:key],
check... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activestorage/lib/active_storage/reflection.rb | activestorage/lib/active_storage/reflection.rb | # frozen_string_literal: true
module ActiveStorage
module Reflection
class HasAttachedReflection < ActiveRecord::Reflection::MacroReflection # :nodoc:
def variant(name, transformations)
named_variants[name] = NamedVariant.new(transformations)
end
def named_variants
@named_varia... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activestorage/lib/active_storage/attached.rb | activestorage/lib/active_storage/attached.rb | # frozen_string_literal: true
module ActiveStorage
# = Active Storage \Attached
#
# Abstract base class for the concrete ActiveStorage::Attached::One and ActiveStorage::Attached::Many
# classes that both provide proxy access to the blob association for a record.
class Attached
attr_reader :name, :record... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activestorage/lib/active_storage/analyzer.rb | activestorage/lib/active_storage/analyzer.rb | # frozen_string_literal: true
module ActiveStorage
# = Active Storage \Analyzer
#
# This is an abstract base class for analyzers, which extract metadata from blobs. See
# ActiveStorage::Analyzer::VideoAnalyzer for an example of a concrete subclass.
class Analyzer
attr_reader :blob
# Implement this m... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activestorage/lib/active_storage/service.rb | activestorage/lib/active_storage/service.rb | # frozen_string_literal: true
require "active_storage/log_subscriber"
require "active_storage/structured_event_subscriber"
require "active_storage/downloader"
require "action_dispatch"
require "action_dispatch/http/content_disposition"
module ActiveStorage
# = Active Storage \Service
#
# Abstract class serving ... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activestorage/lib/active_storage/deprecator.rb | activestorage/lib/active_storage/deprecator.rb | # frozen_string_literal: true
module ActiveStorage
def self.deprecator # :nodoc:
@deprecator ||= ActiveSupport::Deprecation.new
end
end
| ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activestorage/lib/active_storage/fixture_set.rb | activestorage/lib/active_storage/fixture_set.rb | # frozen_string_literal: true
require "active_support/testing/file_fixtures"
require "active_record/secure_token"
module ActiveStorage
# = Active Storage \FixtureSet
#
# Fixtures are a way of organizing data that you want to test against; in
# short, sample data.
#
# To learn more about fixtures, read the... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activestorage/lib/active_storage/engine.rb | activestorage/lib/active_storage/engine.rb | # frozen_string_literal: true
require "rails"
require "action_controller/railtie"
require "active_job/railtie"
require "active_record/railtie"
require "active_storage"
require "active_storage/previewer/poppler_pdf_previewer"
require "active_storage/previewer/mupdf_previewer"
require "active_storage/previewer/video_p... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activestorage/lib/active_storage/gem_version.rb | activestorage/lib/active_storage/gem_version.rb | # frozen_string_literal: true
module ActiveStorage
# Returns the currently loaded version of Active Storage as a +Gem::Version+.
def self.gem_version
Gem::Version.new VERSION::STRING
end
module VERSION
MAJOR = 8
MINOR = 2
TINY = 0
PRE = "alpha"
STRING = [MAJOR, MINOR, TINY, PRE].co... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activestorage/lib/active_storage/downloader.rb | activestorage/lib/active_storage/downloader.rb | # frozen_string_literal: true
module ActiveStorage
class Downloader # :nodoc:
attr_reader :service
def initialize(service)
@service = service
end
def open(key, checksum: nil, verify: true, name: "ActiveStorage-", tmpdir: nil, &block)
tempfile = Tempfile.new(name, tmpdir, binmode: true)
... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activestorage/lib/active_storage/service/disk_service.rb | activestorage/lib/active_storage/service/disk_service.rb | # frozen_string_literal: true
require "fileutils"
require "pathname"
require "openssl"
require "active_support/core_ext/numeric/bytes"
module ActiveStorage
# = Active Storage \Disk \Service
#
# Wraps a local disk path as an Active Storage service. See ActiveStorage::Service for the generic API
# documentation... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activestorage/lib/active_storage/service/registry.rb | activestorage/lib/active_storage/service/registry.rb | # frozen_string_literal: true
module ActiveStorage
class Service::Registry # :nodoc:
def initialize(configurations)
@configurations = configurations.deep_symbolize_keys
@services = {}
end
def fetch(name)
services.fetch(name.to_sym) do |key|
if configurations.include?(key)
... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activestorage/lib/active_storage/service/gcs_service.rb | activestorage/lib/active_storage/service/gcs_service.rb | # frozen_string_literal: true
gem "google-cloud-storage", "~> 1.11"
require "google/apis/iamcredentials_v1"
require "google/cloud/storage"
module ActiveStorage
# = Active Storage \GCS \Service
#
# Wraps the Google Cloud Storage as an Active Storage service. See ActiveStorage::Service for the generic API
# doc... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activestorage/lib/active_storage/service/mirror_service.rb | activestorage/lib/active_storage/service/mirror_service.rb | # frozen_string_literal: true
module ActiveStorage
# = Active Storage Mirror \Service
#
# Wraps a set of mirror services and provides a single ActiveStorage::Service object that will all
# have the files uploaded to them. A +primary+ service is designated to answer calls to:
# * +download+
# * +exists?+
... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activestorage/lib/active_storage/service/configurator.rb | activestorage/lib/active_storage/service/configurator.rb | # frozen_string_literal: true
module ActiveStorage
class Service::Configurator # :nodoc:
attr_reader :configurations
def self.build(service_name, configurations)
new(configurations).build(service_name)
end
def initialize(configurations)
@configurations = configurations.deep_symbolize_ke... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activestorage/lib/active_storage/service/s3_service.rb | activestorage/lib/active_storage/service/s3_service.rb | # frozen_string_literal: true
gem "aws-sdk-s3", "~> 1.48"
require "aws-sdk-s3"
require "active_support/core_ext/numeric/bytes"
module ActiveStorage
# = Active Storage \S3 \Service
#
# Wraps the Amazon Simple Storage Service (S3) as an Active Storage service.
# See ActiveStorage::Service for the generic API d... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activestorage/lib/active_storage/previewer/mupdf_previewer.rb | activestorage/lib/active_storage/previewer/mupdf_previewer.rb | # frozen_string_literal: true
module ActiveStorage
class Previewer::MuPDFPreviewer < Previewer
class << self
def accept?(blob)
pdf?(blob.content_type) && mutool_exists?
end
def pdf?(content_type)
Marcel::Magic.child? content_type, "application/pdf"
end
def mutool_p... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activestorage/lib/active_storage/previewer/video_previewer.rb | activestorage/lib/active_storage/previewer/video_previewer.rb | # frozen_string_literal: true
require "shellwords"
module ActiveStorage
class Previewer::VideoPreviewer < Previewer
class << self
def accept?(blob)
blob.video? && ffmpeg_exists?
end
def ffmpeg_exists?
return @ffmpeg_exists unless @ffmpeg_exists.nil?
@ffmpeg_exists = s... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activestorage/lib/active_storage/previewer/poppler_pdf_previewer.rb | activestorage/lib/active_storage/previewer/poppler_pdf_previewer.rb | # frozen_string_literal: true
module ActiveStorage
class Previewer::PopplerPDFPreviewer < Previewer
class << self
def accept?(blob)
pdf?(blob.content_type) && pdftoppm_exists?
end
def pdf?(content_type)
Marcel::Magic.child? content_type, "application/pdf"
end
def p... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activestorage/lib/active_storage/analyzer/image_analyzer.rb | activestorage/lib/active_storage/analyzer/image_analyzer.rb | # frozen_string_literal: true
module ActiveStorage
# = Active Storage Image \Analyzer
#
# This is an abstract base class for image analyzers, which extract width and height from an image blob.
#
# If the image contains EXIF data indicating its angle is 90 or 270 degrees, its width and height are swapped for ... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activestorage/lib/active_storage/analyzer/video_analyzer.rb | activestorage/lib/active_storage/analyzer/video_analyzer.rb | # frozen_string_literal: true
module ActiveStorage
# = Active Storage Video \Analyzer
#
# Extracts the following from a video blob:
#
# * Width (pixels)
# * Height (pixels)
# * Duration (seconds)
# * Angle (degrees)
# * Display aspect ratio
# * Audio (true if file has an audio channel, false if not... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activestorage/lib/active_storage/analyzer/audio_analyzer.rb | activestorage/lib/active_storage/analyzer/audio_analyzer.rb | # frozen_string_literal: true
module ActiveStorage
# = Active Storage Audio \Analyzer
#
# Extracts duration (seconds), bit_rate (bits/s), sample_rate (hertz) and tags (internal metadata) from an audio blob.
#
# Example:
#
# ActiveStorage::Analyzer::AudioAnalyzer.new(blob).metadata
# # => { duration... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activestorage/lib/active_storage/analyzer/null_analyzer.rb | activestorage/lib/active_storage/analyzer/null_analyzer.rb | # frozen_string_literal: true
module ActiveStorage
class Analyzer::NullAnalyzer < Analyzer # :nodoc:
def self.accept?(blob)
true
end
def self.analyze_later?
false
end
def metadata
{}
end
end
end
| ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activestorage/lib/active_storage/analyzer/image_analyzer/vips.rb | activestorage/lib/active_storage/analyzer/image_analyzer/vips.rb | # frozen_string_literal: true
begin
require "nokogiri"
rescue LoadError
# Ensure nokogiri is loaded before vips, which also depends on libxml2.
# See Nokogiri RFC: Stop exporting symbols:
# https://github.com/sparklemotion/nokogiri/discussions/2746
end
begin
gem "ruby-vips"
require "ruby-vips"
ActiveS... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activestorage/lib/active_storage/analyzer/image_analyzer/image_magick.rb | activestorage/lib/active_storage/analyzer/image_analyzer/image_magick.rb | # frozen_string_literal: true
begin
gem "mini_magick"
require "mini_magick"
ActiveStorage::MINIMAGICK_AVAILABLE = true # :nodoc:
rescue LoadError => error
ActiveStorage::MINIMAGICK_AVAILABLE = false # :nodoc:
raise error unless error.message.include?("mini_magick")
end
module ActiveStorage
# This analyzer... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activestorage/lib/active_storage/attached/one.rb | activestorage/lib/active_storage/attached/one.rb | # frozen_string_literal: true
module ActiveStorage
# = Active Storage \Attached \One
#
# Representation of a single attachment to a model.
class Attached::One < Attached
##
# :method: purge
#
# Directly purges the attachment (i.e. destroys the blob and
# attachment and deletes the file on t... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activestorage/lib/active_storage/attached/changes.rb | activestorage/lib/active_storage/attached/changes.rb | # frozen_string_literal: true
module ActiveStorage
module Attached::Changes # :nodoc:
extend ActiveSupport::Autoload
eager_autoload do
autoload :CreateOne
autoload :CreateMany
autoload :CreateOneOfMany
autoload :DeleteOne
autoload :DeleteMany
autoload :DetachOne
a... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activestorage/lib/active_storage/attached/many.rb | activestorage/lib/active_storage/attached/many.rb | # frozen_string_literal: true
module ActiveStorage
# = Active Storage \Attached \Many
#
# Decorated proxy object representing of multiple attachments to a model.
class Attached::Many < Attached
##
# :method: purge
#
# Directly purges each associated attachment (i.e. destroys the blobs and
#... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activestorage/lib/active_storage/attached/model.rb | activestorage/lib/active_storage/attached/model.rb | # frozen_string_literal: true
require "active_support/core_ext/object/try"
module ActiveStorage
# = Active Storage \Attached \Model
#
# Provides the class-level DSL for declaring an Active Record model's attachments.
module Attached::Model
extend ActiveSupport::Concern
##
# :method: *_attachment
... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activestorage/lib/active_storage/attached/changes/purge_one.rb | activestorage/lib/active_storage/attached/changes/purge_one.rb | # frozen_string_literal: true
module ActiveStorage
class Attached::Changes::PurgeOne # :nodoc:
attr_reader :name, :record, :attachment
def initialize(name, record, attachment)
@name, @record, @attachment = name, record, attachment
end
def purge
attachment&.purge
reset
end
... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activestorage/lib/active_storage/attached/changes/detach_one.rb | activestorage/lib/active_storage/attached/changes/detach_one.rb | # frozen_string_literal: true
module ActiveStorage
class Attached::Changes::DetachOne # :nodoc:
attr_reader :name, :record, :attachment
def initialize(name, record, attachment)
@name, @record, @attachment = name, record, attachment
end
def detach
if attachment.present?
attachmen... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activestorage/lib/active_storage/attached/changes/purge_many.rb | activestorage/lib/active_storage/attached/changes/purge_many.rb | # frozen_string_literal: true
module ActiveStorage
class Attached::Changes::PurgeMany # :nodoc:
attr_reader :name, :record, :attachments
def initialize(name, record, attachments)
@name, @record, @attachments = name, record, attachments
end
def purge
attachments.each(&:purge)
reset... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activestorage/lib/active_storage/attached/changes/detach_many.rb | activestorage/lib/active_storage/attached/changes/detach_many.rb | # frozen_string_literal: true
module ActiveStorage
class Attached::Changes::DetachMany # :nodoc:
attr_reader :name, :record, :attachments
def initialize(name, record, attachments)
@name, @record, @attachments = name, record, attachments
end
def detach
if attachments.any?
attachm... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activestorage/lib/active_storage/attached/changes/create_one_of_many.rb | activestorage/lib/active_storage/attached/changes/create_one_of_many.rb | # frozen_string_literal: true
module ActiveStorage
class Attached::Changes::CreateOneOfMany < Attached::Changes::CreateOne # :nodoc:
private
def find_attachment
if blob.persisted?
record.public_send("#{name}_attachments").detect { |attachment| attachment.blob_id == blob.id }
else
... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activestorage/lib/active_storage/attached/changes/create_one.rb | activestorage/lib/active_storage/attached/changes/create_one.rb | # frozen_string_literal: true
require "action_dispatch"
require "action_dispatch/http/upload"
module ActiveStorage
class Attached::Changes::CreateOne # :nodoc:
attr_reader :name, :record, :attachable
def initialize(name, record, attachable)
@name, @record, @attachable = name, record, attachable
... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activestorage/lib/active_storage/attached/changes/delete_many.rb | activestorage/lib/active_storage/attached/changes/delete_many.rb | # frozen_string_literal: true
module ActiveStorage
class Attached::Changes::DeleteMany # :nodoc:
attr_reader :name, :record
def initialize(name, record)
@name, @record = name, record
end
def attachables
[]
end
def attachments
ActiveStorage::Attachment.none
end
de... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activestorage/lib/active_storage/attached/changes/delete_one.rb | activestorage/lib/active_storage/attached/changes/delete_one.rb | # frozen_string_literal: true
module ActiveStorage
class Attached::Changes::DeleteOne # :nodoc:
attr_reader :name, :record
def initialize(name, record)
@name, @record = name, record
end
def attachment
nil
end
def analyze
# Nothing to analyze when deleting
end
def... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activestorage/lib/active_storage/attached/changes/create_many.rb | activestorage/lib/active_storage/attached/changes/create_many.rb | # frozen_string_literal: true
module ActiveStorage
class Attached::Changes::CreateMany # :nodoc:
attr_reader :name, :record, :attachables, :pending_uploads
def initialize(name, record, attachables, pending_uploads: [])
@name, @record, @attachables = name, record, Array(attachables)
blobs.each(&:... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activestorage/lib/active_storage/transformers/null_transformer.rb | activestorage/lib/active_storage/transformers/null_transformer.rb | # frozen_string_literal: true
module ActiveStorage
module Transformers
class NullTransformer < Transformer # :nodoc:
private
def process(file, format:)
file
end
end
end
end
| ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activestorage/lib/active_storage/transformers/transformer.rb | activestorage/lib/active_storage/transformers/transformer.rb | # frozen_string_literal: true
module ActiveStorage
module Transformers
# = Active Storage \Transformers \Transformer
#
# A Transformer applies a set of transformations to an image.
#
# The following concrete subclasses are included in Active Storage:
#
# * ActiveStorage::Transformers::Ima... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activestorage/lib/active_storage/transformers/image_processing_transformer.rb | activestorage/lib/active_storage/transformers/image_processing_transformer.rb | # frozen_string_literal: true
begin
require "image_processing"
rescue LoadError
raise LoadError, <<~ERROR.squish
Generating image variants require the image_processing gem.
Please add `gem "image_processing", "~> 1.2"` to your Gemfile.
ERROR
end
module ActiveStorage
module Transformers
class Image... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activestorage/lib/active_storage/transformers/vips.rb | activestorage/lib/active_storage/transformers/vips.rb | # frozen_string_literal: true
module ActiveStorage
module Transformers
class Vips < ImageProcessingTransformer
def processor
ImageProcessing::Vips
end
end
end
end
| ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activestorage/lib/active_storage/transformers/image_magick.rb | activestorage/lib/active_storage/transformers/image_magick.rb | # frozen_string_literal: true
module ActiveStorage
module Transformers
class ImageMagick < ImageProcessingTransformer
private
def processor
ImageProcessing::MiniMagick
end
def validate_transformation(name, argument)
method_name = name.to_s.tr("-", "_")
... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activestorage/config/routes.rb | activestorage/config/routes.rb | # frozen_string_literal: true
Rails.application.routes.draw do
scope ActiveStorage.routes_prefix do
get "/blobs/redirect/:signed_id/*filename" => "active_storage/blobs/redirect#show", as: :rails_service_blob
get "/blobs/proxy/:signed_id/*filename" => "active_storage/blobs/proxy#show", as: :rails_service_blob... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/tools/test.rb | tools/test.rb | # frozen_string_literal: true
$: << File.expand_path("test", COMPONENT_ROOT)
require "bundler/setup"
require "rails/test_unit/runner"
require "rails/test_unit/reporter"
require "rails/test_unit/line_filtering"
require "active_support"
require "active_support/test_case"
ActiveSupport::TestCase.extend Rails::LineFilt... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/tools/test_common.rb | tools/test_common.rb | # frozen_string_literal: true
require_relative "support/leak_checker"
ActiveSupport::TestCase.alias_method :force_skip, :skip
ENV["RAILS_TEST_EXECUTABLE"] = "bin/test"
if ENV["BUILDKITE"]
ENV.delete("CI") # CI has affect on the applications, and we don't want it applied to the apps.
module DisableSkipping # :no... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/tools/strict_warnings.rb | tools/strict_warnings.rb | # frozen_string_literal: true
$VERBOSE = true
Warning[:deprecated] = true
module RailsStrictWarnings # :nodoc:
class WarningError < StandardError; end
PROJECT_ROOT = File.expand_path("../", __dir__)
ALLOWED_WARNINGS = Regexp.union(
/circular require considered harmful.*delayed_job/, # Bug in delayed job.
... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/tools/preview_docs.rb | tools/preview_docs.rb | # frozen_string_literal: true
require "active_support/core_ext/string/output_safety"
# How to test:
#
# export BUILDKITE_COMMIT="c8b601a225"
# export BUILDKITE_BUILD_CREATOR="zzak"
# export BUILDKITE_REPO="https://github.com/rails/rails.git"
# export BUILDKITE_BUILD_NUMBER="60"
# export BUILDKITE_BUILD_URL=... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/tools/cve_announcement.rb | tools/cve_announcement.rb | # frozen_string_literal: true
require "net/http"
require "json"
require "uri"
def versions_section(advisory)
desc = +""
advisory[:vulnerabilities].each do |vuln|
package = vuln[:package][:name]
bad_versions = vuln[:vulnerable_version_range]
patched_versions = vuln[:patched_versions]
desc << "* #{p... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/tools/releaser/test/test_helper.rb | tools/releaser/test/test_helper.rb | # frozen_string_literal: true
$LOAD_PATH.unshift File.expand_path("../lib", __dir__)
require "releaser"
require "minitest/autorun"
| ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/tools/releaser/test/releaser_test.rb | tools/releaser/test/releaser_test.rb | # frozen_string_literal: true
require "test_helper"
class TestReleaser < Minitest::Test
def test_framework_list
assert_equal(
[
"activesupport",
"activemodel",
"activerecord",
"actionview",
"actionpack",
"activejob",
"actionmailer",
"actionca... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/tools/releaser/test/fixtures/activestorage/lib/active_storage/gem_version.rb | tools/releaser/test/fixtures/activestorage/lib/active_storage/gem_version.rb | # frozen_string_literal: true
module ActiveStorage
# Returns the currently loaded version of \Rails as a +Gem::Version+.
def self.gem_version
Gem::Version.new VERSION::STRING
end
module VERSION
MAJOR = 1
MINOR = 0
TINY = 0
PRE = "alpha"
STRING = [MAJOR, MINOR, TINY, PRE].compact.jo... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/tools/releaser/lib/releaser.rb | tools/releaser/lib/releaser.rb | # frozen_string_literal: true
require "json"
require "digest"
require "rake/tasklib"
class Releaser < Rake::TaskLib
# Order dependent. E.g. Action Mailbox depends on Active Record so it should be after.
FRAMEWORKS = %w(
activesupport
activemodel
activerecord
actionview
actionpack
activejob... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/tools/support/leak_checker.rb | tools/support/leak_checker.rb | # frozen_string_literal: true
module LeakChecker
# These keys are out of our control.
# Either added by the system or by other libraries.
ALLOWED_KEYS = %w[
VIPSHOME
]
def before_setup
@__leak_checker_before_env = ENV.to_h
super
end
def after_teardown
super
after = ENV.to_h
bef... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/tools/rail_inspector/test/test_helper.rb | tools/rail_inspector/test/test_helper.rb | # frozen_string_literal: true
require "active_support"
require "minitest/autorun"
| ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/tools/rail_inspector/test/test_helpers/changelog_fixtures.rb | tools/rail_inspector/test/test_helpers/changelog_fixtures.rb | # frozen_string_literal: true
require "pathname"
require "rail_inspector/changelog"
module ChangelogFixtures
def changelog_fixture(name)
path = Pathname.new(File.expand_path("../fixtures/#{name}", __dir__))
raise ArgumentError, "#{name} fixture not found" unless path.exist?
RailInspector::Changelog.ne... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/tools/rail_inspector/test/rail_inspector/changelog_test.rb | tools/rail_inspector/test/rail_inspector/changelog_test.rb | # frozen_string_literal: true
require "rail_inspector/changelog"
require "test/test_helpers/changelog_fixtures"
class TestChangelog < Minitest::Test
include ChangelogFixtures
def test_parses_changelog_file
@changelog = changelog_fixture("railties_06e9fbd.md")
assert_equal 21, entries.length
end
def... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/tools/rail_inspector/test/rail_inspector/visitor/hash_to_string_test.rb | tools/rail_inspector/test/rail_inspector/visitor/hash_to_string_test.rb | # frozen_string_literal: true
require "test_helper"
require "rail_inspector/visitor/hash_to_string"
class HashToStringTest < Minitest::Test
def test_basic_hash_to_s
basic_hash = "{ a: 1 }"
assert_equal basic_hash, string_for(basic_hash)
end
def test_nested_hash_to_s
nested_hash = "{ hsts: { subdom... | 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.