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/railties/lib/rails/configuration.rb | railties/lib/rails/configuration.rb | # frozen_string_literal: true
require "active_support/ordered_options"
require "active_support/core_ext/object"
require "rails/paths"
require "rails/rack"
module Rails
module Configuration
# MiddlewareStackProxy is a proxy for the \Rails middleware stack that allows
# you to configure middlewares in your ap... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/railties/lib/rails/devtools_controller.rb | railties/lib/rails/devtools_controller.rb | # frozen_string_literal: true
require "active_support/core_ext/digest/uuid"
class Rails::DevtoolsController < ActionController::Base # :nodoc:
def show
root_path = Rails.root.to_s
uuid = Digest::UUID.uuid_v5(Digest::UUID::DNS_NAMESPACE, Rails.root.to_s)
render json: {
"workspace": {
"root... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/railties/lib/rails/cli.rb | railties/lib/rails/cli.rb | # frozen_string_literal: true
require "rails/app_loader"
# If we are inside a Rails application this method performs an exec and thus
# the rest of this script is not run.
Rails::AppLoader.exec_app
Signal.trap("INT") { puts; exit(1) }
require "rails/command"
case ARGV.first
when Rails::Command::HELP_MAPPINGS, "help... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/railties/lib/rails/info_controller.rb | railties/lib/rails/info_controller.rb | # frozen_string_literal: true
require "rails/application_controller"
require "action_dispatch/routing/inspector"
class Rails::InfoController < Rails::ApplicationController # :nodoc:
prepend_view_path ActionDispatch::DebugView::RESCUES_TEMPLATE_PATHS
layout -> { request.xhr? ? false : "application" }
before_act... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/railties/lib/rails/pwa_controller.rb | railties/lib/rails/pwa_controller.rb | # frozen_string_literal: true
require "rails/application_controller"
class Rails::PwaController < Rails::ApplicationController # :nodoc:
skip_forgery_protection
def service_worker
render template: "pwa/service-worker", layout: false
end
def manifest
render template: "pwa/manifest", layout: false
e... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/railties/lib/rails/backtrace_cleaner.rb | railties/lib/rails/backtrace_cleaner.rb | # frozen_string_literal: true
require "active_support/backtrace_cleaner"
require "active_support/core_ext/string/access"
module Rails
class BacktraceCleaner < ActiveSupport::BacktraceCleaner # :nodoc:
RENDER_TEMPLATE_PATTERN = /:in [`'].*_\w+_{2,3}\d+_\d+'/
def initialize
super
add_filter do |l... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/railties/lib/rails/commands.rb | railties/lib/rails/commands.rb | # frozen_string_literal: true
require "rails/command"
aliases = {
"g" => "generate",
"d" => "destroy",
"c" => "console",
"s" => "server",
"db" => "dbconsole",
"r" => "runner",
"t" => "test"
}
command = ARGV.shift
command = aliases[command] || command
Rails::Command.invoke command, ARGV
| ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/railties/lib/rails/source_annotation_extractor.rb | railties/lib/rails/source_annotation_extractor.rb | # frozen_string_literal: true
begin
require "prism"
rescue LoadError
# If Prism isn't available (because of using an older Ruby version) then we'll
# define a fallback for the ParserExtractor using ripper.
require "ripper"
end
module Rails
# Implements the logic behind +Rails::Command::NotesCommand+. See <t... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/railties/lib/rails/deprecator.rb | railties/lib/rails/deprecator.rb | # frozen_string_literal: true
module Rails
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/railties/lib/rails/tasks.rb | railties/lib/rails/tasks.rb | # frozen_string_literal: true
require "rake"
# Load Rails Rakefile extensions
%w(
framework
log
misc
tmp
yarn
zeitwerk
).each do |task|
load "rails/tasks/#{task}.rake"
end
| ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/railties/lib/rails/engine.rb | railties/lib/rails/engine.rb | # frozen_string_literal: true
require "rails/railtie"
require "rails/engine/railties"
require "active_support/callbacks"
require "active_support/core_ext/object/try"
require "pathname"
module Rails
# +Rails::Engine+ allows you to wrap a specific \Rails application or subset of
# functionality and share it with ot... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/railties/lib/rails/gem_version.rb | railties/lib/rails/gem_version.rb | # frozen_string_literal: true
module Rails
# Returns the currently loaded version of \Rails 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].compact.join(".")
... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/railties/lib/rails/app_loader.rb | railties/lib/rails/app_loader.rb | # frozen_string_literal: true
require "pathname"
require "rails/version"
module Rails
module AppLoader # :nodoc:
extend self
RUBY = Gem.ruby
EXECUTABLES = ["bin/rails", "script/rails"]
BUNDLER_WARNING = <<EOS
Beginning in Rails 4, Rails ships with a `rails` binstub at ./bin/rails that
should be use... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/railties/lib/rails/application_controller.rb | railties/lib/rails/application_controller.rb | # frozen_string_literal: true
require "action_controller"
class Rails::ApplicationController < ActionController::Base # :nodoc:
prepend_view_path File.expand_path("templates", __dir__)
layout "application"
before_action :disable_content_security_policy_nonce!
content_security_policy do |policy|
policy.s... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/railties/lib/rails/autoloaders.rb | railties/lib/rails/autoloaders.rb | # frozen_string_literal: true
module Rails
class Autoloaders # :nodoc:
require_relative "autoloaders/inflector"
include Enumerable
attr_reader :main, :once
def initialize
# This `require` delays loading the library on purpose.
#
# In Rails 7.0.0, railties/lib/rails.rb loaded Zeit... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/railties/lib/rails/health_controller.rb | railties/lib/rails/health_controller.rb | # frozen_string_literal: true
require "action_controller"
module Rails
# Built-in Health Check Endpoint
#
# \Rails also comes with a built-in health check endpoint that is reachable at
# the +/up+ path. This endpoint will return a 200 status code if the app has
# booted with no exceptions, and a 500 status ... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/railties/lib/rails/all.rb | railties/lib/rails/all.rb | # frozen_string_literal: true
require "rails"
%w(
active_record/railtie
active_storage/engine
action_controller/railtie
action_view/railtie
action_mailer/railtie
active_job/railtie
action_cable/engine
action_mailbox/engine
action_text/engine
rails/test_unit/railtie
).each do |railtie|
begin # ru... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/railties/lib/rails/plugin/test.rb | railties/lib/rails/plugin/test.rb | # frozen_string_literal: true
require "rails/test_unit/runner"
require "rails/test_unit/reporter"
Rails::TestUnitReporter.executable = "bin/test"
Rails::TestUnit::Runner.parse_options(ARGV)
Rails::TestUnit::Runner.run(ARGV)
| ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/railties/lib/rails/railtie/configuration.rb | railties/lib/rails/railtie/configuration.rb | # frozen_string_literal: true
require "rails/configuration"
module Rails
class Railtie
class Configuration
def initialize
@@options ||= {}
end
# Expose the eager_load_namespaces at "module" level for convenience.
def self.eager_load_namespaces # :nodoc:
@@eager_load_name... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/railties/lib/rails/railtie/configurable.rb | railties/lib/rails/railtie/configurable.rb | # frozen_string_literal: true
module Rails
class Railtie
module Configurable
extend ActiveSupport::Concern
module ClassMethods
delegate :config, to: :instance
def inherited(base)
raise "You cannot inherit from a #{superclass.name} child"
end
def instance
... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/railties/lib/rails/rack/logger.rb | railties/lib/rails/rack/logger.rb | # frozen_string_literal: true
require "active_support/core_ext/time/conversions"
require "active_support/log_subscriber"
require "rack/body_proxy"
module Rails
module Rack
# Sets log tags, logs the request, calls the app, and flushes the logs.
#
# Log tags (+taggers+) can be an Array containing: methods... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/railties/lib/rails/rack/silence_request.rb | railties/lib/rails/rack/silence_request.rb | # frozen_string_literal: true
# :markup: markdown
require "active_support/logger_silence"
module Rails
module Rack
# Allows you to silence requests made to a specific path.
# This is useful for preventing recurring requests like health checks from clogging the logging.
# This middleware is used to do j... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/railties/lib/rails/command/actions.rb | railties/lib/rails/command/actions.rb | # frozen_string_literal: true
module Rails
module Command
module Actions
# Change to the application's path if there is no <tt>config.ru</tt> file in current directory.
# This allows us to run <tt>rails server</tt> from other directories, but still get
# the main <tt>config.ru</tt> and properly... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/railties/lib/rails/command/base.rb | railties/lib/rails/command/base.rb | # frozen_string_literal: true
require "thor"
require "erb"
require "active_support/core_ext/string/inflections"
require "rails/command/actions"
module Rails
module Command
class Base < Thor
class Error < Thor::Error # :nodoc:
end
include Actions
class_attribute :bin, instance_accesso... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/railties/lib/rails/command/environment_argument.rb | railties/lib/rails/command/environment_argument.rb | # frozen_string_literal: true
require "active_support"
module Rails
module Command
module EnvironmentArgument # :nodoc:
extend ActiveSupport::Concern
included do
class_option :environment, aliases: "-e", type: :string,
desc: "The environment to run `#{self.command_name}` in (e.g. ... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/railties/lib/rails/command/behavior.rb | railties/lib/rails/command/behavior.rb | # frozen_string_literal: true
require "active_support"
module Rails
module Command
module Behavior # :nodoc:
extend ActiveSupport::Concern
class_methods do
# Remove the color from output.
def no_color!
Thor::Base.shell = Thor::Shell::Basic
end
# Track all ... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/railties/lib/rails/command/helpers/editor.rb | railties/lib/rails/command/helpers/editor.rb | # frozen_string_literal: true
require "shellwords"
require "active_support/encrypted_file"
module Rails
module Command
module Helpers
module Editor
private
def editor
ENV["VISUAL"].to_s.empty? ? ENV["EDITOR"] : ENV["VISUAL"]
end
def display_hint_if_system... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/railties/lib/rails/rackup/server.rb | railties/lib/rails/rackup/server.rb | # frozen_string_literal: true
# :enddoc:
module Rails
module Rackup
begin
require "rackup/server"
Server = ::Rackup::Server
rescue LoadError
require "rack/server"
Server = ::Rack::Server
end
end
end
| ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/railties/lib/rails/commands/initializers/initializers_command.rb | railties/lib/rails/commands/initializers/initializers_command.rb | # frozen_string_literal: true
require "rails/command/environment_argument"
module Rails
module Command
class InitializersCommand < Base # :nodoc:
include EnvironmentArgument
desc "initializers", "Print out all defined initializers in the order they are invoked by Rails."
def perform
b... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/railties/lib/rails/commands/restart/restart_command.rb | railties/lib/rails/commands/restart/restart_command.rb | # frozen_string_literal: true
module Rails
module Command
class RestartCommand < Base # :nodoc:
desc "restart", "Restart app by touching tmp/restart.txt"
def perform
require "fileutils"
FileUtils.mkdir_p Rails::Command.application_root.join("tmp")
FileUtils.touch Rails::Comm... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/railties/lib/rails/commands/new/new_command.rb | railties/lib/rails/commands/new/new_command.rb | # frozen_string_literal: true
module Rails
module Command
class NewCommand < Base # :nodoc:
self.bin = "rails"
no_commands do
def help
Rails::Command.invoke :application, [ "--help" ]
end
end
def perform(*)
say "Can't initialize a new Rails application ... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/railties/lib/rails/commands/plugin/plugin_command.rb | railties/lib/rails/commands/plugin/plugin_command.rb | # frozen_string_literal: true
module Rails
module Command
class PluginCommand < Base # :nodoc:
hide_command!
self.bin = "rails"
def help
run_plugin_generator %w( --help )
end
def self.banner(*) # :nodoc:
"#{executable} new [options]"
end
class_option ... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/railties/lib/rails/commands/generate/generate_command.rb | railties/lib/rails/commands/generate/generate_command.rb | # frozen_string_literal: true
require "rails/generators"
module Rails
module Command
class GenerateCommand < Base # :nodoc:
no_commands do
def help
boot_application!
load_generators
Rails::Generators.help self.class.command_name
end
end
def perfo... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/railties/lib/rails/commands/app/update_command.rb | railties/lib/rails/commands/app/update_command.rb | # frozen_string_literal: true
require "rails/generators"
require "rails/generators/rails/app/app_generator"
module Rails
module Command
module App
class UpdateCommand < Base # :nodoc:
include Thor::Actions
add_runtime_options!
desc "update", "Update configs and some other initiall... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/railties/lib/rails/commands/dev/dev_command.rb | railties/lib/rails/commands/dev/dev_command.rb | # frozen_string_literal: true
require "rails/dev_caching"
module Rails
module Command
class DevCommand < Base # :nodoc:
desc "cache", "Toggle Action Controller development mode caching on/off"
def cache
Rails::DevCaching.enable_by_file
end
end
end
end
| ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/railties/lib/rails/commands/dbconsole/dbconsole_command.rb | railties/lib/rails/commands/dbconsole/dbconsole_command.rb | # frozen_string_literal: true
require "active_support/core_ext/string/filters"
require "rails/command/environment_argument"
module Rails
class DBConsole
def self.start(*args)
new(*args).start
end
def initialize(options = {})
@options = options
@options[:environment] ||= Rails::Command... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/railties/lib/rails/commands/help/help_command.rb | railties/lib/rails/commands/help/help_command.rb | # frozen_string_literal: true
module Rails
module Command
class HelpCommand < Base # :nodoc:
hide_command!
def help(*)
say self.class.class_usage
end
def help_extended(*)
help
say ""
say "In addition to those commands, there are:"
say ""
... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/railties/lib/rails/commands/version/version_command.rb | railties/lib/rails/commands/version/version_command.rb | # frozen_string_literal: true
module Rails
module Command
class VersionCommand < Base # :nodoc:
desc "version", "Show the Rails version"
def perform
Rails::Command.invoke :application, [ "--version" ]
end
end
end
end
| ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/railties/lib/rails/commands/middleware/middleware_command.rb | railties/lib/rails/commands/middleware/middleware_command.rb | # frozen_string_literal: true
module Rails
module Command
class MiddlewareCommand < Base # :nodoc:
desc "middleware", "Print out your Rack middleware stack"
def perform
boot_application!
Rails.configuration.middleware.each do |middleware|
say "use #{middleware.inspect}"
... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/railties/lib/rails/commands/secret/secret_command.rb | railties/lib/rails/commands/secret/secret_command.rb | # frozen_string_literal: true
module Rails
module Command
class SecretCommand < Base # :nodoc:
desc "secret", "Generate a cryptographically secure secret key (this is typically used to generate a secret for cookie sessions)."
def perform
require "securerandom"
puts SecureRandom.hex(64... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/railties/lib/rails/commands/db/system/change/change_command.rb | railties/lib/rails/commands/db/system/change/change_command.rb | # frozen_string_literal: true
require "rails/generators"
require "rails/generators/rails/db/system/change/change_generator"
module Rails
module Command
module Db
module System
class ChangeCommand < Base # :nodoc:
class_option :to, desc: "The database system to switch to."
def ... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/railties/lib/rails/commands/encrypted/encrypted_command.rb | railties/lib/rails/commands/encrypted/encrypted_command.rb | # frozen_string_literal: true
require "pathname"
require "active_support"
require "rails/command/helpers/editor"
module Rails
module Command
class EncryptedCommand < Rails::Command::Base # :nodoc:
include Helpers::Editor
class_option :key, aliases: "-k", type: :string,
default: "config/mast... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/railties/lib/rails/commands/destroy/destroy_command.rb | railties/lib/rails/commands/destroy/destroy_command.rb | # frozen_string_literal: true
require "rails/generators"
module Rails
module Command
class DestroyCommand < Base # :nodoc:
no_commands do
def help
boot_application!
load_generators
Rails::Generators.help self.class.command_name
end
end
desc "dest... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/railties/lib/rails/commands/about/about_command.rb | railties/lib/rails/commands/about/about_command.rb | # frozen_string_literal: true
module Rails
module Command
class AboutCommand < Base # :nodoc:
desc "about", "List versions of all Rails frameworks and the environment"
def perform
boot_application!
say Rails::Info
end
end
end
end
| ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/railties/lib/rails/commands/stats/stats_command.rb | railties/lib/rails/commands/stats/stats_command.rb | # frozen_string_literal: true
module Rails
module Command
class StatsCommand < Base # :nodoc:
desc "stats", "Report code statistics (KLOCs, etc) from the application or engine"
def perform
require "rails/code_statistics"
boot_application!
stat_directories = Rails::CodeStatist... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/railties/lib/rails/commands/test/test_command.rb | railties/lib/rails/commands/test/test_command.rb | # frozen_string_literal: true
require "rails/command"
require "rails/commands/rake/rake_command"
require "rails/test_unit/runner"
require "rails/test_unit/reporter"
module Rails
module Command
class TestCommand < Base # :nodoc:
def self.executable(*args)
args.empty? ? Rails::TestUnitReporter.execu... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/railties/lib/rails/commands/routes/routes_command.rb | railties/lib/rails/commands/routes/routes_command.rb | # frozen_string_literal: true
require "rails/command"
module Rails
module Command
class RoutesCommand < Base # :nodoc:
class_option :controller, aliases: "-c", desc: "Filter by a specific controller, e.g. PostsController or Admin::PostsController."
class_option :grep, aliases: "-g", desc: "Grep rout... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/railties/lib/rails/commands/console/irb_console.rb | railties/lib/rails/commands/console/irb_console.rb | # frozen_string_literal: true
require "irb/helper_method"
require "irb/command"
module Rails
class Console
class RailsHelperBase < IRB::HelperMethod::Base
end
class ControllerHelper < RailsHelperBase
description "Gets helper methods available to ApplicationController."
# This method assume... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/railties/lib/rails/commands/console/console_command.rb | railties/lib/rails/commands/console/console_command.rb | # frozen_string_literal: true
require "rails/command/environment_argument"
module Rails
class Console
def self.start(*args)
new(*args).start
end
attr_reader :options, :app, :console
def initialize(app, options = {})
@app = app
@options = options
app.sandbox = sandbox?
... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/railties/lib/rails/commands/application/application_command.rb | railties/lib/rails/commands/application/application_command.rb | # frozen_string_literal: true
require "rails/generators"
require "rails/generators/rails/app/app_generator"
module Rails
module Generators
class AppGenerator # :nodoc:
# We want to exit on failure to be kind to other libraries
# This is only when accessing via CLI
def self.exit_on_failure?
... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/railties/lib/rails/commands/runner/runner_command.rb | railties/lib/rails/commands/runner/runner_command.rb | # frozen_string_literal: true
require "rails/command/environment_argument"
module Rails
module Command
class RunnerCommand < Base # :nodoc:
include EnvironmentArgument
class_option :skip_executor, type: :boolean, aliases: "-w", desc: "Don't wrap with Rails Executor", default: false
no_comman... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/railties/lib/rails/commands/credentials/credentials_command.rb | railties/lib/rails/commands/credentials/credentials_command.rb | # frozen_string_literal: true
require "pathname"
require "active_support"
require "rails/command/helpers/editor"
require "rails/command/environment_argument"
module Rails
module Command
class CredentialsCommand < Rails::Command::Base # :nodoc:
include Helpers::Editor
include EnvironmentArgument
... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/railties/lib/rails/commands/credentials/credentials_command/diffing.rb | railties/lib/rails/commands/credentials/credentials_command/diffing.rb | # frozen_string_literal: true
module Rails::Command::CredentialsCommand::Diffing # :nodoc:
GITATTRIBUTES_ENTRY = <<~END
config/credentials/*.yml.enc diff=rails_credentials
config/credentials.yml.enc diff=rails_credentials
END
def enroll_project_in_credentials_diffing
if enrolled_in_credentials_diffi... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/railties/lib/rails/commands/gem_help/gem_help_command.rb | railties/lib/rails/commands/gem_help/gem_help_command.rb | # frozen_string_literal: true
module Rails
module Command
class GemHelpCommand < Base # :nodoc:
hide_command!
def perform
say self.class.class_usage
end
end
end
end
| ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/railties/lib/rails/commands/unused_routes/unused_routes_command.rb | railties/lib/rails/commands/unused_routes/unused_routes_command.rb | # frozen_string_literal: true
require "rails/commands/routes/routes_command"
module Rails
module Command
class UnusedRoutesCommand < Rails::Command::Base # :nodoc:
hide_command!
class_option :controller, aliases: "-c", desc: "Filter by a specific controller, e.g. PostsController or Admin::PostsContr... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/railties/lib/rails/commands/rake/rake_command.rb | railties/lib/rails/commands/rake/rake_command.rb | # frozen_string_literal: true
module Rails
module Command
class RakeCommand < Base # :nodoc:
extend Rails::Command::Actions
namespace "rake"
class << self
def printing_commands
rake_tasks.filter_map do |task|
if task.comment && task.locations.any?(non_app_file_pa... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/railties/lib/rails/commands/boot/boot_command.rb | railties/lib/rails/commands/boot/boot_command.rb | # frozen_string_literal: true
require "rails/command/environment_argument"
module Rails
module Command
class BootCommand < Base # :nodoc:
include EnvironmentArgument
desc "boot", "Boot the application and exit"
def perform(*) = boot_application!
end
end
end
| ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/railties/lib/rails/commands/server/server_command.rb | railties/lib/rails/commands/server/server_command.rb | # frozen_string_literal: true
require "fileutils"
require "action_dispatch"
require "rails"
require "rails/dev_caching"
require "rails/command/environment_argument"
require "rails/rackup/server"
module Rails
class Server < Rackup::Server
class Options
def parse!(args)
Rails::Command::ServerCommand... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/railties/lib/rails/commands/devcontainer/devcontainer_command.rb | railties/lib/rails/commands/devcontainer/devcontainer_command.rb | # frozen_string_literal: true
require "rails/generators"
require "rails/generators/rails/devcontainer/devcontainer_generator"
module Rails
module Command
class DevcontainerCommand < Base # :nodoc:
desc "devcontainer", "Generate a Dev Container setup based on current application configuration"
def pe... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/railties/lib/rails/commands/notes/notes_command.rb | railties/lib/rails/commands/notes/notes_command.rb | # frozen_string_literal: true
require "rails/source_annotation_extractor"
module Rails
module Command
class NotesCommand < Base # :nodoc:
class_option :annotations, aliases: "-a", desc: "Filter by specific annotations, e.g. Foobar TODO", type: :array
desc "notes", "Show comments in your code annota... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/railties/lib/rails/application/dummy_config.rb | railties/lib/rails/application/dummy_config.rb | # frozen_string_literal: true
class DummyConfig # :nodoc:
def initialize(config)
@config = config
end
def to_s
"DummyConfig"
end
def method_missing(selector, ...)
if @config.respond_to?(selector)
@config.send(selector, ...)
else
self
end
end
end
| ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/railties/lib/rails/application/finisher.rb | railties/lib/rails/application/finisher.rb | # frozen_string_literal: true
require "active_support/core_ext/string/inflections"
require "active_support/core_ext/array/conversions"
require "active_support/descendants_tracker"
require "active_support/dependencies"
module Rails
class Application
module Finisher
include Initializable
initializer ... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/railties/lib/rails/application/routes_reloader.rb | railties/lib/rails/application/routes_reloader.rb | # frozen_string_literal: true
module Rails
class Application
class RoutesReloader
include ActiveSupport::Callbacks
attr_reader :route_sets, :paths, :external_routes, :loaded
attr_accessor :eager_load
attr_writer :run_after_load_paths, :loaded # :nodoc:
delegate :execute_if_updated... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/railties/lib/rails/application/configuration.rb | railties/lib/rails/application/configuration.rb | # frozen_string_literal: true
require "ipaddr"
require "active_support/core_ext/array/wrap"
require "active_support/core_ext/kernel/reporting"
require "active_support/file_update_checker"
require "active_support/configuration_file"
require "rails/engine/configuration"
require "rails/source_annotation_extractor"
modul... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/railties/lib/rails/application/bootstrap.rb | railties/lib/rails/application/bootstrap.rb | # frozen_string_literal: true
require "fileutils"
require "active_support/notifications"
require "active_support/dependencies"
require "active_support/descendants_tracker"
module Rails
class Application
module Bootstrap
include Initializable
initializer :load_environment_hook, group: :all do end
... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/railties/lib/rails/application/default_middleware_stack.rb | railties/lib/rails/application/default_middleware_stack.rb | # frozen_string_literal: true
module Rails
class Application
class DefaultMiddlewareStack
attr_reader :config, :paths, :app
def initialize(app, config, paths)
@app = app
@config = config
@paths = paths
end
def build_stack
ActionDispatch::MiddlewareStack.n... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/railties/lib/rails/generators/actions.rb | railties/lib/rails/generators/actions.rb | # frozen_string_literal: true
require "shellwords"
require "active_support/core_ext/kernel/reporting"
require "active_support/core_ext/string/strip"
module Rails
module Generators
module Actions
def initialize(*) # :nodoc:
super
@indentation = 0
end
# Adds a +gem+ declaration ... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/railties/lib/rails/generators/test_case.rb | railties/lib/rails/generators/test_case.rb | # frozen_string_literal: true
require "rails/generators"
require "rails/generators/testing/behavior"
require "rails/generators/testing/setup_and_teardown"
require "rails/generators/testing/assertions"
require "fileutils"
module Rails
module Generators
# Disable color in output. Easier to debug.
no_color!
... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/railties/lib/rails/generators/active_model.rb | railties/lib/rails/generators/active_model.rb | # frozen_string_literal: true
module Rails
module Generators
# ActiveModel is a class to be implemented by each ORM to allow \Rails to
# generate customized controller code.
#
# The API has the same methods as ActiveRecord, but each method returns a
# string that matches the ORM API.
#
# ... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/railties/lib/rails/generators/test_unit.rb | railties/lib/rails/generators/test_unit.rb | # frozen_string_literal: true
require "rails/generators/named_base"
module TestUnit # :nodoc:
module Generators # :nodoc:
class Base < Rails::Generators::NamedBase # :nodoc:
end
end
end
| ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/railties/lib/rails/generators/bundle_helper.rb | railties/lib/rails/generators/bundle_helper.rb | # frozen_string_literal: true
module Rails
module Generators
module BundleHelper # :nodoc:
def bundle_command(command, env = {}, params = {})
say_status :run, "bundle #{command}"
# We are going to shell out rather than invoking Bundler::CLI.new(command)
# because `rails new` loads ... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/railties/lib/rails/generators/model_helpers.rb | railties/lib/rails/generators/model_helpers.rb | # frozen_string_literal: true
require "rails/generators/active_model"
module Rails
module Generators
module ModelHelpers # :nodoc:
PLURAL_MODEL_NAME_WARN_MESSAGE = "[WARNING] The model name '%s' was recognized as a plural, using the singular '%s' instead. " \
"Overri... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/railties/lib/rails/generators/base.rb | railties/lib/rails/generators/base.rb | # frozen_string_literal: true
begin
require "thor/group"
rescue LoadError
puts "Thor is not available.\nIf you ran this command from a git checkout " \
"of Rails, please make sure thor is installed,\nand run this command " \
"as `ruby #{$0} #{(ARGV | ['--dev']).join(" ")}`"
exit
end
module Rails
... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/railties/lib/rails/generators/generated_attribute.rb | railties/lib/rails/generators/generated_attribute.rb | # frozen_string_literal: true
require "active_support/time"
require "active_support/core_ext/string/starts_ends_with"
module Rails
module Generators
class GeneratedAttribute # :nodoc:
INDEX_OPTIONS = %w(index uniq)
UNIQ_INDEX_OPTIONS = %w(uniq)
DEFAULT_TYPES = %w(
attachment
at... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/railties/lib/rails/generators/resource_helpers.rb | railties/lib/rails/generators/resource_helpers.rb | # frozen_string_literal: true
require "rails/generators/active_model"
require "rails/generators/model_helpers"
module Rails
module Generators
# Deal with controller names on scaffold and add some helpers to deal with
# ActiveModel.
module ResourceHelpers # :nodoc:
def self.included(base) # :nodoc:... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/railties/lib/rails/generators/app_name.rb | railties/lib/rails/generators/app_name.rb | # frozen_string_literal: true
module Rails
module Generators
module AppName # :nodoc:
RESERVED_NAMES = %w(application destroy plugin runner test)
private
def app_name
@app_name ||= original_app_name.parameterize(preserve_case: true).underscore
end
def original_app_... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/railties/lib/rails/generators/app_base.rb | railties/lib/rails/generators/app_base.rb | # frozen_string_literal: true
require "fileutils"
require "digest/md5"
require "rails/version" unless defined?(Rails::VERSION)
require "open-uri"
require "tsort"
require "uri"
require "rails/generators"
require "rails/generators/bundle_helper"
require "active_support/core_ext/array/extract_options"
module Rails
mod... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/railties/lib/rails/generators/named_base.rb | railties/lib/rails/generators/named_base.rb | # frozen_string_literal: true
require "rails/generators/base"
require "rails/generators/generated_attribute"
module Rails
module Generators
class NamedBase < Base
argument :name, type: :string
def initialize(args, *options) # :nodoc:
@inside_template = nil
# Unfreeze name in case it... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/railties/lib/rails/generators/erb.rb | railties/lib/rails/generators/erb.rb | # frozen_string_literal: true
require "rails/generators/named_base"
module Erb # :nodoc:
module Generators # :nodoc:
class Base < Rails::Generators::NamedBase # :nodoc:
private
def formats
[format]
end
def format
:html
end
def handler
... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/railties/lib/rails/generators/migration.rb | railties/lib/rails/generators/migration.rb | # frozen_string_literal: true
require "rails/generators/actions/create_migration"
module Rails
module Generators
# Holds common methods for migrations. It assumes that migrations have the
# [0-9]*_name format and can be used by other frameworks (like Sequel)
# just by implementing the +next_migration_nu... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/railties/lib/rails/generators/database.rb | railties/lib/rails/generators/database.rb | # frozen_string_literal: true
module Rails
module Generators
class Database
DATABASES = %w( mysql trilogy postgresql sqlite3 mariadb-mysql mariadb-trilogy )
module MySQL
def name
"mysql"
end
def port
3306
end
def service
{
... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/railties/lib/rails/generators/rails/controller/controller_generator.rb | railties/lib/rails/generators/rails/controller/controller_generator.rb | # frozen_string_literal: true
module Rails
module Generators
class ControllerGenerator < NamedBase # :nodoc:
argument :actions, type: :array, default: [], banner: "action action"
class_option :skip_routes, type: :boolean, desc: "Don't add routes to config/routes.rb."
class_option :helper, type:... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/railties/lib/rails/generators/rails/scaffold_controller/scaffold_controller_generator.rb | railties/lib/rails/generators/rails/scaffold_controller/scaffold_controller_generator.rb | # frozen_string_literal: true
require "rails/generators/resource_helpers"
module Rails
module Generators
class ScaffoldControllerGenerator < NamedBase # :nodoc:
include ResourceHelpers
check_class_collision suffix: "Controller"
class_option :helper, type: :boolean
class_option :orm, ba... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/railties/lib/rails/generators/rails/encryption_key_file/encryption_key_file_generator.rb | railties/lib/rails/generators/rails/encryption_key_file/encryption_key_file_generator.rb | # frozen_string_literal: true
require "pathname"
require "rails/generators/base"
require "active_support/encrypted_file"
module Rails
module Generators
class EncryptionKeyFileGenerator < Base # :nodoc:
def add_key_file(key_path)
key_path = Pathname.new(key_path)
unless key_path.exist?
... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/railties/lib/rails/generators/rails/plugin/plugin_generator.rb | railties/lib/rails/generators/rails/plugin/plugin_generator.rb | # frozen_string_literal: true
require "active_support/core_ext/hash/except"
require "rails/generators/rails/app/app_generator"
require "date"
module Rails
# The plugin builder allows you to override elements of the plugin
# generator without being forced to reverse the operations of the default
# generator.
#... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/railties/lib/rails/generators/rails/scaffold/scaffold_generator.rb | railties/lib/rails/generators/rails/scaffold/scaffold_generator.rb | # frozen_string_literal: true
require "rails/generators/rails/resource/resource_generator"
module Rails
module Generators
class ScaffoldGenerator < ResourceGenerator # :nodoc:
remove_hook_for :resource_controller
remove_class_option :actions
class_option :api, type: :boolean,
desc: "G... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/railties/lib/rails/generators/rails/resource/resource_generator.rb | railties/lib/rails/generators/rails/resource/resource_generator.rb | # frozen_string_literal: true
require "rails/generators/resource_helpers"
require "rails/generators/rails/model/model_generator"
module Rails
module Generators
class ResourceGenerator < ModelGenerator # :nodoc:
include ResourceHelpers
hook_for :resource_controller, required: true do |controller|
... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/railties/lib/rails/generators/rails/app/app_generator.rb | railties/lib/rails/generators/rails/app/app_generator.rb | # frozen_string_literal: true
require "rails/generators/app_base"
require "rails/generators/rails/devcontainer/devcontainer_generator"
module Rails
module ActionMethods # :nodoc:
attr_reader :options
def initialize(generator)
@generator = generator
@options = generator.options
end
pr... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/railties/lib/rails/generators/rails/resource_route/resource_route_generator.rb | railties/lib/rails/generators/rails/resource_route/resource_route_generator.rb | # frozen_string_literal: true
module Rails
module Generators
class ResourceRouteGenerator < NamedBase # :nodoc:
# Properly nests namespaces passed into a generator
#
# $ bin/rails generate resource admin/users/products
#
# should give you
#
# namespace :admin do
... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/railties/lib/rails/generators/rails/model/model_generator.rb | railties/lib/rails/generators/rails/model/model_generator.rb | # frozen_string_literal: true
require "rails/generators/model_helpers"
module Rails
module Generators
class ModelGenerator < NamedBase # :nodoc:
include Rails::Generators::ModelHelpers
argument :attributes, type: :array, default: [], banner: "field[:type][:index] field[:type][:index]"
hook_fo... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/railties/lib/rails/generators/rails/benchmark/benchmark_generator.rb | railties/lib/rails/generators/rails/benchmark/benchmark_generator.rb | # frozen_string_literal: true
require "rails/generators/named_base"
module Rails
module Generators
class BenchmarkGenerator < NamedBase
IPS_GEM_NAME = "benchmark-ips"
IPS_GEM_USED_REGEXP = /gem.*\b#{IPS_GEM_NAME}\b.*/
argument :reports, type: :array, default: ["before", "after"]
def ge... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/railties/lib/rails/generators/rails/authentication/authentication_generator.rb | railties/lib/rails/generators/rails/authentication/authentication_generator.rb | # frozen_string_literal: true
require "rails/generators/bundle_helper"
module Rails
module Generators
class AuthenticationGenerator < Base # :nodoc:
include BundleHelper
class_option :api, type: :boolean,
desc: "Generate API-only controllers and models, with no view templates"
hook_f... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/railties/lib/rails/generators/rails/integration_test/integration_test_generator.rb | railties/lib/rails/generators/rails/integration_test/integration_test_generator.rb | # frozen_string_literal: true
module Rails
module Generators
class IntegrationTestGenerator < NamedBase # :nodoc:
hook_for :integration_tool, as: :integration
end
end
end
| ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/railties/lib/rails/generators/rails/generator/generator_generator.rb | railties/lib/rails/generators/rails/generator/generator_generator.rb | # frozen_string_literal: true
module Rails
module Generators
class GeneratorGenerator < NamedBase # :nodoc:
check_class_collision suffix: "Generator"
class_option :namespace, type: :boolean, default: true,
desc: "Namespace generator under lib/generators/name"
de... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/railties/lib/rails/generators/rails/db/system/change/change_generator.rb | railties/lib/rails/generators/rails/db/system/change/change_generator.rb | # frozen_string_literal: true
require "rails/generators/base"
require "yaml"
require "json"
module Rails
module Generators
module Db
module System
class ChangeGenerator < Base # :nodoc:
include AppName
BASE_PACKAGES = %w( curl libjemalloc2 libvips )
BUILD_PACKAGES = ... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/railties/lib/rails/generators/rails/master_key/master_key_generator.rb | railties/lib/rails/generators/rails/master_key/master_key_generator.rb | # frozen_string_literal: true
require "pathname"
require "rails/generators/base"
require "rails/generators/rails/encryption_key_file/encryption_key_file_generator"
require "active_support/encrypted_file"
module Rails
module Generators
class MasterKeyGenerator < Base # :nodoc:
MASTER_KEY_PATH = Pathname.ne... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/railties/lib/rails/generators/rails/application_record/application_record_generator.rb | railties/lib/rails/generators/rails/application_record/application_record_generator.rb | # frozen_string_literal: true
module Rails
module Generators
class ApplicationRecordGenerator < Base # :nodoc:
hook_for :orm, required: true, desc: "ORM to be invoked"
class << self
delegate(:desc, to: :orm_generator)
end
end
end
end
| ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/railties/lib/rails/generators/rails/system_test/system_test_generator.rb | railties/lib/rails/generators/rails/system_test/system_test_generator.rb | # frozen_string_literal: true
module Rails
module Generators
class SystemTestGenerator < NamedBase # :nodoc:
hook_for :system_tests, as: :system
end
end
end
| ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/railties/lib/rails/generators/rails/credentials/credentials_generator.rb | railties/lib/rails/generators/rails/credentials/credentials_generator.rb | # frozen_string_literal: true
require "rails/generators/base"
require "rails/generators/rails/master_key/master_key_generator"
require "active_support/encrypted_configuration"
module Rails
module Generators
class CredentialsGenerator < Base # :nodoc:
argument :content_path, default: "config/credentials.ym... | ruby | MIT | ba0d6f09e991d0621cc30f19c9d189cd21dbf76e | 2026-01-04T15:37:27.222351Z | false |
rails/rails | https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/railties/lib/rails/generators/rails/helper/helper_generator.rb | railties/lib/rails/generators/rails/helper/helper_generator.rb | # frozen_string_literal: true
module Rails
module Generators
class HelperGenerator < NamedBase # :nodoc:
check_class_collision suffix: "Helper"
def create_helper_files
template "helper.rb", File.join("app/helpers", class_path, "#{file_name}_helper.rb")
end
hook_for :test_framewo... | 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.