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 |
|---|---|---|---|---|---|---|---|---|
CanineHQ/canine | https://github.com/CanineHQ/canine/blob/f5c94561cbc487892b393a3aa57409beeea96c62/config/initializers/filter_parameter_logging.rb | config/initializers/filter_parameter_logging.rb | # Be sure to restart your server when you modify this file.
# Configure parameters to be partially matched (e.g. passw matches password) and filtered from the log file.
# Use this to limit dissemination of sensitive information.
# See the ActiveSupport::ParameterFilter documentation for supported notations and behavio... | ruby | Apache-2.0 | f5c94561cbc487892b393a3aa57409beeea96c62 | 2026-01-04T15:53:12.976830Z | false |
CanineHQ/canine | https://github.com/CanineHQ/canine/blob/f5c94561cbc487892b393a3aa57409beeea96c62/config/initializers/avo.rb | config/initializers/avo.rb | # For more information regarding these settings check out our docs https://docs.avohq.io
# The values disaplayed here are the default ones. Uncomment and change them to fit your needs.
Avo.configure do |config|
## == Routing ==
config.root_path = '/admin'
# used only when you have custom `map` configuration in yo... | ruby | Apache-2.0 | f5c94561cbc487892b393a3aa57409beeea96c62 | 2026-01-04T15:53:12.976830Z | false |
CanineHQ/canine | https://github.com/CanineHQ/canine/blob/f5c94561cbc487892b393a3aa57409beeea96c62/config/initializers/core_extensions.rb | config/initializers/core_extensions.rb | # frozen_string_literal: true
class Hash
# Converts hash to YAML without the document start marker (---)
def to_yaml_raw
to_yaml.sub(/\A---\n?/, "")
end
end
| ruby | Apache-2.0 | f5c94561cbc487892b393a3aa57409beeea96c62 | 2026-01-04T15:53:12.976830Z | false |
CanineHQ/canine | https://github.com/CanineHQ/canine/blob/f5c94561cbc487892b393a3aa57409beeea96c62/config/initializers/good_job.rb | config/initializers/good_job.rb | Rails.application.configure do
config.good_job = {
preserve_job_records: true,
retry_on_unhandled_error: false,
on_thread_error: ->(exception) { Rails.logger.error(exception) },
execution_mode: :external,
queues: '*',
max_threads: 5,
poll_interval: 30,
shutdown_timeout: 25,
enable_... | ruby | Apache-2.0 | f5c94561cbc487892b393a3aa57409beeea96c62 | 2026-01-04T15:53:12.976830Z | false |
CanineHQ/canine | https://github.com/CanineHQ/canine/blob/f5c94561cbc487892b393a3aa57409beeea96c62/config/initializers/friendly_id.rb | config/initializers/friendly_id.rb | # FriendlyId Global Configuration
#
# Use this to set up shared configuration options for your entire application.
# Any of the configuration options shown here can also be applied to single
# models by passing arguments to the `friendly_id` class method or defining
# methods in your model.
#
# To learn more, check out... | ruby | Apache-2.0 | f5c94561cbc487892b393a3aa57409beeea96c62 | 2026-01-04T15:53:12.976830Z | false |
CanineHQ/canine | https://github.com/CanineHQ/canine/blob/f5c94561cbc487892b393a3aa57409beeea96c62/config/initializers/devise.rb | config/initializers/devise.rb | # frozen_string_literal: true
# Assuming you have not yet modified this file, each configuration option below
# is set to its default value. Note that some are commented out while others
# are not: uncommented lines are intended to protect your configuration from
# breaking changes in upgrades (i.e., in the event that... | ruby | Apache-2.0 | f5c94561cbc487892b393a3aa57409beeea96c62 | 2026-01-04T15:53:12.976830Z | false |
CanineHQ/canine | https://github.com/CanineHQ/canine/blob/f5c94561cbc487892b393a3aa57409beeea96c62/config/initializers/pagy.rb | config/initializers/pagy.rb | require "pagy/extras/overflow"
Pagy::DEFAULT[:overflow] = :last_page
Pagy::DEFAULT[:size] = 7 # Show current page and 3 pages on each side
| ruby | Apache-2.0 | f5c94561cbc487892b393a3aa57409beeea96c62 | 2026-01-04T15:53:12.976830Z | false |
CanineHQ/canine | https://github.com/CanineHQ/canine/blob/f5c94561cbc487892b393a3aa57409beeea96c62/config/initializers/new_framework_defaults_7_2.rb | config/initializers/new_framework_defaults_7_2.rb | # Be sure to restart your server when you modify this file.
#
# This file eases your Rails 7.2 framework defaults upgrade.
#
# Uncomment each configuration one by one to switch to the new default.
# Once your application is ready to run with all new defaults, you can remove
# this file and set the `config.load_defaults... | ruby | Apache-2.0 | f5c94561cbc487892b393a3aa57409beeea96c62 | 2026-01-04T15:53:12.976830Z | false |
CanineHQ/canine | https://github.com/CanineHQ/canine/blob/f5c94561cbc487892b393a3aa57409beeea96c62/config/initializers/inflections.rb | 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 | Apache-2.0 | f5c94561cbc487892b393a3aa57409beeea96c62 | 2026-01-04T15:53:12.976830Z | false |
CanineHQ/canine | https://github.com/CanineHQ/canine/blob/f5c94561cbc487892b393a3aa57409beeea96c62/config/initializers/rswag_api.rb | config/initializers/rswag_api.rb | Rswag::Api.configure do |c|
# Specify a root folder where Swagger JSON files are located
# This is used by the Swagger middleware to serve requests for API descriptions
# NOTE: If you're using rswag-specs to generate Swagger, you'll need to ensure
# that it's configured to generate files in the same folder
c.... | ruby | Apache-2.0 | f5c94561cbc487892b393a3aa57409beeea96c62 | 2026-01-04T15:53:12.976830Z | false |
CanineHQ/canine | https://github.com/CanineHQ/canine/blob/f5c94561cbc487892b393a3aa57409beeea96c62/config/initializers/form_errors.rb | config/initializers/form_errors.rb | ActionView::Base.field_error_proc = proc do |html_tag, instance|
# This is the default Rails error wrapper, but it's not nice
# html = %(<div class="field_with_errors">#{html_tag}</div>).html_safe
html = ""
form_fields = [
"textarea",
"input",
"select"
]
elements = Nokogiri::HTML::DocumentFra... | ruby | Apache-2.0 | f5c94561cbc487892b393a3aa57409beeea96c62 | 2026-01-04T15:53:12.976830Z | false |
CanineHQ/canine | https://github.com/CanineHQ/canine/blob/f5c94561cbc487892b393a3aa57409beeea96c62/config/initializers/permissions_policy.rb | config/initializers/permissions_policy.rb | # Be sure to restart your server when you modify this file.
# Define an application-wide HTTP permissions policy. For further
# information see: https://developers.google.com/web/updates/2018/06/feature-policy
# Rails.application.config.permissions_policy do |policy|
# policy.camera :none
# policy.gyroscope ... | ruby | Apache-2.0 | f5c94561cbc487892b393a3aa57409beeea96c62 | 2026-01-04T15:53:12.976830Z | false |
CanineHQ/canine | https://github.com/CanineHQ/canine/blob/f5c94561cbc487892b393a3aa57409beeea96c62/config/initializers/flipper.rb | config/initializers/flipper.rb | Rails.application.configure do
## Memoization ensures that only one adapter call is made per feature per request.
## For more info, see https://www.flippercloud.io/docs/optimization#memoization
# config.flipper.memoize = true
## Flipper preloads all features before each request, which is recommended if:
## ... | ruby | Apache-2.0 | f5c94561cbc487892b393a3aa57409beeea96c62 | 2026-01-04T15:53:12.976830Z | false |
CanineHQ/canine | https://github.com/CanineHQ/canine/blob/f5c94561cbc487892b393a3aa57409beeea96c62/config/initializers/assets.rb | 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 | Apache-2.0 | f5c94561cbc487892b393a3aa57409beeea96c62 | 2026-01-04T15:53:12.976830Z | false |
CanineHQ/canine | https://github.com/CanineHQ/canine/blob/f5c94561cbc487892b393a3aa57409beeea96c62/config/initializers/sentry.rb | config/initializers/sentry.rb | if ENV['SENTRY_DSN'].present?
Sentry.init do |config|
config.dsn = ENV['SENTRY_DSN']
config.breadcrumbs_logger = [ :active_support_logger, :http_logger ]
config.excluded_exceptions += [ 'ActionDispatch::RemoteIp::IpSpoofAttackError' ]
end
end
| ruby | Apache-2.0 | f5c94561cbc487892b393a3aa57409beeea96c62 | 2026-01-04T15:53:12.976830Z | false |
CanineHQ/canine | https://github.com/CanineHQ/canine/blob/f5c94561cbc487892b393a3aa57409beeea96c62/config/routes/madmin.rb | config/routes/madmin.rb | # Below are the routes for madmin
namespace :madmin do
resources :add_ons
resources :builds
resources :clusters
namespace :active_storage do
resources :variant_records
end
namespace :active_storage do
resources :attachments
end
resources :providers
resources :cron_schedules
resources :deploy... | ruby | Apache-2.0 | f5c94561cbc487892b393a3aa57409beeea96c62 | 2026-01-04T15:53:12.976830Z | false |
CanineHQ/canine | https://github.com/CanineHQ/canine/blob/f5c94561cbc487892b393a3aa57409beeea96c62/config/environments/test.rb | 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 | Apache-2.0 | f5c94561cbc487892b393a3aa57409beeea96c62 | 2026-01-04T15:53:12.976830Z | false |
CanineHQ/canine | https://github.com/CanineHQ/canine/blob/f5c94561cbc487892b393a3aa57409beeea96c62/config/environments/development.rb | 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 | Apache-2.0 | f5c94561cbc487892b393a3aa57409beeea96c62 | 2026-01-04T15:53:12.976830Z | false |
CanineHQ/canine | https://github.com/CanineHQ/canine/blob/f5c94561cbc487892b393a3aa57409beeea96c62/config/environments/production.rb | 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 | Apache-2.0 | f5c94561cbc487892b393a3aa57409beeea96c62 | 2026-01-04T15:53:12.976830Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/.mdlrc.rb | .mdlrc.rb | # frozen_string_literal: true
all
exclude_rule "MD003"
exclude_rule "MD004"
exclude_rule "MD005"
exclude_rule "MD006"
exclude_rule "MD007"
exclude_rule "MD012"
exclude_rule "MD014"
exclude_rule "MD024"
exclude_rule "MD026"
exclude_rule "MD032"
exclude_rule "MD033"
exclude_rule "MD034"
exclude_rule "MD036"
exclude_rul... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/.github/workflows/scripts/test-container.rb | .github/workflows/scripts/test-container.rb | #!/usr/bin/env ruby
# frozen_string_literal: true
# Based on Sam Ruby's system test from dockerfile-rails:
# https://github.com/rubys/dockerfile-rails/pull/21
require "net/http"
require "socket"
LOCALHOST = Socket.gethostname
PORT = 3000
60.times do |i|
sleep 0.5
begin
response = Net::HTTP.get_response(LOCA... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/tasks/release.rb | tasks/release.rb | # frozen_string_literal: true
require "releaser"
root = File.expand_path("..", __dir__)
version = File.read("#{root}/RAILS_VERSION").strip
releaser = Releaser.new(root, version)
module Announcement
class Version
def initialize(version)
@version, @gem_version = version, Gem::Version.new(version)
en... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activestorage/app/jobs/active_storage/mirror_job.rb | activestorage/app/jobs/active_storage/mirror_job.rb | # frozen_string_literal: true
require "active_support/core_ext/object/try"
# Provides asynchronous mirroring of directly-uploaded blobs.
class ActiveStorage::MirrorJob < ActiveStorage::BaseJob
queue_as { ActiveStorage.queues[:mirror] }
discard_on ActiveStorage::FileNotFoundError
retry_on ActiveStorage::Integri... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activestorage/app/jobs/active_storage/transform_job.rb | activestorage/app/jobs/active_storage/transform_job.rb | # frozen_string_literal: true
class ActiveStorage::TransformJob < ActiveStorage::BaseJob
queue_as { ActiveStorage.queues[:transform] }
discard_on ActiveRecord::RecordNotFound
retry_on ActiveStorage::IntegrityError, attempts: 10, wait: :polynomially_longer
def perform(blob, transformations)
blob.represent... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activestorage/app/jobs/active_storage/purge_job.rb | activestorage/app/jobs/active_storage/purge_job.rb | # frozen_string_literal: true
# Provides asynchronous purging of ActiveStorage::Blob records via ActiveStorage::Blob#purge_later.
class ActiveStorage::PurgeJob < ActiveStorage::BaseJob
queue_as { ActiveStorage.queues[:purge] }
discard_on ActiveRecord::RecordNotFound
retry_on ActiveRecord::Deadlocked, attempts: ... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activestorage/app/jobs/active_storage/base_job.rb | activestorage/app/jobs/active_storage/base_job.rb | # frozen_string_literal: true
class ActiveStorage::BaseJob < ActiveJob::Base
end
| ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activestorage/app/jobs/active_storage/create_variants_job.rb | activestorage/app/jobs/active_storage/create_variants_job.rb | # frozen_string_literal: true
class ActiveStorage::CreateVariantsJob < ActiveStorage::BaseJob
queue_as { ActiveStorage.queues[:transform] }
discard_on ActiveRecord::RecordNotFound
retry_on ActiveStorage::IntegrityError, attempts: 10, wait: :polynomially_longer
def perform(blob, variants:, process:)
@blob... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activestorage/app/jobs/active_storage/analyze_job.rb | activestorage/app/jobs/active_storage/analyze_job.rb | # frozen_string_literal: true
# Provides asynchronous analysis of ActiveStorage::Blob records via ActiveStorage::Blob#analyze_later.
class ActiveStorage::AnalyzeJob < ActiveStorage::BaseJob
queue_as { ActiveStorage.queues[:analysis] }
discard_on ActiveRecord::RecordNotFound
retry_on ActiveStorage::IntegrityErro... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activestorage/app/jobs/active_storage/preview_image_job.rb | activestorage/app/jobs/active_storage/preview_image_job.rb | # frozen_string_literal: true
class ActiveStorage::PreviewImageJob < ActiveStorage::BaseJob
queue_as { ActiveStorage.queues[:preview_image] }
discard_on ActiveRecord::RecordNotFound, ActiveStorage::UnrepresentableError
retry_on ActiveStorage::IntegrityError, attempts: 10, wait: :polynomially_longer
def initi... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activestorage/app/controllers/concerns/active_storage/set_blob.rb | activestorage/app/controllers/concerns/active_storage/set_blob.rb | # frozen_string_literal: true
module ActiveStorage::SetBlob # :nodoc:
extend ActiveSupport::Concern
included do
before_action :set_blob
end
private
def set_blob
@blob = blob_scope.find_signed!(params[:signed_blob_id] || params[:signed_id])
rescue ActiveSupport::MessageVerifier::InvalidSigna... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activestorage/app/controllers/concerns/active_storage/set_current.rb | activestorage/app/controllers/concerns/active_storage/set_current.rb | # frozen_string_literal: true
# Sets the <tt>ActiveStorage::Current.url_options</tt> attribute, which the disk service uses to generate URLs.
# Include this concern in custom controllers that call ActiveStorage::Blob#url,
# ActiveStorage::Variant#url, or ActiveStorage::Preview#url so the disk service can
# generate UR... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activestorage/app/controllers/concerns/active_storage/disable_session.rb | activestorage/app/controllers/concerns/active_storage/disable_session.rb | # frozen_string_literal: true
# This concern disables the session in order to allow caching by default in some CDNs as CloudFlare.
module ActiveStorage::DisableSession
extend ActiveSupport::Concern
included do
before_action do
request.session_options[:skip] = true
end
end
end
| ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activestorage/app/controllers/concerns/active_storage/streaming.rb | activestorage/app/controllers/concerns/active_storage/streaming.rb | # frozen_string_literal: true
require "securerandom"
module ActiveStorage::Streaming
extend ActiveSupport::Concern
DEFAULT_BLOB_STREAMING_DISPOSITION = "inline"
include ActionController::DataStreaming
include ActionController::Live
private
# Stream the blob in byte ranges specified through the header
... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activestorage/app/controllers/concerns/active_storage/file_server.rb | activestorage/app/controllers/concerns/active_storage/file_server.rb | # frozen_string_literal: true
require "active_support/core_ext/hash/except"
module ActiveStorage::FileServer # :nodoc:
private
def serve_file(path, content_type:, disposition:)
::Rack::Files.new(nil).serving(request, path).tap do |(status, headers, body)|
self.status = status
self.response... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activestorage/app/controllers/active_storage/disk_controller.rb | activestorage/app/controllers/active_storage/disk_controller.rb | # frozen_string_literal: true
# Serves files stored with the disk service in the same way that the cloud services do.
# This means using expiring, signed URLs that are meant for immediate access, not permanent linking.
# Always go through the BlobsController, or your own authenticated controller, rather than directly
... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activestorage/app/controllers/active_storage/direct_uploads_controller.rb | activestorage/app/controllers/active_storage/direct_uploads_controller.rb | # frozen_string_literal: true
# Creates a new blob on the server side in anticipation of a direct-to-service upload from the client side.
# When the client-side upload is completed, the signed_blob_id can be submitted as part of the form to reference
# the blob that was created up front.
class ActiveStorage::DirectUpl... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activestorage/app/controllers/active_storage/base_controller.rb | activestorage/app/controllers/active_storage/base_controller.rb | # frozen_string_literal: true
# The base class for all Active Storage controllers.
class ActiveStorage::BaseController < ActionController::Base
include ActiveStorage::SetCurrent
protect_from_forgery with: :exception
self.etag_with_template_digest = false
end
| ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activestorage/app/controllers/active_storage/representations/proxy_controller.rb | activestorage/app/controllers/active_storage/representations/proxy_controller.rb | # frozen_string_literal: true
# Proxy files through application. This avoids having a redirect and makes files easier to cache.
#
# WARNING: All Active Storage controllers are publicly accessible by default. The
# generated URLs are hard to guess, but permanent by design. If your files
# require a higher level of prot... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activestorage/app/controllers/active_storage/representations/redirect_controller.rb | activestorage/app/controllers/active_storage/representations/redirect_controller.rb | # frozen_string_literal: true
# Take a signed permanent reference for a blob representation and turn it into an expiring service URL for download.
#
# WARNING: All Active Storage controllers are publicly accessible by default. The
# generated URLs are hard to guess, but permanent by design. If your files
# require a h... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activestorage/app/controllers/active_storage/representations/base_controller.rb | activestorage/app/controllers/active_storage/representations/base_controller.rb | # frozen_string_literal: true
class ActiveStorage::Representations::BaseController < ActiveStorage::BaseController # :nodoc:
include ActiveStorage::SetBlob
before_action :set_representation
private
def blob_scope
ActiveStorage::Blob.scope_for_strict_loading
end
def set_representation
@... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activestorage/app/controllers/active_storage/blobs/proxy_controller.rb | activestorage/app/controllers/active_storage/blobs/proxy_controller.rb | # frozen_string_literal: true
# Proxy files through application. This avoids having a redirect and makes files easier to cache.
#
# WARNING: All Active Storage controllers are publicly accessible by default. The
# generated URLs are hard to guess, but permanent by design. If your files
# require a higher level of prot... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activestorage/app/controllers/active_storage/blobs/redirect_controller.rb | activestorage/app/controllers/active_storage/blobs/redirect_controller.rb | # frozen_string_literal: true
# Take a signed permanent reference for a blob and turn it into an expiring service URL for download.
#
# WARNING: All Active Storage controllers are publicly accessible by default. The
# generated URLs are hard to guess, but permanent by design. If your files
# require a higher level of ... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activestorage/app/models/active_storage/current.rb | activestorage/app/models/active_storage/current.rb | # frozen_string_literal: true
class ActiveStorage::Current < ActiveSupport::CurrentAttributes # :nodoc:
attribute :url_options
end
| ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activestorage/app/models/active_storage/record.rb | activestorage/app/models/active_storage/record.rb | # frozen_string_literal: true
class ActiveStorage::Record < ActiveRecord::Base # :nodoc:
self.abstract_class = true
end
ActiveSupport.run_load_hooks :active_storage_record, ActiveStorage::Record
| ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activestorage/app/models/active_storage/variant_with_record.rb | activestorage/app/models/active_storage/variant_with_record.rb | # frozen_string_literal: true
# = Active Storage \Variant With Record
#
# Like an ActiveStorage::Variant, but keeps detail about the variant in the database as an
# ActiveStorage::VariantRecord. This is used if +ActiveStorage.track_variants+ is enabled.
class ActiveStorage::VariantWithRecord
include ActiveStorage::B... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activestorage/app/models/active_storage/variant.rb | activestorage/app/models/active_storage/variant.rb | # frozen_string_literal: true
# = Active Storage \Variant
#
# Image blobs can have variants that are the result of a set of transformations applied to the original.
# These variants are used to create thumbnails, fixed-size avatars, or any other derivative image from the
# original.
#
# Variants rely on {ImageProcessi... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activestorage/app/models/active_storage/preview.rb | activestorage/app/models/active_storage/preview.rb | # frozen_string_literal: true
# = Active Storage \Preview
#
# Some non-image blobs can be previewed: that is, they can be presented as images. A video blob can be previewed by
# extracting its first frame, and a PDF blob can be previewed by extracting its first page.
#
# A previewer extracts a preview image from a blo... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activestorage/app/models/active_storage/attachment.rb | activestorage/app/models/active_storage/attachment.rb | # frozen_string_literal: true
require "active_support/core_ext/module/delegation"
# = Active Storage \Attachment
#
# Attachments associate records with blobs. Usually that's a one record-many blobs relationship,
# but it is possible to associate many different records with the same blob. A foreign-key constraint
# on... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activestorage/app/models/active_storage/variant_record.rb | activestorage/app/models/active_storage/variant_record.rb | # frozen_string_literal: true
class ActiveStorage::VariantRecord < ActiveStorage::Record
belongs_to :blob
has_one_attached :image
end
ActiveSupport.run_load_hooks :active_storage_variant_record, ActiveStorage::VariantRecord
| ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activestorage/app/models/active_storage/named_variant.rb | activestorage/app/models/active_storage/named_variant.rb | # frozen_string_literal: true
class ActiveStorage::NamedVariant # :nodoc:
attr_reader :transformations, :preprocessed
def initialize(options)
@preprocessed = options[:preprocessed]
@process_option = options[:process]
@transformations = options.except(:preprocessed, :process)
if options.... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activestorage/app/models/active_storage/variation.rb | activestorage/app/models/active_storage/variation.rb | # frozen_string_literal: true
require "marcel"
# = Active Storage \Variation
#
# A set of transformations that can be applied to a blob to create a variant. This class is exposed via
# the ActiveStorage::Blob#variant method and should rarely be used directly.
#
# In case you do need to use this directly, it's instant... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activestorage/app/models/active_storage/filename.rb | activestorage/app/models/active_storage/filename.rb | # frozen_string_literal: true
# = Active Storage \Filename
#
# Encapsulates a string representing a filename to provide convenient access to parts of it and sanitization.
# A Filename instance is returned by ActiveStorage::Blob#filename, and is comparable so it can be used for sorting.
class ActiveStorage::Filename
... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activestorage/app/models/active_storage/blob.rb | activestorage/app/models/active_storage/blob.rb | # frozen_string_literal: true
# = Active Storage \Blob
#
# A blob is a record that contains the metadata about a file and a key for where that file resides on the service.
# Blobs can be created in two ways:
#
# 1. Ahead of the file being uploaded server-side to the service, via <tt>create_and_upload!</tt>. A rewindab... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activestorage/app/models/active_storage/blob/servable.rb | activestorage/app/models/active_storage/blob/servable.rb | # frozen_string_literal: true
module ActiveStorage::Blob::Servable # :nodoc:
def content_type_for_serving
forcibly_serve_as_binary? ? ActiveStorage.binary_content_type : content_type
end
def forced_disposition_for_serving
if forcibly_serve_as_binary? || !allowed_inline?
:attachment
end
end
... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activestorage/app/models/active_storage/blob/analyzable.rb | activestorage/app/models/active_storage/blob/analyzable.rb | # frozen_string_literal: true
require "active_storage/analyzer/null_analyzer"
# = Active Storage \Blob \Analyzable
module ActiveStorage::Blob::Analyzable
# Extracts and stores metadata from the file associated with this blob using a relevant analyzer. Active Storage comes
# with built-in analyzers for images and ... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activestorage/app/models/active_storage/blob/representable.rb | activestorage/app/models/active_storage/blob/representable.rb | # frozen_string_literal: true
require "marcel"
module ActiveStorage::Blob::Representable
extend ActiveSupport::Concern
included do
has_many :variant_records, class_name: "ActiveStorage::VariantRecord", dependent: false
before_destroy { variant_records.destroy_all if ActiveStorage.track_variants }
ha... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activestorage/app/models/active_storage/blob/identifiable.rb | activestorage/app/models/active_storage/blob/identifiable.rb | # frozen_string_literal: true
# = Active Storage \Blob \Identifiable
module ActiveStorage::Blob::Identifiable
def identify
identify_without_saving
save!
end
def identify_without_saving
unless identified?
self.content_type = identify_content_type
self.identified = true
end
end
de... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activestorage/db/update_migrate/20190112182829_add_service_name_to_active_storage_blobs.rb | activestorage/db/update_migrate/20190112182829_add_service_name_to_active_storage_blobs.rb | class AddServiceNameToActiveStorageBlobs < ActiveRecord::Migration[6.0]
def up
return unless table_exists?(:active_storage_blobs)
unless column_exists?(:active_storage_blobs, :service_name)
add_column :active_storage_blobs, :service_name, :string
if configured_service = ActiveStorage::Blob.servi... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activestorage/db/update_migrate/20211119233751_remove_not_null_on_active_storage_blobs_checksum.rb | activestorage/db/update_migrate/20211119233751_remove_not_null_on_active_storage_blobs_checksum.rb | class RemoveNotNullOnActiveStorageBlobsChecksum < ActiveRecord::Migration[6.0]
def change
return unless table_exists?(:active_storage_blobs)
change_column_null(:active_storage_blobs, :checksum, true)
end
end
| ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activestorage/db/update_migrate/20191206030411_create_active_storage_variant_records.rb | activestorage/db/update_migrate/20191206030411_create_active_storage_variant_records.rb | class CreateActiveStorageVariantRecords < ActiveRecord::Migration[6.0]
def change
return unless table_exists?(:active_storage_blobs)
# Use Active Record's configured type for primary key
create_table :active_storage_variant_records, id: primary_key_type, if_not_exists: true do |t|
t.belongs_to :blo... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activestorage/db/migrate/20170806125915_create_active_storage_tables.rb | activestorage/db/migrate/20170806125915_create_active_storage_tables.rb | class CreateActiveStorageTables < ActiveRecord::Migration[7.0]
def change
# Use Active Record's configured type for primary and foreign keys
primary_key_type, foreign_key_type = primary_and_foreign_key_types
create_table :active_storage_blobs, id: primary_key_type do |t|
t.string :key, n... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activestorage/test/structured_event_subscriber_test.rb | activestorage/test/structured_event_subscriber_test.rb | # frozen_string_literal: true
require "test_helper"
require "active_support/testing/event_reporter_assertions"
require "active_storage/structured_event_subscriber"
require "database/setup"
module ActiveStorage
class StructuredEventSubscriberTest < ActiveSupport::TestCase
include ActiveSupport::Testing::EventRep... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activestorage/test/log_subscriber_test.rb | activestorage/test/log_subscriber_test.rb | # frozen_string_literal: true
require "test_helper"
require "active_support/log_subscriber/test_helper"
require "active_support/testing/event_reporter_assertions"
require "active_storage/structured_event_subscriber"
require "active_storage/log_subscriber"
require "database/setup"
module ActiveStorage
class LogSubsc... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activestorage/test/service_test.rb | activestorage/test/service_test.rb | # frozen_string_literal: true
require "test_helper"
class ActiveStorage::ServiceTest < ActiveSupport::TestCase
test "inspect attributes" do
config = {
local: { service: "Disk", root: "/tmp/active_storage_service_test" },
tmp: { service: "Disk", root: "/tmp/active_storage_service_test_tmp" },
}
... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activestorage/test/migrations_test.rb | activestorage/test/migrations_test.rb | # frozen_string_literal: true
require "test_helper"
require "database/setup"
class ActiveStorage::MigrationsTest < ActiveSupport::TestCase
setup do
@original_verbose = ActiveRecord::Migration.verbose
ActiveRecord::Migration.verbose = false
@connection = ActiveRecord::Base.lease_connection
@original... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activestorage/test/test_helper.rb | activestorage/test/test_helper.rb | # frozen_string_literal: true
require_relative "../../tools/strict_warnings"
ENV["RAILS_ENV"] ||= "test"
require_relative "dummy/config/environment.rb"
require "bundler/setup"
require "active_support"
require "active_support/test_case"
require "active_support/core_ext/object/try"
require "active_support/testing/auto... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activestorage/test/fixture_set_test.rb | activestorage/test/fixture_set_test.rb | # frozen_string_literal: true
require "test_helper"
require "database/setup"
class ActiveStorage::FixtureSetTest < ActiveSupport::TestCase
fixtures :all
def test_active_storage_blob
user = users(:first)
avatar = user.avatar
assert_equal "image/jpeg+override", avatar.blob.content_type
assert_equ... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activestorage/test/javascript_package_test.rb | activestorage/test/javascript_package_test.rb | # frozen_string_literal: true
require "test_helper"
class JavascriptPackageTest < ActiveSupport::TestCase
def test_compiled_code_is_in_sync_with_source_code
compiled_files = %w[
app/assets/javascripts/activestorage.js
app/assets/javascripts/activestorage.esm.js
].map do |file|
Pathname(fil... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activestorage/test/engine_test.rb | activestorage/test/engine_test.rb | # frozen_string_literal: true
require "test_helper"
require "database/setup"
class ActiveStorage::EngineTest < ActiveSupport::TestCase
test "all default content types are recognized by marcel" do
ActiveStorage.variable_content_types.each do |content_type|
assert_equal content_type, Marcel::Magic.new(conte... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activestorage/test/jobs/analyze_job_test.rb | activestorage/test/jobs/analyze_job_test.rb | # frozen_string_literal: true
require "test_helper"
require "database/setup"
class ActiveStorage::AnalyzeJobTest < ActiveJob::TestCase
setup { @blob = create_blob }
test "ignores missing blob" do
@blob.purge
perform_enqueued_jobs do
assert_nothing_raised do
ActiveStorage::AnalyzeJob.perfor... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activestorage/test/jobs/transform_job_test.rb | activestorage/test/jobs/transform_job_test.rb | # frozen_string_literal: true
require "test_helper"
require "database/setup"
class ActiveStorage::TransformJobTest < ActiveJob::TestCase
setup { @blob = create_file_blob }
test "creates variant" do
transformations = { resize_to_limit: [100, 100] }
assert_changes -> { @blob.variant(transformations).proce... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activestorage/test/jobs/create_variants_job_test.rb | activestorage/test/jobs/create_variants_job_test.rb | # frozen_string_literal: true
require "test_helper"
require "database/setup"
class ActiveStorage::CreateVariantsJobTest < ActiveJob::TestCase
setup do
@variants = [{ resize_to_limit: [ 100, 100 ] }, { resize_to_limit: [ 200, 200 ] }]
end
test "creates preview when previewable" do
blob = create_file_blo... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activestorage/test/jobs/preview_image_job_test.rb | activestorage/test/jobs/preview_image_job_test.rb | # frozen_string_literal: true
require "test_helper"
require "database/setup"
class ActiveStorage::PreviewImageJobTest < ActiveJob::TestCase
setup do
@blob = create_file_blob(filename: "report.pdf", content_type: "application/pdf")
@transformation = { resize_to_limit: [ 100, 100 ] }
end
test "creates pr... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activestorage/test/jobs/purge_job_test.rb | activestorage/test/jobs/purge_job_test.rb | # frozen_string_literal: true
require "test_helper"
require "database/setup"
class ActiveStorage::PurgeJobTest < ActiveJob::TestCase
setup { @blob = create_blob }
test "purges" do
assert_difference -> { ActiveStorage::Blob.count }, -1 do
ActiveStorage::PurgeJob.perform_now @blob
end
assert_not... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activestorage/test/service/shared_service_tests.rb | activestorage/test/service/shared_service_tests.rb | # frozen_string_literal: true
require "test_helper"
require "active_support/core_ext/securerandom"
module ActiveStorage::Service::SharedServiceTests
extend ActiveSupport::Concern
FIXTURE_DATA = (+"\211PNG\r\n\032\n\000\000\000\rIHDR\000\000\000\020\000\000\000\020\001\003\000\000\000%=m\"\000\000\000\006PLTE\000... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activestorage/test/service/registry_test.rb | activestorage/test/service/registry_test.rb | # frozen_string_literal: true
require "test_helper"
class ActiveStorage::Service::RegistryTest < ActiveSupport::TestCase
test "inspect attributes" do
registry = ActiveStorage::Service::Registry.new({})
assert_match(/#<ActiveStorage::Service::Registry>/, registry.inspect)
end
test "inspect attributes wi... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activestorage/test/service/s3_public_service_test.rb | activestorage/test/service/s3_public_service_test.rb | # frozen_string_literal: true
require "service/shared_service_tests"
require "net/http"
require "database/setup"
if SERVICE_CONFIGURATIONS[:s3_public]
class ActiveStorage::Service::S3PublicServiceTest < ActiveSupport::TestCase
SERVICE = ActiveStorage::Service.configure(:s3_public, SERVICE_CONFIGURATIONS)
i... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activestorage/test/service/disk_service_test.rb | activestorage/test/service/disk_service_test.rb | # frozen_string_literal: true
require "service/shared_service_tests"
class ActiveStorage::Service::DiskServiceTest < ActiveSupport::TestCase
tmp_config = { tmp: { service: "Disk", root: File.join(Dir.tmpdir, "active_storage") } }
SERVICE = ActiveStorage::Service.configure(:tmp, tmp_config)
include ActiveStorag... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activestorage/test/service/disk_public_service_test.rb | activestorage/test/service/disk_public_service_test.rb | # frozen_string_literal: true
require "service/shared_service_tests"
require "net/http"
class ActiveStorage::Service::DiskPublicServiceTest < ActiveSupport::TestCase
tmp_config = {
tmp_public: { service: "Disk", root: File.join(Dir.tmpdir, "active_storage_public"), public: true }
}
SERVICE = ActiveStorage::... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activestorage/test/service/gcs_public_service_test.rb | activestorage/test/service/gcs_public_service_test.rb | # frozen_string_literal: true
require "service/shared_service_tests"
require "net/http"
if SERVICE_CONFIGURATIONS[:gcs_public]
class ActiveStorage::Service::GCSPublicServiceTest < ActiveSupport::TestCase
SERVICE = ActiveStorage::Service.configure(:gcs_public, SERVICE_CONFIGURATIONS)
include ActiveStorage::... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activestorage/test/service/s3_service_test.rb | activestorage/test/service/s3_service_test.rb | # frozen_string_literal: true
require "service/shared_service_tests"
require "net/http"
require "database/setup"
if SERVICE_CONFIGURATIONS[:s3]
class ActiveStorage::Service::S3ServiceTest < ActiveSupport::TestCase
SERVICE = ActiveStorage::Service.configure(:s3, SERVICE_CONFIGURATIONS)
include ActiveStorage... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activestorage/test/service/mirror_service_test.rb | activestorage/test/service/mirror_service_test.rb | # frozen_string_literal: true
require "service/shared_service_tests"
class ActiveStorage::Service::MirrorServiceTest < ActiveSupport::TestCase
mirror_config = (1..3).to_h do |i|
[ "mirror_#{i}",
service: "Disk",
root: Dir.mktmpdir("active_storage_tests_mirror_#{i}") ]
end
config = mirror_config... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activestorage/test/service/configurator_test.rb | activestorage/test/service/configurator_test.rb | # frozen_string_literal: true
require "service/shared_service_tests"
class ActiveStorage::Service::ConfiguratorTest < ActiveSupport::TestCase
test "builds correct service instance based on service name" do
service = ActiveStorage::Service::Configurator.build(:foo, foo: { service: "Disk", root: "path" })
ass... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activestorage/test/service/gcs_service_test.rb | activestorage/test/service/gcs_service_test.rb | # frozen_string_literal: true
require "service/shared_service_tests"
require "net/http"
if SERVICE_CONFIGURATIONS[:gcs]
class ActiveStorage::Service::GCSServiceTest < ActiveSupport::TestCase
SERVICE = ActiveStorage::Service.configure(:gcs, SERVICE_CONFIGURATIONS)
include ActiveStorage::Service::SharedServi... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activestorage/test/previewer/poppler_pdf_previewer_test.rb | activestorage/test/previewer/poppler_pdf_previewer_test.rb | # frozen_string_literal: true
require "test_helper"
require "database/setup"
require "active_storage/previewer/poppler_pdf_previewer"
class ActiveStorage::Previewer::PopplerPDFPreviewerTest < ActiveSupport::TestCase
test "previewing a PDF document" do
blob = create_file_blob(filename: "report.pdf", content_typ... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activestorage/test/previewer/mupdf_previewer_test.rb | activestorage/test/previewer/mupdf_previewer_test.rb | # frozen_string_literal: true
require "test_helper"
require "database/setup"
require "active_storage/previewer/mupdf_previewer"
class ActiveStorage::Previewer::MuPDFPreviewerTest < ActiveSupport::TestCase
test "previewing a PDF document" do
blob = create_file_blob(filename: "report.pdf", content_type: "applica... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activestorage/test/previewer/video_previewer_test.rb | activestorage/test/previewer/video_previewer_test.rb | # frozen_string_literal: true
require "test_helper"
require "database/setup"
require "active_storage/previewer/video_previewer"
class ActiveStorage::Previewer::VideoPreviewerTest < ActiveSupport::TestCase
test "previewing an MP4 video" do
blob = create_file_blob(filename: "video.mp4", content_type: "video/mp4"... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activestorage/test/controllers/disk_controller_test.rb | activestorage/test/controllers/disk_controller_test.rb | # frozen_string_literal: true
require "test_helper"
require "database/setup"
class ActiveStorage::DiskControllerTest < ActionDispatch::IntegrationTest
test "showing blob inline" do
blob = create_blob(filename: "hello.jpg", content_type: "image/jpeg")
get blob.url
assert_response :ok
assert_equal "i... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activestorage/test/controllers/direct_uploads_controller_test.rb | activestorage/test/controllers/direct_uploads_controller_test.rb | # frozen_string_literal: true
require "test_helper"
require "database/setup"
if SERVICE_CONFIGURATIONS[:s3] && SERVICE_CONFIGURATIONS[:s3][:access_key_id].present?
class ActiveStorage::S3DirectUploadsControllerTest < ActionDispatch::IntegrationTest
setup do
@old_service = ActiveStorage::Blob.service
... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activestorage/test/controllers/representations/proxy_controller_test.rb | activestorage/test/controllers/representations/proxy_controller_test.rb | # frozen_string_literal: true
require "test_helper"
require "database/setup"
require "minitest/mock"
class ActiveStorage::Representations::ProxyControllerWithVariantsTest < ActionDispatch::IntegrationTest
setup do
@blob = create_file_blob filename: "racecar.jpg"
@transformations = { resize_to_limit: [100, 1... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activestorage/test/controllers/representations/redirect_controller_test.rb | activestorage/test/controllers/representations/redirect_controller_test.rb | # frozen_string_literal: true
require "test_helper"
require "database/setup"
class ActiveStorage::Representations::RedirectControllerWithVariantsTest < ActionDispatch::IntegrationTest
setup do
@blob = create_file_blob filename: "racecar.jpg"
end
test "showing variant inline" do
get rails_blob_represent... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activestorage/test/controllers/blobs/proxy_controller_test.rb | activestorage/test/controllers/blobs/proxy_controller_test.rb | # frozen_string_literal: true
require "test_helper"
require "database/setup"
require "minitest/mock"
class ActiveStorage::Blobs::ProxyControllerTest < ActionDispatch::IntegrationTest
test "invalid signed ID" do
get rails_service_blob_proxy_url("invalid", "racecar.jpg")
assert_response :not_found
end
te... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activestorage/test/controllers/blobs/redirect_controller_test.rb | activestorage/test/controllers/blobs/redirect_controller_test.rb | # frozen_string_literal: true
require "test_helper"
require "database/setup"
class ActiveStorage::Blobs::RedirectControllerTest < ActionDispatch::IntegrationTest
setup do
@blob = create_file_blob filename: "racecar.jpg"
end
test "invalid signed ID" do
get rails_service_blob_url("invalid", "racecar.jpg"... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activestorage/test/models/strict_loading_test.rb | activestorage/test/models/strict_loading_test.rb | # frozen_string_literal: true
require "test_helper"
require "database/setup"
class ActiveStorage::StrictLoadingTest < ActiveSupport::TestCase
class Admin < User
has_one_attached :image, strict_loading: true
has_many_attached :images, strict_loading: true
end
setup do
Admin.create!(name: "David")
... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activestorage/test/models/attachment_test.rb | activestorage/test/models/attachment_test.rb | # frozen_string_literal: true
require "test_helper"
require "database/setup"
require "active_support/testing/method_call_assertions"
class ActiveStorage::AttachmentTest < ActiveSupport::TestCase
include ActiveJob::TestHelper
setup do
@user = User.create!(name: "Josh")
end
teardown { ActiveStorage::Blob.... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activestorage/test/models/named_variant_test.rb | activestorage/test/models/named_variant_test.rb | # frozen_string_literal: true
require "test_helper"
require "database/setup"
require "minitest/mock"
class ActiveStorage::NamedVariantTest < ActiveSupport::TestCase
setup do
@user = User.new(name: "joe")
end
test "explicity sets the process to immediate" do
named_variant = @user.attachment_reflections[... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activestorage/test/models/filename_test.rb | activestorage/test/models/filename_test.rb | # frozen_string_literal: true
require "test_helper"
class ActiveStorage::FilenameTest < ActiveSupport::TestCase
test "base" do
assert_equal "racecar", ActiveStorage::Filename.new("racecar.jpg").base
assert_equal "race.car", ActiveStorage::Filename.new("race.car.jpg").base
assert_equal "racecar", ActiveS... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activestorage/test/models/variant_test.rb | activestorage/test/models/variant_test.rb | # frozen_string_literal: true
require "test_helper"
require "database/setup"
require "minitest/mock"
class ActiveStorage::VariantTest < ActiveSupport::TestCase
setup do
@was_tracking, ActiveStorage.track_variants = ActiveStorage.track_variants, false
end
teardown do
ActiveStorage.track_variants = @was_... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activestorage/test/models/reflection_test.rb | activestorage/test/models/reflection_test.rb | # frozen_string_literal: true
require "test_helper"
class ActiveStorage::ReflectionTest < ActiveSupport::TestCase
test "reflecting on a singular attachment" do
reflection = User.reflect_on_attachment(:avatar)
assert_equal User, reflection.active_record
assert_equal :avatar, reflection.name
assert_eq... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activestorage/test/models/blob_test.rb | activestorage/test/models/blob_test.rb | # frozen_string_literal: true
require "test_helper"
require "database/setup"
require "active_support/testing/method_call_assertions"
class ActiveStorage::BlobTest < ActiveSupport::TestCase
include ActiveSupport::Testing::MethodCallAssertions
include ActiveJob::TestHelper
test "unattached scope" do
[ create... | 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.