
March 17, 2026
Rails is much more than a framework on top of Ruby — it adds hundreds of methods, classes, and abstractions that plain Ruby simply doesn’t have. This is a complete reference of everything Rails brings to the table, excluding external gems like ActiveRecord, Devise, or Pundit. All items come from Action Pack, Action View, Action Mailer, Action Cable, Active Support, Active Job, or Action Dispatch.
1. Active Support — Ruby Core Extensions
Active Support is Rails’ utility library. It monkey-patches Ruby’s built-in classes with methods that feel so natural you might forget they aren’t part of the language itself.
String
- camelize — converts snake_case to CamelCase
- underscore — converts CamelCase to snake_case
- dasherize — replaces underscores with dashes
- humanize — formats a DB column name for human display
- titleize — capitalizes every word
- pluralize — ‘person’ → ‘people’
- singularize — ‘users’ → ‘user’
- classify — ‘egg_and_hams’ → ‘EggAndHam’
- tableize — ‘RawScaledScorer’ → ‘raw_scaled_scorers’
- foreign_key — ‘Message’ → ‘message_id’
- constantize / safe_constantize — finds a constant from a string
- truncate / truncate_words — shortens strings with ellipsis
- squish — strips and collapses all internal whitespace
- remove — removes all occurrences of a pattern
- indent — indents each line by n spaces
- at / from / to / first / last — substring access
- mb_chars — multibyte-safe string proxy
- html_safe — marks string as safe for HTML rendering
- to_date / to_time / to_datetime — parses string into date/time object
Integer & Numeric
- ordinalize — 1 → ‘1st’, 11 → ’11th’
- bytes / kilobytes / megabytes / gigabytes / terabytes — 1.megabyte → 1_048_576
- seconds / minutes / hours / days / weeks / months / years — returns ActiveSupport::Duration
- ago / from_now / since / until — 3.days.ago, 1.hour.from_now
- multiple_of? — 3.multiple_of?(2) → false
Array
- second / third / fourth / fifth / forty_two — positional access
- second_to_last / third_to_last — reverse positional access
- from(n) / to(n) — subarray slices
- including / excluding / without — non-destructive membership operations
- flatten_once — flattens one level only
- in_groups_of(n) — splits into groups of n, padding with nil
- in_groups(n) — splits into n equal groups
- split(value) — divides array on a separator value
- extract! — removes and returns elements matching a block
- extract_options! — removes and returns last element if it’s a Hash
- inquiry — wraps in ArrayInquirer for include?-style queries
- to_sentence — [‘a’,’b’,’c’].to_sentence → ‘a, b, and c’
- deep_dup — recursively duplicates nested structures
- compact_blank — removes all blank? elements
Hash
- with_indifferent_access — access keys as symbol or string interchangeably
- deep_merge / deep_merge! — recursively merges nested hashes
- reverse_merge / reverse_merge! — merges only missing keys
- except — returns hash without given keys
- extract! — removes and returns given key-value pairs
- stringify_keys / symbolize_keys and deep variants
- to_xml — converts hash to XML string
- to_query / to_param — URL query string serialization
- compact_blank — removes blank? values
- assert_valid_keys — raises if any key is not in the allowed set
Object
- blank? — true for nil, false, empty string, whitespace, empty array/hash
- present? — opposite of blank?
- presence — returns self if present?, nil otherwise
- try / try! — calls method only if receiver responds to it
- in?(array) — 1.in?([1,2,3]) → true
- deep_dup — recursive duplication
- to_param / to_query — URL serialization helpers
- with_options — shared options DSL
- acts_like? — duck-typing query
- instance_values — hash of ivar names to values
Module & Class
- mattr_accessor / cattr_accessor and reader/writer variants — module/class-level attributes
- thread_mattr_accessor — thread-local attribute accessor
- delegate — delegate :name, to: :profile
- delegate_missing_to — forwards all unknown calls to a target
- attr_internal / attr_internal_accessor — name-mangled ivar to avoid conflicts
- concerning — mini-module DSL for organizing code within a class
- class_attribute — inheritable class-level attribute with instance override
- anonymous? — true if module/class has no name
- subclasses / descendants — class hierarchy inspection
- redefine_method — redefines without triggering warnings
Time, Date & DateTime
- Time.current — Time.zone.now if zone is set, otherwise Time.now
- Time.zone — current thread time zone
- beginning_of_day / end_of_day
- beginning_of_week / end_of_week
- beginning_of_month / end_of_month
- beginning_of_quarter / end_of_quarter
- beginning_of_year / end_of_year
- next_week / last_week / next_month / last_month
- tomorrow / yesterday
- advance(options) — date.advance(months: 1, days: -2)
- change(options) — replaces specific components
- in_time_zone(zone) — converts to a different time zone
- ActiveSupport::TimeWithZone — Rails’ preferred time-aware class
- ActiveSupport::Duration — result of 3.days, 1.year, etc.
- ActiveSupport::TimeZone — Rails’ time zone wrapper around TZInfo
2. Action Controller
Action Controller is the base for all Rails controllers. Everything here is provided by Rails — none of it exists in plain Ruby.
Class-level features
- before_action / after_action / around_action — callback filters
- skip_before_action / skip_after_action — skip inherited callbacks
- prepend_before_action — adds callback at the front of the chain
- rescue_from — declares an exception handler for the controller hierarchy
- helper_method — exposes controller methods as view helpers
- protect_from_forgery — enables CSRF protection
- verify_authenticity_token — manual CSRF check
- http_basic_authenticate_with — one-line HTTP Basic auth
- layout — specifies the layout for this controller
- respond_to — defines responses for different MIME types
Instance methods & objects
- params — ActionController::Parameters with strong params filtering
- request — ActionDispatch::Request object
- response — ActionDispatch::Response object
- session — session hash, persisted across requests
- cookies — cookie jar with signed/encrypted variants
- flash / flash.now — cross-request or same-request messages
- flash.keep — persists flash for one more request
- render — renders template, partial, JSON, plain text, file, etc.
- redirect_to — issues HTTP redirect
- head — sends headers-only response with no body
- send_file — streams a file to the browser
- send_data — sends binary data as a download
- url_for — generates a URL from a hash or route helper
- action_name / controller_name / controller_path — current context info
- performed? — true if render or redirect already called
- helpers — returns the view context
Strong Parameters
- permit(*keys) — whitelists specific parameters
- require(key) — ensures key is present, raises if missing
- permit! — permits all parameters (use with caution)
- permitted? — true if params have been permitted
- to_unsafe_h — returns raw hash bypassing filtering
- merge / merge! / except / slice — standard hash operations on params
Cookies & Session
- cookies[:key] — plain cookie read/write
- cookies.signed[:key] — tamper-proof signed cookie
- cookies.encrypted[:key] — encrypted cookie (Rails 5.2+)
- cookies.permanent[:key] — cookie expiring 20 years from now
- cookies.delete(:key) — deletes a cookie
- session[:key] — server-side session data
- reset_session — clears session and generates new session ID
3. Action View — View Helpers
These helpers are available in all Rails views and helper modules. None exist in plain Ruby.
URL & Link helpers
- link_to — generates an <a> tag
- link_to_if / link_to_unless / link_to_unless_current — conditional links
- button_to — mini-form with a submit button (for DELETE/PATCH actions)
- mail_to — generates a mailto: link
- url_for — generates a URL from options
Form helpers
- form_with — primary form builder (Rails 5.1+)
- form_for — legacy model-bound form builder
- form_tag — legacy form builder without a model
- fields_for — nested fields for associated models
- label / text_field / password_field / text_area
- check_box / radio_button
- select / collection_select / grouped_collection_select
- date_select / time_select / datetime_select
- file_field / hidden_field
- number_field / email_field / url_field / phone_field
- submit / button
- options_for_select / options_from_collection_for_select
Asset helpers
- javascript_include_tag — generates <script> tags
- stylesheet_link_tag — generates <link> tags
- image_tag — generates <img> tag
- image_url / asset_url / asset_path
- audio_tag / video_tag
- favicon_link_tag / auto_discovery_link_tag / preload_link_tag
Text & formatting helpers
- number_to_currency — 1234.5 → ‘$1,234.50’
- number_to_percentage — 0.75 → ‘75.000%’
- number_to_human — 1234567 → ‘1.23 Million’
- number_to_human_size — 1048576 → ‘1 MiB’
- number_with_delimiter — 1234567 → ‘1,234,567’
- number_with_precision / number_to_phone
- truncate / truncate_words / highlight / excerpt / word_wrap
- simple_format — converts \n to <p> and <br> tags
- pluralize — pluralize(2, ‘person’) → ‘2 people’
- cycle / current_cycle / reset_cycle — loop value cycling
Sanitization & escaping helpers
- html_escape / h — escapes HTML special characters
- sanitize — strips dangerous HTML, allows safe tags
- sanitize_css — sanitizes a CSS string
- strip_tags — removes all HTML tags
- strip_links — removes <a> tags but keeps text
- raw — marks string as html_safe
- json_escape / escape_javascript / j — escapes for JS string literals
Layout & rendering helpers
- render — renders a partial, template, or object
- content_for — captures content for insertion elsewhere in layout
- yield — outputs a content_for block or the main template body
- content_tag — generates an HTML element — content_tag(:div, ‘text’, class: ‘x’)
- tag — new tag builder (Rails 5+) — tag.div, tag.span
- concat / capture / provide
- cache / cache_if / cache_unless — fragment caching
- stale? / fresh_when — HTTP cache control
- expires_in / expires_now — sets Cache-Control headers
4. Action Mailer
Action Mailer provides a controller-like interface for building and sending emails. Every feature here is Rails-specific.
- mail(options) — builds the email message (to, from, subject, etc.)
- attachments[:name] — adds a file attachment
- attachments.inline[:name] — adds an inline attachment (e.g. embedded images)
- headers — access or set arbitrary email headers
- default — sets default from, reply-to, etc. for all mailer actions
- before_action / after_action / around_action — mailer callbacks
- deliver_now — sends the email synchronously
- deliver_later — enqueues email for background delivery via Active Job
- deliver_later(wait: 5.minutes) — delayed delivery
- deliver_later(wait_until: time) — delivery at a specific time
- ActionMailer::Preview — live preview of email templates in the browser
- ActionMailer::MessageDelivery — wrapper returned by mailer methods
5. Action Cable
Action Cable integrates WebSockets with Rails. It is entirely Rails-specific.
- ActionCable::Channel::Base — base class for all channels
- subscribed / unsubscribed — channel lifecycle callbacks
- stream_from(key) — opens a pub/sub stream from a named key
- stream_for(model) — opens a stream scoped to a model instance
- stop_all_streams — closes all open streams for this subscription
- transmit(data) — sends data to the current subscriber
- ActionCable.server.broadcast(channel, data) — broadcasts to all subscribers
- reject — rejects the subscription from within subscribed
- ActionCable::Connection::Base — handles the WebSocket connection lifecycle
- identified_by(*keys) — declares connection identifiers (e.g. current_user)
- ActionCable::RemoteConnections — disconnects clients via the server-side API
6. Active Job
Active Job is Rails’ standard interface for background jobs. The adapters (Sidekiq, Resque, etc.) are separate — this is the abstraction layer.
- perform_later(*args) — enqueues the job for background execution
- perform_now(*args) — runs the job immediately in the current process
- set(options).perform_later — sets queue, wait, priority before enqueuing
- queue_as(name) — specifies which queue the job runs on
- retry_on(exception, options) — automatically retries on given exceptions
- discard_on(exception) — discards job without retry on given exception
- before_enqueue / after_enqueue / around_enqueue — enqueue callbacks
- before_perform / after_perform / around_perform — execution callbacks
- job_id — unique ID assigned to each job instance
- queue_name / priority / executions — job metadata
- serialize / deserialize — custom argument serialization
- GlobalID integration — ActiveRecord models are serialized automatically
7. Action Dispatch
Action Dispatch handles HTTP requests, responses, cookies, sessions, and the middleware stack.
Request & Response
- request.method / request.get? / request.post? — HTTP method inspection
- request.xhr? / request.format — AJAX detection and MIME format
- request.host / request.domain / request.port / request.fullpath / request.url
- request.remote_ip / request.ip — client IP with proxy awareness
- request.user_agent — browser/client user agent string
- request.headers — HTTP headers hash
- request.query_parameters / request.request_parameters / request.path_parameters
- request.ssl? — true if HTTPS
- request.local? — true if request from localhost
- request.variant — request variant (e.g. :tablet, :phone)
- response.status / response.headers — response inspection and mutation
Integration Test helpers
- get / post / patch / put / delete — simulate HTTP requests in tests
- assert_response — asserts HTTP status code
- assert_redirected_to — asserts redirect location
- follow_redirect! — follows a redirect in integration tests
- assert_select — CSS selector-based HTML assertions
- assert_dom_equal / assert_dom_not_equal — HTML structure comparison
8. Active Support — Utilities & Instrumentation
Notifications & Instrumentation
- ActiveSupport::Notifications.instrument — fires a named event with payload
- ActiveSupport::Notifications.subscribe — subscribes to instrumentation events
- ActiveSupport::Notifications.unsubscribe — removes a subscriber
- ActiveSupport::Notifications.monotonic_subscribe — subscribes with monotonic clock
Caching
- Rails.cache.read(key) — reads a cached value
- Rails.cache.write(key, value, options) — writes to the cache
- Rails.cache.fetch(key) { … } — reads or computes and stores
- Rails.cache.delete(key) / Rails.cache.exist?(key)
- Rails.cache.increment / Rails.cache.decrement — atomic counters
- Rails.cache.delete_matched(pattern) / Rails.cache.clear
- ActiveSupport::Cache::MemoryStore / FileStore / MemCacheStore / RedisCacheStore
Callbacks
- ActiveSupport::Callbacks — module providing the full callbacks system
- define_callbacks(*names) — declares callback chains
- set_callback(name, kind, method) — registers a callback
- skip_callback(name, kind, method) — skips a specific callback
- run_callbacks(name) { … } — runs a callback chain around a block
- halted_callback_hook — called when a callback halts the chain
Miscellaneous Utilities
- ActiveSupport::Concern — clean mixin pattern with included / class_methods blocks
- ActiveSupport::Inflector — pluralization, singularization, camelize, etc.
- ActiveSupport::Inflector.inflections — configure custom inflection rules
- ActiveSupport::HashWithIndifferentAccess — hash accessible by string or symbol
- ActiveSupport::SafeBuffer — html_safe string subclass used by Action View
- ActiveSupport::StringInquirer — Rails.env.production? DSL
- ActiveSupport::ArrayInquirer — array version of StringInquirer
- ActiveSupport::Deprecation — structured deprecation warnings with callstack
- ActiveSupport::Rescuable — mixin for rescue_from-style exception handling
- ActiveSupport::Configurable — config {} block DSL
- ActiveSupport::LazyLoadHooks — on_load hook for deferred initialization
- ActiveSupport::CurrentAttributes — thread-isolated attributes for request context
- ActiveSupport::BacktraceCleaner — filters and formats backtraces
- ActiveSupport::Gzip — compress/decompress strings
- ActiveSupport::MessageEncryptor — encrypt/decrypt messages with a secret key
- ActiveSupport::MessageVerifier — sign/verify messages (tamper detection)
- ActiveSupport::KeyGenerator — derives keys from a secret using PBKDF2
- ActiveSupport::SecureCompare — constant-time string comparison
- ActiveSupport::Testing::* — assert_difference, travel_to, freeze_time, etc.
9. Railties — Application & Engine Infrastructure
Railties is the core of Rails’ initialization and application structure.
- Rails.application — the singleton application instance
- Rails.env — StringInquirer — Rails.env.production? / .development?
- Rails.logger — application logger (Tagged Logging by default)
- Rails.root — Pathname for the application root directory
- Rails.public_path / Rails.cache_path / Rails.log_path
- Rails.configuration — access the application config object
- Rails.autoloaders — Zeitwerk autoloader instances
- Rails.backtrace_cleaner — the app-level BacktraceCleaner
- config/initializers/*.rb — auto-loaded before app boots
- config/application.rb — app-level config DSL
- config/environments/*.rb — per-environment overrides
- Rails::Engine — mountable mini-application with its own routes, models, controllers
- Rails::Railtie — hooks into the initialization process for gems/plugins
- config.eager_load_namespaces — namespaces to eager load in production
- config.autoload_paths — directories Zeitwerk watches for autoloading
- ActiveSupport::TaggedLogging — wraps logger with tagged log entry support
- ActiveSupport::BroadcastLogger — broadcasts log entries to multiple loggers (Rails 7.1+)
Rails built-ins only — ActiveRecord, Devise, Pundit, and all other gems are excluded by design.
