Table of Contents - rails-4.2.6 Documentation
Pages
- README
- CHANGELOG
- Rakefile
- README
- guides.js
- jquery.min.js
- responsive-tables.js
- shBrushAS3.js
- shBrushAppleScript.js
- shBrushBash.js
- shBrushCSharp.js
- shBrushColdFusion.js
- shBrushCpp.js
- shBrushCss.js
- shBrushDelphi.js
- shBrushDiff.js
- shBrushErlang.js
- shBrushGroovy.js
- shBrushJScript.js
- shBrushJava.js
- shBrushJavaFX.js
- shBrushPerl.js
- shBrushPhp.js
- shBrushPlain.js
- shBrushPowerShell.js
- shBrushPython.js
- shBrushRuby.js
- shBrushSass.js
- shBrushScala.js
- shBrushSql.js
- shBrushVb.js
- shBrushXml.js
- shCore.js
- fixes.css
- kindle.css
- main.css
- print.css
- reset.css
- responsive-tables.css
- style.css
- shCore.css
- shCoreDefault.css
- shCoreDjango.css
- shCoreEclipse.css
- shCoreEmacs.css
- shCoreFadeToGrey.css
- shCoreMDUltra.css
- shCoreMidnight.css
- shCoreRDark.css
- shThemeDefault.css
- shThemeDjango.css
- shThemeEclipse.css
- shThemeEmacs.css
- shThemeFadeToGrey.css
- shThemeMDUltra.css
- shThemeMidnight.css
- shThemeRDark.css
- shThemeRailsGuides.css
-
2_2_release_notes
- Ruby on Rails 2.2 Release Notes
- Infrastructure
- Internationalization
- Compatibility with Ruby 1.9 and JRuby
- Documentation
- Better integration with HTTP : Out of the box ETag support
- Thread Safety
- Active Record
- Transactional Migrations
- Connection Pooling
- Hashes for Join Table Conditions
- New Dynamic Finders
- find_last_by_attribute
- find_by_attribute!
- Associations Respect Private/Protected Scope
- Other Active Record Changes
- Action Controller
- Shallow Route Nesting
- Method Arrays for Member or Collection Routes
- Resources With Specific Actions
- Other Action Controller Changes
- Action View
- Action Mailer
- Active Support
- Memoization
- each_with_object
- Delegates With Prefixes
- Other Active Support Changes
- Railties
- config.gems
- Other Railties Changes
- Deprecated
- Credits
-
2_3_release_notes
- Ruby on Rails 2.3 Release Notes
- Application Architecture
- Rack Integration
- Renewed Support for Rails Engines
- Documentation
- Ruby 1.9.1 Support
- Active Record
- Nested Attributes
- Nested Transactions
- Dynamic Scopes
- Default Scopes
- Batch Processing
- Multiple Conditions for Callbacks
- Find with having
- Reconnecting MySQL Connections
- Other Active Record Changes
- Action Controller
- Unified Rendering
- Application Controller Renamed
- HTTP Digest Authentication Support
- More Efficient Routing
- Rack-based Lazy-loaded Sessions
- MIME Type Handling Changes
- Optimization of respond_to
- Improved Caching Performance
- Localized Views
- Partial Scoping for Translations
- Other Action Controller Changes
- Action View
- Nested Object Forms
- Smart Rendering of Partials
- Prompts for Date Select Helpers
- AssetTag Timestamp Caching
- Asset Hosts as Objects
- grouped_options_for_select Helper Method
- Disabled Option Tags for Form Select Helpers
- A Note About Template Loading
- Other Action View Changes
- Active Support
- Object#try
- Object#tap Backport
- Swappable Parsers for XMLmini
- Fractional seconds for TimeWithZone
- JSON Key Quoting
- Other Active Support Changes
- Railties
- Rails Metal
- Application Templates
- Quieter Backtraces
- Faster Boot Time in Development Mode with Lazy Loading/Autoload
- rake gem Task Rewrite
- Other Railties Changes
- Deprecated
- Credits
-
3_0_release_notes
- Ruby on Rails 3.0 Release Notes
- Upgrading to Rails 3
- Rails 3 requires at least Ruby 1.8.7
- Rails Application object
- script/* replaced by script/rails
- Dependencies and config.gem
- Upgrade Process
- Creating a Rails 3.0 application
- Vendoring Gems
- Living on the Edge
- Rails Architectural Changes
- Railties Restrung
- All Rails core components are decoupled
- Active Model Abstraction
- Controller Abstraction
- Arel Integration
- Mail Extraction
- Documentation
- Internationalization
- Railties
- Action Pack
- Abstract Controller
- Action Controller
- Action Dispatch
- Action View
- Unobtrusive JavaScript
- Helpers with Blocks
- Other Changes
- Active Model
- ORM Abstraction and Action Pack Interface
- Validations
- Active Record
- Query Interface
- Enhancements
- Patches and Deprecations
- Active Resource
- Active Support
- Action Mailer
- Credits
-
3_1_release_notes
- Ruby on Rails 3.1 Release Notes
- Upgrading to Rails 3.1
- Rails 3.1 requires at least Ruby 1.8.7
- What to update in your apps
- Gemfile
- config/application.rb
- config/environments/development.rb
- config/environments/production.rb
- config/environments/test.rb
- config/initializers/wrap_parameters.rb
- Remove :cache and :concat options in asset helpers references in views
- Creating a Rails 3.1 application
- Vendoring Gems
- Living on the Edge
- Rails Architectural Changes
- Assets Pipeline
- HTTP Streaming
- Default JS library is now jQuery
- Identity Map
- Railties
- Action Pack
- Action Controller
- Action Dispatch
- Action View
- Active Record
- Active Model
- Active Resource
- Active Support
- Credits
-
3_2_release_notes
- Ruby on Rails 3.2 Release Notes
- Upgrading to Rails 3.2
- Rails 3.2 requires at least Ruby 1.8.7
- What to update in your apps
- What to update in your engines
- Creating a Rails 3.2 application
- Vendoring Gems
- Living on the Edge
- Major Features
- Faster Development Mode & Routing
- Automatic Query Explains
- Tagged Logging
- Documentation
- Railties
- Deprecations
- Action Mailer
- Action Pack
- Action Controller
- Deprecations
- Action Dispatch
- Deprecations
- Action View
- Deprecations
- Sprockets
- Active Record
- Deprecations
- Active Model
- Deprecations
- Active Resource
- Active Support
- Deprecations
- Credits
-
4_0_release_notes
- Ruby on Rails 4.0 Release Notes
- Upgrading to Rails 4.0
- Creating a Rails 4.0 application
- Vendoring Gems
- Living on the Edge
- Major Features
- Upgrade
- ActionPack
- General
- Security
- Extraction of features to gems
- Documentation
- Railties
- Notable changes
- Deprecations
- Action Mailer
- Notable changes
- Deprecations
- Active Model
- Notable changes
- Deprecations
- Active Support
- Notable changes
- Deprecations
- Action Pack
- Notable changes
- Deprecations
- Active Record
- Notable changes
- Deprecations
- Credits
-
4_1_release_notes
- Ruby on Rails 4.1 Release Notes
- Upgrading to Rails 4.1
- Major Features
- Spring Application Preloader
- config/secrets.yml
- Action Pack Variants
- Action Mailer Previews
- Active Record enums
- Message Verifiers
- Module#concerning
- CSRF protection from remote <script> tags
- Railties
- Removals
- Notable changes
- Action Pack
- Removals
- Notable changes
- Action Mailer
- Notable changes
- Active Record
- Removals
- Deprecations
- Notable changes
- Active Model
- Deprecations
- Notable changes
- Active Support
- Removals
- Deprecations
- Notable changes
- Credits
-
4_2_release_notes
- Ruby on Rails 4.2 Release Notes
- Upgrading to Rails 4.2
- Major Features
- Active Job
- Asynchronous Mails
- Adequate Record
- Web Console
- Foreign Key Support
- Incompatibilities
- render with a String Argument
- respond_with / Class-Level respond_to
- Default Host for rails server
- HTML Sanitizer
- assert_select
- Railties
- Removals
- Deprecations
- Notable changes
- Action Pack
- Removals
- Deprecations
- Notable changes
- Action View
- Deprecations
- Notable changes
- Action Mailer
- Deprecations
- Notable changes
- Active Record
- Removals
- Deprecations
- Notable changes
- Active Model
- Removals
- Deprecations
- Notable changes
- Active Support
- Removals
- Deprecations
- Notable changes
- Credits
-
action_controller_overview
- Action Controller Overview
- What Does a Controller Do?
- Controller Naming Convention
- Methods and Actions
- Parameters
- Hash and Array Parameters
- JSON parameters
- Routing Parameters
- default_url_options
- Strong Parameters
- Permitted Scalar Values
- Nested Parameters
- More Examples
- Outside the Scope of Strong Parameters
- Session
- Accessing the Session
- The Flash
- flash.now
- Cookies
- Rendering XML and JSON data
- Filters
- After Filters and Around Filters
- Other Ways to Use Filters
- Request Forgery Protection
- The Request and Response Objects
- The request Object
- path_parameters, query_parameters, and request_parameters
- The response Object
- Setting Custom Headers
- HTTP Authentications
- HTTP Basic Authentication
- HTTP Digest Authentication
- Streaming and File Downloads
- Sending Files
- RESTful Downloads
- Live Streaming of Arbitrary Data
- Incorporating Live Streaming
- Example Usage
- Streaming Considerations
- Log Filtering
- Parameters Filtering
- Redirects Filtering
- Rescue
- The Default 500 and 404 Templates
- rescue_from
- Force HTTPS protocol
-
action_mailer_basics
- Action Mailer Basics
- Introduction
- Sending Emails
- Walkthrough to Generating a Mailer
- Create the Mailer
- Edit the Mailer
- Create a Mailer View
- Calling the Mailer
- Auto encoding header values
- Complete List of Action Mailer Methods
- Adding Attachments
- Making Inline Attachments
- Sending Email To Multiple Recipients
- Sending Email With Name
- Mailer Views
- Action Mailer Layouts
- Generating URLs in Action Mailer Views
- generating URLs with url_for
- generating URLs with named routes
- Sending Multipart Emails
- Sending Emails with Dynamic Delivery Options
- Sending Emails without Template Rendering
- Receiving Emails
- Action Mailer Callbacks
- Using Action Mailer Helpers
- Action Mailer Configuration
- Example Action Mailer Configuration
- Action Mailer Configuration for Gmail
- Mailer Testing
- Intercepting Emails
-
action_view_overview
- Action View Overview
- What is Action View?
- Using Action View with Rails
- Templates, Partials and Layouts
- Templates
- ERB
- Builder
- Template Caching
- Partials
- Naming Partials
- Using Partials to simplify Views
- The as and object options
- Rendering Collections
- Spacer Templates
- Layouts
- Partial Layouts
- View Paths
- Overview of helpers provided by Action View
- RecordTagHelper
- content_tag_for
- div_for
- AssetTagHelper
- auto_discovery_link_tag
- image_path
- image_url
- image_tag
- javascript_include_tag
- javascript_path
- javascript_url
- stylesheet_link_tag
- stylesheet_path
- stylesheet_url
- AtomFeedHelper
- atom_feed
- BenchmarkHelper
- benchmark
- CacheHelper
- cache
- CaptureHelper
- capture
- content_for
- DateHelper
- date_select
- datetime_select
- distance_of_time_in_words
- select_date
- select_datetime
- select_day
- select_hour
- select_minute
- select_month
- select_second
- select_time
- select_year
- time_ago_in_words
- time_select
- DebugHelper
- FormHelper
- check_box
- fields_for
- file_field
- form_for
- hidden_field
- label
- password_field
- radio_button
- text_area
- text_field
- email_field
- url_field
- FormOptionsHelper
- collection_select
- collection_radio_buttons
- collection_check_boxes
- option_groups_from_collection_for_select
- options_for_select
- options_from_collection_for_select
- select
- time_zone_options_for_select
- time_zone_select
- date_field
- FormTagHelper
- check_box_tag
- field_set_tag
- file_field_tag
- form_tag
- hidden_field_tag
- image_submit_tag
- label_tag
- password_field_tag
- radio_button_tag
- select_tag
- submit_tag
- text_area_tag
- text_field_tag
- email_field_tag
- url_field_tag
- date_field_tag
- JavaScriptHelper
- escape_javascript
- javascript_tag
- NumberHelper
- number_to_currency
- number_to_human_size
- number_to_percentage
- number_to_phone
- number_with_delimiter
- number_with_precision
- SanitizeHelper
- sanitize
- sanitize_css(style)
- strip_links(html)
- strip_tags(html)
- CsrfHelper
- Localized Views
- active_job_basics
-
active_model_basics
- Active Model Basics
- Introduction
- Attribute Methods
- Callbacks
- Conversion
- Dirty
- Querying object directly for its list of all changed attributes.
- Attribute based accessor methods
- Validations
- Naming
- Model
- Serialization
- ActiveModel::Serializers
- ActiveModel::Serializers::JSON
- ActiveModel::Serializers::Xml
- Translation
- Lint Tests
- SecurePassword
- Requirements
- Examples
-
active_record_basics
- Active Record Basics
- What is Active Record?
- The Active Record Pattern
- Object Relational Mapping
- Active Record as an ORM Framework
- Convention over Configuration in Active Record
- Naming Conventions
- Schema Conventions
- Creating Active Record Models
- Overriding the Naming Conventions
- CRUD: Reading and Writing Data
- Create
- Read
- Update
- Delete
- Validations
- Callbacks
- Migrations
-
active_record_callbacks
- Active Record Callbacks
- The Object Life Cycle
- Callbacks Overview
- Callback Registration
- Available Callbacks
- Creating an Object
- Updating an Object
- Destroying an Object
- after_initialize and after_find
- after_touch
- Running Callbacks
- Skipping Callbacks
- Halting Execution
- Relational Callbacks
- Conditional Callbacks
- Using :if and :unless with a Symbol
- Using :if and :unless with a String
- Using :if and :unless with a Proc
- Multiple Conditions for Callbacks
- Callback Classes
- Transaction Callbacks
-
active_record_migrations
- Active Record Migrations
- Migration Overview
- Creating a Migration
- Creating a Standalone Migration
- Model Generators
- Passing Modifiers
- Writing a Migration
- Creating a Table
- Creating a Join Table
- Changing Tables
- Changing Columns
- Column Modifiers
- Foreign Keys
- When Helpers aren't Enough
- Using the change Method
- Using reversible
- Using the up/down Methods
- Reverting Previous Migrations
- Running Migrations
- Rolling Back
- Setup the Database
- Resetting the Database
- Running Specific Migrations
- Running Migrations in Different Environments
- Changing the Output of Running Migrations
- Changing Existing Migrations
- Schema Dumping and You
- What are Schema Files for?
- Types of Schema Dumps
- Schema Dumps and Source Control
- Active Record and Referential Integrity
- Migrations and Seed Data
- active_record_postgresql
-
active_record_querying
- Active Record Query Interface
- Retrieving Objects from the Database
- Retrieving a Single Object
- find
- take
- first
- last
- find_by
- Retrieving Multiple Objects in Batches
- find_each
- Options for find_each
- find_in_batches
- Options for find_in_batches
- Conditions
- Pure String Conditions
- Array Conditions
- Placeholder Conditions
- Hash Conditions
- Equality Conditions
- Range Conditions
- Subset Conditions
- NOT Conditions
- Ordering
- Selecting Specific Fields
- Limit and Offset
- Group
- Total of grouped items
- Having
- Overriding Conditions
- unscope
- only
- reorder
- reverse_order
- rewhere
- Null Relation
- Readonly Objects
- Locking Records for Update
- Optimistic Locking
- Pessimistic Locking
- Joining Tables
- Using a String SQL Fragment
- Using Array/Hash of Named Associations
- Joining a Single Association
- Joining Multiple Associations
- Joining Nested Associations (Single Level)
- Joining Nested Associations (Multiple Level)
- Specifying Conditions on the Joined Tables
- Eager Loading Associations
- Eager Loading Multiple Associations
- Array of Multiple Associations
- Nested Associations Hash
- Specifying Conditions on Eager Loaded Associations
- Scopes
- Passing in arguments
- Applying a default scope
- Merging of scopes
- Removing All Scoping
- Dynamic Finders
- Find or Build a New Object
- find_or_create_by
- find_or_create_by!
- find_or_initialize_by
- Finding by SQL
- select_all
- pluck
- ids
- Existence of Objects
- Calculations
- Count
- Average
- Minimum
- Maximum
- Sum
- Running EXPLAIN
- Interpreting EXPLAIN
-
active_record_validations
- Active Record Validations
- Validations Overview
- Why Use Validations?
- When Does Validation Happen?
- Skipping Validations
- valid? and invalid?
- errors[]
- Validation Helpers
- acceptance
- validates_associated
- confirmation
- exclusion
- format
- inclusion
- length
- numericality
- presence
- absence
- uniqueness
- validates_with
- validates_each
- Common Validation Options
- :allow_nil
- :allow_blank
- :message
- :on
- Strict Validations
- Conditional Validation
- Using a Symbol with :if and :unless
- Using a String with :if and :unless
- Using a Proc with :if and :unless
- Grouping Conditional validations
- Combining Validation Conditions
- Performing Custom Validations
- Custom Validators
- Custom Methods
- Working with Validation Errors
- errors
- errors[]
- errors.add
- errors
- errors.clear
- errors.size
- Displaying Validation Errors in Views
-
active_support_core_extensions
- Active Support Core Extensions
- How to Load Core Extensions
- Stand-Alone Active Support
- Cherry-picking a Definition
- Loading Grouped Core Extensions
- Loading All Core Extensions
- Loading All Active Support
- Active Support Within a Ruby on Rails Application
- Extensions to All Objects
- blank? and present?
- presence
- duplicable?
- deep_dup
- try
- class_eval(*args, &block)
- acts_like?(duck)
- to_param
- to_query
- with_options
- JSON support
- Instance Variables
- instance_values
- instance_variable_names
- Silencing Warnings, Streams, and Exceptions
- in?
- Extensions to Module
- alias_method_chain
- Attributes
- alias_attribute
- Internal Attributes
- Module Attributes
- Parents
- parent
- parent_name
- parents
- Constants
- Qualified Constant Names
- Reachable
- Anonymous
- Method Delegation
- Redefining Methods
- Extensions to Class
- Class Attributes
- class_attribute
- cattr_reader, cattr_writer, and cattr_accessor
- Subclasses & Descendants
- subclasses
- descendants
- Extensions to String
- Output Safety
- Motivation
- Safe Strings
- Transformation
- Conversion and Coercion
- Copying
- remove
- squish
- truncate
- truncate_words
- inquiry
- starts_with? and ends_with?
- strip_heredoc
- indent
- Access
- at(position)
- from(position)
- to(position)
- first(limit = 1)
- last(limit = 1)
- Inflections
- pluralize
- singularize
- camelize
- underscore
- titleize
- dasherize
- demodulize
- deconstantize
- parameterize
- tableize
- classify
- constantize
- humanize
- foreign_key
- Conversions
- to_date, to_time, to_datetime
- Extensions to Numeric
- Bytes
- Time
- Formatting
- Extensions to Integer
- multiple_of?
- ordinal
- ordinalize
- Extensions to BigDecimal
- to_s
- to_formatted_s
- Extensions to Enumerable
- sum
- index_by
- many?
- exclude?
- Extensions to Array
- Accessing
- Adding Elements
- prepend
- append
- Options Extraction
- Conversions
- to_sentence
- to_formatted_s
- to_xml
- Wrapping
- Duplicating
- Grouping
- in_groups_of(number, fill_with = nil)
- in_groups(number, fill_with = nil)
- split(value = nil)
- Extensions to Hash
- Conversions
- to_xml
- Merging
- reverse_merge and reverse_merge!
- reverse_update
- deep_merge and deep_merge!
- Deep duplicating
- Working with Keys
- except and except!
- transform_keys and transform_keys!
- stringify_keys and stringify_keys!
- symbolize_keys and symbolize_keys!
- to_options and to_options!
- assert_valid_keys
- Working with Values
- transform_values && transform_values!
- Slicing
- Extracting
- Indifferent Access
- Compacting
- Extensions to Regexp
- multiline?
- Extensions to Range
- to_s
- include?
- overlaps?
- Extensions to Date
- Calculations
- Date.current
- Named dates
- prev_year, next_year
- prev_month, next_month
- prev_quarter, next_quarter
- beginning_of_week, end_of_week
- monday, sunday
- prev_week, next_week
- beginning_of_month, end_of_month
- beginning_of_quarter, end_of_quarter
- beginning_of_year, end_of_year
- Other Date Computations
- years_ago, years_since
- months_ago, months_since
- weeks_ago
- advance
- Changing Components
- Durations
- Timestamps
- beginning_of_day, end_of_day
- beginning_of_hour, end_of_hour
- beginning_of_minute, end_of_minute
- ago, since
- Other Time Computations
- Conversions
- Extensions to DateTime
- Calculations
- Named Datetimes
- DateTime.current
- Other Extensions
- seconds_since_midnight
- utc
- utc?
- advance
- Changing Components
- Durations
- Extensions to Time
- Calculations
- Time.current
- all_day, all_week, all_month, all_quarter and all_year
- Time Constructors
- Durations
- Extensions to File
- atomic_write
- Extensions to Marshal
- load
- Extensions to Logger
- around_
- silence
- datetime_format=
- Extensions to NameError
- Extensions to LoadError
-
active_support_instrumentation
- Active Support Instrumentation
- Introduction to instrumentation
- Rails framework hooks
- Action Controller
- write_fragment.action_controller
- read_fragment.action_controller
- expire_fragment.action_controller
- exist_fragment?.action_controller
- write_page.action_controller
- expire_page.action_controller
- start_processing.action_controller
- process_action.action_controller
- send_file.action_controller
- send_data.action_controller
- redirect_to.action_controller
- halted_callback.action_controller
- Action View
- render_template.action_view
- render_partial.action_view
- Active Record
- sql.active_record
- identity.active_record
- Action Mailer
- receive.action_mailer
- deliver.action_mailer
- Active Support
- cache_read.active_support
- cache_generate.active_support
- cache_fetch_hit.active_support
- cache_write.active_support
- cache_delete.active_support
- cache_exist?.active_support
- Railties
- load_config_initializer.railties
- Rails
- deprecation.rails
- Subscribing to an event
- Creating custom events
- api_documentation_guidelines
-
asset_pipeline
- The Asset Pipeline
- What is the Asset Pipeline?
- Main Features
- What is Fingerprinting and Why Should I Care?
- How to Use the Asset Pipeline
- Controller Specific Assets
- Asset Organization
- Search Paths
- Using Index Files
- Coding Links to Assets
- CSS and ERB
- CSS and Sass
- JavaScript/CoffeeScript and ERB
- Manifest Files and Directives
- Preprocessing
- In Development
- Runtime Error Checking
- Turning Digests Off
- Turning Debugging Off
- In Production
- Precompiling Assets
- Far-future Expires Header
- Local Precompilation
- Live Compilation
- CDNs
- Set up a CDN to Serve Static Assets
- Customize CDN Caching Behavior
- CDN Request Caching
- CDN Header Debugging
- CDNs and the Cache-Control Header
- CDNs and URL based Cache Invalidation
- Customizing the Pipeline
- CSS Compression
- JavaScript Compression
- Using Your Own Compressor
- Changing the assets Path
- X-Sendfile Headers
- Assets Cache Store
- Adding Assets to Your Gems
- Making Your Library or Gem a Pre-Processor
- Upgrading from Old Versions of Rails
-
association_basics
- Active Record Associations
- Why Associations?
- The Types of Associations
- The belongs_to Association
- The has_one Association
- The has_many Association
- The has_many :through Association
- The has_one :through Association
- The has_and_belongs_to_many Association
- Choosing Between belongs_to and has_one
- Choosing Between has_many :through and has_and_belongs_to_many
- Polymorphic Associations
- Self Joins
- Tips, Tricks, and Warnings
- Controlling Caching
- Avoiding Name Collisions
- Updating the Schema
- Creating Foreign Keys for belongs_to Associations
- Creating Join Tables for has_and_belongs_to_many Associations
- Controlling Association Scope
- Bi-directional Associations
- Detailed Association Reference
- belongs_to Association Reference
- Methods Added by belongs_to
- association(force_reload = false)
- association=(associate)
- build_association(attributes = {})
- create_association(attributes = {})
- create_association!(attributes = {})
- Options for belongs_to
- :autosave
- :class_name
- :counter_cache
- :dependent
- :foreign_key
- :inverse_of
- :polymorphic
- :touch
- :validate
- Scopes for belongs_to
- where
- includes
- readonly
- select
- Do Any Associated Objects Exist?
- When are Objects Saved?
- has_one Association Reference
- Methods Added by has_one
- association(force_reload = false)
- association=(associate)
- build_association(attributes = {})
- create_association(attributes = {})
- create_association!(attributes = {})
- Options for has_one
- :as
- :autosave
- :class_name
- :dependent
- :foreign_key
- :inverse_of
- :primary_key
- :source
- :source_type
- :through
- :validate
- Scopes for has_one
- where
- includes
- readonly
- select
- Do Any Associated Objects Exist?
- When are Objects Saved?
- has_many Association Reference
- Methods Added by has_many
- collection(force_reload = false)
- collection<<(object, …)
- collection.delete(object, …)
- collection.destroy(object, …)
- collection=(objects)
- collection_singular_ids
- collection_singular_ids=(ids)
- collection.clear
- collection.empty?
- collection.size
- collection.find(…)
- collection.where(…)
- collection.exists?(…)
- collection.build(attributes = {}, …)
- collection.create(attributes = {})
- collection.create!(attributes = {})
- Options for has_many
- :as
- :autosave
- :class_name
- :dependent
- :foreign_key
- :inverse_of
- :primary_key
- :source
- :source_type
- :through
- :validate
- Scopes for has_many
- where
- extending
- group
- includes
- limit
- offset
- order
- readonly
- select
- distinct
- When are Objects Saved?
- has_and_belongs_to_many Association Reference
- Methods Added by has_and_belongs_to_many
- Additional Column Methods
- collection(force_reload = false)
- collection<<(object, …)
- collection.delete(object, …)
- collection.destroy(object, …)
- collection=(objects)
- collection_singular_ids
- collection_singular_ids=(ids)
- collection.clear
- collection.empty?
- collection.size
- collection.find(…)
- collection.where(…)
- collection.exists?(…)
- collection.build(attributes = {})
- collection.create(attributes = {})
- collection.create!(attributes = {})
- Options for has_and_belongs_to_many
- :association_foreign_key
- :autosave
- :class_name
- :foreign_key
- :join_table
- :validate
- Scopes for has_and_belongs_to_many
- where
- extending
- group
- includes
- limit
- offset
- order
- readonly
- select
- uniq
- When are Objects Saved?
- Association Callbacks
- Association Extensions
-
autoloading_and_reloading_constants
- Autoloading and Reloading Constants
- Introduction
- Constants Refresher
- Nesting
- Class and Module Definitions are Constant Assignments
- Constants are Stored in Modules
- Resolution Algorithms
- Resolution Algorithm for Relative Constants
- Resolution Algorithm for Qualified Constants
- Vocabulary
- Parent Namespaces
- Loading Mechanism
- Autoloading Availability
- autoload_paths
- Autoloading Algorithms
- Relative References
- Constants after the class and module Keywords
- Top-Level Constants
- Namespaces
- Qualified References
- Automatic Modules
- Generic Procedure
- require_dependency
- Constant Reloading
- Module#autoload isn't Involved
- Common Gotchas
- Nesting and Qualified Constants
- Autoloading and STI
- Autoloading and require
- Autoloading and Initializers
- require_dependency and Initializers
- When Constants aren't Missed
- Relative References
- Qualified References
- Autoloading within Singleton Classes
- Autoloading in BasicObject
-
caching_with_rails
- Caching with Rails: An overview
- Basic Caching
- Page Caching
- Action Caching
- Fragment Caching
- Low-Level Caching
- SQL Caching
- Cache Stores
- Configuration
- ActiveSupport::Cache::Store
- ActiveSupport::Cache::MemoryStore
- ActiveSupport::Cache::FileStore
- ActiveSupport::Cache::MemCacheStore
- ActiveSupport::Cache::EhcacheStore
- ActiveSupport::Cache::NullStore
- Custom Cache Stores
- Cache Keys
- Conditional GET support
-
command_line
- The Rails Command Line
- Command Line Basics
- rails new
- rails server
- rails generate
- rails console
- The app and helper objects
- rails dbconsole
- rails runner
- rails destroy
- Rake
- about
- assets
- db
- doc
- notes
- routes
- test
- tmp
- Miscellaneous
- Custom Rake Tasks
- The Rails Advanced Command Line
- Rails with Databases and SCM
-
configuring
- Configuring Rails Applications
- Locations for Initialization Code
- Running Code Before Rails
- Configuring Rails Components
- Rails General Configuration
- Configuring Assets
- Configuring Generators
- Configuring Middleware
- Configuring i18n
- Configuring Active Record
- Configuring Action Controller
- Configuring Action Dispatch
- Configuring Action View
- Configuring Action Mailer
- Configuring Active Support
- Configuring a Database
- Connection Preference
- Configuring an SQLite3 Database
- Configuring a MySQL Database
- Configuring a PostgreSQL Database
- Configuring an SQLite3 Database for JRuby Platform
- Configuring a MySQL Database for JRuby Platform
- Configuring a PostgreSQL Database for JRuby Platform
- Creating Rails Environments
- Deploy to a subdirectory (relative url root)
- Using Passenger
- Using a Reverse Proxy
- Considerations when deploying to a subdirectory
- Rails Environment Settings
- Using Initializer Files
- Initialization events
- Rails::Railtie#initializer
- Initializers
- Database pooling
- Custom configuration
-
contributing_to_ruby_on_rails
- Contributing to Ruby on Rails
- Reporting an Issue
- Creating a Bug Report
- Create a Self-Contained gist for Active Record and Action Controller Issues
- Special Treatment for Security Issues
- What about Feature Requests?
- Helping to Resolve Existing Issues
- Verifying Bug Reports
- Testing Patches
- Contributing to the Rails Documentation
- Contributing to the Rails Code
- Setting Up a Development Environment
- The Easy Way
- The Hard Way
- Clone the Rails Repository
- Running an Application Against Your Local Branch
- Write Your Code
- Follow the Coding Conventions
- Benchmark Your Code
- Running Tests
- Entire Rails:
- For a Particular Component
- Running a Single Test
- Testing Active Record
- Warnings
- Updating the CHANGELOG
- Updating the Gemfile.lock
- Sanity Check
- Commit Your Changes
- Update Your Branch
- Fork
- Issue a Pull Request
- Get some Feedback
- Iterate as Necessary
- Squashing commits
- Updating pull request
- Older Versions of Ruby on Rails
- Backporting
- Rails Contributors
-
debugging_rails_applications
- Debugging Rails Applications
- View Helpers for Debugging
- debug
- to_yaml
- inspect
- The Logger
- What is the Logger?
- Log Levels
- Sending Messages
- Tagged Logging
- Impact of Logs on Performance
- Debugging with the byebug gem
- Setup
- The Shell
- The Context
- Threads
- Inspecting Variables
- Step by Step
- Breakpoints
- Catching Exceptions
- Resuming Execution
- Editing
- Quitting
- Settings
- Debugging Memory Leaks
- Valgrind
- Plugins for Debugging
- References
- development_dependencies_install
- documents.yaml
-
engines
- Getting Started with Engines
- What are engines?
- Generating an engine
- Inside an Engine
- Critical Files
- app Directory
- bin Directory
- test Directory
- Providing engine functionality
- Generating an Article Resource
- Generating a Comments Resource
- Hooking Into an Application
- Mounting the Engine
- Engine setup
- Using a Class Provided by the Application
- Using a Model Provided by the Application
- Using a Controller Provided by the Application
- Configuring an Engine
- Setting Configuration Settings in the Application
- General Engine Configuration
- Testing an engine
- Functional Tests
- Improving engine functionality
- Overriding Models and Controllers
- A note on Decorators and Loading Code
- Implementing Decorator Pattern Using Class#class_eval
- Implementing Decorator Pattern Using ActiveSupport::Concern
- Overriding Views
- Routes
- Assets
- Separate Assets & Precompiling
- Other Gem Dependencies
-
form_helpers
- Form Helpers
- Dealing with Basic Forms
- A Generic Search Form
- Multiple Hashes in Form Helper Calls
- Helpers for Generating Form Elements
- Checkboxes
- Radio Buttons
- Other Helpers of Interest
- Dealing with Model Objects
- Model Object Helpers
- Binding a Form to an Object
- Relying on Record Identification
- Dealing with Namespaces
- How do forms with PATCH, PUT, or DELETE methods work?
- Making Select Boxes with Ease
- The Select and Option Tags
- Select Boxes for Dealing with Models
- Option Tags from a Collection of Arbitrary Objects
- Time Zone and Country Select
- Using Date and Time Form Helpers
- Barebones Helpers
- Model Object Helpers
- Common Options
- Individual Components
- Uploading Files
- What Gets Uploaded
- Dealing with Ajax
- Customizing Form Builders
- Understanding Parameter Naming Conventions
- Basic Structures
- Combining Them
- Using Form Helpers
- Forms to External Resources
- Building Complex Forms
- Configuring the Model
- Nested Forms
- The Controller
- Removing Objects
- Preventing Empty Records
- Adding Fields on the Fly
-
generators
- Creating and Customizing Rails Generators & Templates
- First Contact
- Creating Your First Generator
- Creating Generators with Generators
- Generators Lookup
- Customizing Your Workflow
- Customizing Your Workflow by Changing Generators Templates
- Adding Generators Fallbacks
- Application Templates
- Generator methods
- gem
- gem_group
- add_source
- inject_into_file
- gsub_file
- application
- git
- vendor
- lib
- rakefile
- initializer
- generate
- rake
- capify!
- route
- readme
-
getting_started
- Getting Started with Rails
- Guide Assumptions
- What is Rails?
- Creating a New Rails Project
- Installing Rails
- Creating the Blog Application
- Hello, Rails!
- Starting up the Web Server
- Say “Hello”, Rails
- Setting the Application Home Page
- Getting Up and Running
- Laying down the ground work
- The first form
- Creating articles
- Creating the Article model
- Running a Migration
- Saving data in the controller
- Showing Articles
- Listing all articles
- Adding links
- Adding Some Validation
- Updating Articles
- Using partials to clean up duplication in views
- Deleting Articles
- Adding a Second Model
- Generating a Model
- Associating Models
- Adding a Route for Comments
- Generating a Controller
- Refactoring
- Rendering Partial Collections
- Rendering a Partial Form
- Deleting Comments
- Deleting Associated Objects
- Security
- Basic Authentication
- Other Security Considerations
- What's Next?
- Configuration Gotchas
-
i18n
- Rails Internationalization (I18n) API
- How I18n in Ruby on Rails Works
- The Overall Architecture of the Library
- The Public I18n API
- Setup the Rails Application for Internationalization
- Configure the I18n Module
- Optional: Custom I18n Configuration Setup
- Setting and Passing the Locale
- Setting the Locale from the Domain Name
- Setting the Locale from the URL Params
- Setting the Locale from the Client Supplied Information
- Using Accept-Language
- Using GeoIP (or Similar) Database
- User Profile
- Internationalizing your Application
- Adding Translations
- Passing variables to translations
- Adding Date/Time Formats
- Inflection Rules For Other Locales
- Localized Views
- Organization of Locale Files
- Overview of the I18n API Features
- Looking up Translations
- Basic Lookup, Scopes and Nested Keys
- Defaults
- Bulk and Namespace Lookup
- “Lazy” Lookup
- Interpolation
- Pluralization
- Setting and Passing a Locale
- Using Safe HTML Translations
- Translations for Active Record Models
- Error Message Scopes
- Error Message Interpolation
- Translations for the Active Record error_messages_for Helper
- Translations for Action Mailer E-Mail Subjects
- Overview of Other Built-In Methods that Provide I18n Support
- Action View Helper Methods
- Active Model Methods
- Active Support Methods
- How to Store your Custom Translations
- Customize your I18n Setup
- Using Different Backends
- Using Different Exception Handlers
- Conclusion
- Contributing to Rails I18n
- Resources
- Authors
- Footnotes
-
initialization
- The Rails Initialization Process
- Launch!
- railties/bin/rails
- railties/lib/rails/app_rails_loader.rb
- bin/rails
- config/boot.rb
- rails/commands.rb
- rails/commands/command_tasks.rb
- actionpack/lib/action_dispatch.rb
- rails/commands/server.rb
- Rack: lib/rack/server.rb
- config/application
- Rails::Server#start
- config/environment.rb
- config/application.rb
- Loading Rails
- railties/lib/rails/all.rb
- Back to config/environment.rb
- railties/lib/rails/application.rb
- Rack: lib/rack/server.rb
-
layouts_and_rendering
- Layouts and Rendering in Rails
- Overview: How the Pieces Fit Together
- Creating Responses
- Rendering by Default: Convention Over Configuration in Action
- Using render
- Rendering Nothing
- Rendering an Action's View
- Rendering an Action's Template from Another Controller
- Rendering an Arbitrary File
- Wrapping it up
- Using render with :inline
- Rendering Text
- Rendering HTML
- Rendering JSON
- Rendering XML
- Rendering Vanilla JavaScript
- Rendering raw body
- Options for render
- The :content_type Option
- The :layout Option
- The :location Option
- The :status Option
- Finding Layouts
- Specifying Layouts for Controllers
- Choosing Layouts at Runtime
- Conditional Layouts
- Layout Inheritance
- Avoiding Double Render Errors
- Using redirect_to
- Getting a Different Redirect Status Code
- The Difference Between render and redirect_to
- Using head To Build Header-Only Responses
- Structuring Layouts
- Asset Tag Helpers
- Linking to Feeds with the auto_discovery_link_tag
- Linking to JavaScript Files with the javascript_include_tag
- Linking to CSS Files with the stylesheet_link_tag
- Linking to Images with the image_tag
- Linking to Videos with the video_tag
- Linking to Audio Files with the audio_tag
- Understanding yield
- Using the content_for Method
- Using Partials
- Naming Partials
- Using Partials to Simplify Views
- Partial Layouts
- Passing Local Variables
- Rendering Collections
- Local Variables
- Spacer Templates
- Collection Partial Layouts
- Using Nested Layouts
- maintenance_policy
-
nested_model_forms
- Rails Nested Model Forms
- Model setup
- ActiveRecord::Base model
- has_one
- belongs_to
- has_many / has_and_belongs_to_many
- Custom model
- Single associated object
- Association collection
- Views
- Controller code
- Form code
- Standard form
- Nested form for a single associated object
- Nested form for a collection of associated objects
- plugins
-
rails_application_templates
- Rails Application Templates
- Usage
- Template API
- gem(*args)
- gem_group(*names, &block)
- add_source(source, options = {})
- environment/application(data=nil, options={}, &block)
- vendor/lib/file/initializer(filename, data = nil, &block)
- rakefile(filename, data = nil, &block)
- generate(what, *args)
- run(command)
- rake(command, options = {})
- route(routing_code)
- inside(dir)
- ask(question)
- yes?(question) or no?(question)
- git(:command)
- after_bundle(&block)
- Advanced Usage
-
rails_on_rack
- Rails on Rack
- Introduction to Rack
- Rails on Rack
- Rails Application's Rack Object
- rails server
- rackup
- Development and auto-reloading
- Action Dispatcher Middleware Stack
- Inspecting Middleware Stack
- Configuring Middleware Stack
- Adding a Middleware
- Swapping a Middleware
- Deleting a Middleware
- Internal Middleware Stack
- Resources
- Learning Rack
- Understanding Middlewares
-
routing
- Rails Routing from the Outside In
- The Purpose of the Rails Router
- Connecting URLs to Code
- Generating Paths and URLs from Code
- Resource Routing: the Rails Default
- Resources on the Web
- CRUD, Verbs, and Actions
- Path and URL Helpers
- Defining Multiple Resources at the Same Time
- Singular Resources
- Controller Namespaces and Routing
- Nested Resources
- Limits to Nesting
- Shallow Nesting
- Routing concerns
- Creating Paths and URLs From Objects
- Adding More RESTful Actions
- Adding Member Routes
- Adding Collection Routes
- Adding Routes for Additional New Actions
- Non-Resourceful Routes
- Bound Parameters
- Dynamic Segments
- Static Segments
- The Query String
- Defining Defaults
- Naming Routes
- HTTP Verb Constraints
- Segment Constraints
- Request-Based Constraints
- Advanced Constraints
- Route Globbing and Wildcard Segments
- Redirection
- Routing to Rack Applications
- Using root
- Unicode character routes
- Customizing Resourceful Routes
- Specifying a Controller to Use
- Specifying Constraints
- Overriding the Named Helpers
- Overriding the new and edit Segments
- Prefixing the Named Route Helpers
- Restricting the Routes Created
- Translated Paths
- Overriding the Singular Form
- Using :as in Nested Resources
- Overriding Named Route Parameters
- Inspecting and Testing Routes
- Listing Existing Routes
- Testing Routes
- The assert_generates Assertion
- The assert_recognizes Assertion
- The assert_routing Assertion
- ruby_on_rails_guides_guidelines
-
security
- Ruby on Rails Security Guide
- Introduction
- Sessions
- What are Sessions?
- Session id
- Session Hijacking
- Session Guidelines
- Session Storage
- Replay Attacks for CookieStore Sessions
- Session Fixation
- Session Fixation - Countermeasures
- Session Expiry
- Cross-Site Request Forgery (CSRF)
- CSRF Countermeasures
- Redirection and Files
- Redirection
- Self-contained XSS
- File Uploads
- Executable Code in File Uploads
- File Downloads
- Intranet and Admin Security
- Additional Precautions
- User Management
- Brute-Forcing Accounts
- Account Hijacking
- Passwords
- Other
- CAPTCHAs
- Logging
- Good Passwords
- Regular Expressions
- Privilege Escalation
- Injection
- Whitelists versus Blacklists
- SQL Injection
- Introduction
- Bypassing Authorization
- Unauthorized Reading
- Countermeasures
- Cross-Site Scripting (XSS)
- Entry Points
- HTML/JavaScript Injection
- Cookie Theft
- Defacement
- Countermeasures
- Obfuscation and Encoding Injection
- Examples from the Underground
- CSS Injection
- Countermeasures
- Textile Injection
- Countermeasures
- Ajax Injection
- Command Line Injection
- Header Injection
- Response Splitting
- Unsafe Query Generation
- Default Headers
- Environmental Security
- Additional Resources
-
testing
- A Guide to Testing Rails Applications
- Why Write Tests for your Rails Applications?
- Introduction to Testing
- The Test Environment
- Rails Sets up for Testing from the Word Go
- The Low-Down on Fixtures
- What Are Fixtures?
- YAML
- ERB'in It Up
- Fixtures in Action
- Fixtures are Active Record objects
- Unit Testing your Models
- Maintaining the test database schema
- Running Tests
- What to Include in Your Unit Tests
- Available Assertions
- Rails Specific Assertions
- Functional Tests for Your Controllers
- What to Include in your Functional Tests
- Available Request Types for Functional Tests
- The Four Hashes of the Apocalypse
- Instance Variables Available
- Setting Headers and CGI variables
- Testing Templates and Layouts
- A Fuller Functional Test Example
- Testing Views
- Additional View-Based Assertions
- Integration Testing
- Helpers Available for Integration Tests
- Integration Testing Examples
- Rake Tasks for Running your Tests
- A Brief Note About Minitest
- Setup and Teardown
- Testing Routes
- Testing Your Mailers
- Keeping the Postman in Check
- From All Sides
- Unit Testing
- Revenge of the Fixtures
- The Basic Test Case
- Functional Testing
- Testing helpers
- Testing Jobs
- A Basic Test Case
- Custom Assertions And Testing Jobs Inside Other Components
- Other Testing Approaches
-
upgrading_ruby_on_rails
- A Guide for Upgrading Ruby on Rails
- General Advice
- Test Coverage
- Ruby Versions
- The Rake Task
- Upgrading from Rails 4.1 to Rails 4.2
- Web Console
- Responders
- Error handling in transaction callbacks
- Ordering of test cases
- Serialized attributes
- Production log level
- after_bundle in Rails templates
- Rails HTML Sanitizer
- Rails DOM Testing
- Masked Authenticity Tokens
- Action Mailer
- Foreign Key Support
- Upgrading from Rails 4.0 to Rails 4.1
- CSRF protection from remote <script> tags
- Spring
- config/secrets.yml
- Changes to test helper
- Cookies serializer
- Flash structure changes
- Changes in JSON handling
- MultiJSON removal
- JSON gem compatibility
- New JSON encoder
- JSON representation of Time objects
- Usage of return within inline callback blocks
- Methods defined in Active Record fixtures
- I18n enforcing available locales
- Mutator methods called on Relation
- Changes on Default Scopes
- Rendering content from string
- PostgreSQL json and hstore datatypes
- Explicit block use for ActiveSupport::Callbacks
- Upgrading from Rails 3.2 to Rails 4.0
- HTTP PATCH
- A note about media types
- Gemfile
- vendor/plugins
- Active Record
- Active Resource
- Active Model
- Action Pack
- Active Support
- Helpers Loading Order
- Active Record Observer and Action Controller Sweeper
- sprockets-rails
- sass-rails
- Upgrading from Rails 3.1 to Rails 3.2
- Gemfile
- config/environments/development.rb
- config/environments/test.rb
- vendor/plugins
- Active Record
- Upgrading from Rails 3.0 to Rails 3.1
- Gemfile
- config/application.rb
- config/environments/development.rb
- config/environments/production.rb
- config/environments/test.rb
- config/initializers/wrap_parameters.rb
- config/initializers/session_store.rb
- Remove :cache and :concat options in asset helpers references in views
- working_with_javascript_in_rails
Classes and Modules
- ActiveRecord
- BugTest
- Comment
- Kindle
- Minitest
- Object
- Post
- RailsGuides
- RailsGuides::Generator
- RailsGuides::Helpers
- RailsGuides::Indexer
- RailsGuides::Levenshtein
- RailsGuides::Markdown
- RailsGuides::Markdown::Renderer
- RailsGuides::Validator
- TestApp
- TestController
Methods
- ::distance — RailsGuides::Levenshtein
- ::new — RailsGuides::Indexer
- ::new — RailsGuides::Markdown
- ::new — RailsGuides::Generator
- ::new — RailsGuides::Markdown::Renderer
- #add_head_section — Kindle
- #app — BugTest
- #author — RailsGuides::Helpers
- #block_code — RailsGuides::Markdown::Renderer
- #brush_for — RailsGuides::Markdown::Renderer
- #bundler? — Object
- #check_for_kindlegen — RailsGuides::Generator
- #check_fragment_identifiers — RailsGuides::Generator
- #code — RailsGuides::Helpers
- #convert_footnotes — RailsGuides::Markdown::Renderer
- #convert_notes — RailsGuides::Markdown::Renderer
- #copy_assets — RailsGuides::Generator
- #create_output_dir_if_needed — RailsGuides::Generator
- #docs_for_menu — RailsGuides::Helpers
- #documents_by_section — RailsGuides::Helpers
- #documents_flat — RailsGuides::Helpers
- #dom_id — RailsGuides::Markdown
- #dom_id_text — RailsGuides::Markdown
- #engine — RailsGuides::Markdown
- #extract_anchors — RailsGuides::Generator
- #extract_raw_header_and_body — RailsGuides::Markdown
- #finished_documents — RailsGuides::Helpers
- #generate — RailsGuides::Generator
- #generate — Kindle
- #generate? — RailsGuides::Generator
- #generate_body — RailsGuides::Markdown
- #generate_document_metadata — Kindle
- #generate_front_matter — Kindle
- #generate_guide — RailsGuides::Generator
- #generate_guides — RailsGuides::Generator
- #generate_header — RailsGuides::Markdown
- #generate_index — RailsGuides::Markdown
- #generate_mobi — RailsGuides::Generator
- #generate_sections — Kindle
- #generate_structure — RailsGuides::Markdown
- #generate_title — RailsGuides::Markdown
- #guide — RailsGuides::Helpers
- #guides_to_generate — RailsGuides::Generator
- #guides_to_validate — RailsGuides::Validator
- #header — RailsGuides::Markdown::Renderer
- #index — TestController
- #index — RailsGuides::Indexer
- #initialize_dirs — RailsGuides::Generator
- #kindle? — RailsGuides::Generator
- #mobi — RailsGuides::Generator
- #node_index — RailsGuides::Markdown
- #output_file_for — RailsGuides::Generator
- #output_path_for — RailsGuides::Generator
- #paragraph — RailsGuides::Markdown::Renderer
- #process — RailsGuides::Indexer
- #register_kindle_mime_types — RailsGuides::Generator
- #render — RailsGuides::Markdown
- #render_page — RailsGuides::Markdown
- #select_only — RailsGuides::Generator
- #select_only — RailsGuides::Validator
- #set_flags_from_environment — RailsGuides::Generator
- #show_results — RailsGuides::Validator
- #test_association_stuff — BugTest
- #test_returns_success — BugTest
- #test_stuff — BugTest
- #title_to_idx — RailsGuides::Indexer
- #validate — RailsGuides::Validator
- #warn_about_broken_links — RailsGuides::Generator