mirror of
https://github.com/github/rails.git
synced 2026-04-26 03:00:59 -04:00
Adds title and proper formatting to docs.
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
module ActiveRecord #:nodoc:
|
||||
# = Active Record Serialization
|
||||
module Serialization
|
||||
extend ActiveSupport::Concern
|
||||
include ActiveModel::Serializers::JSON
|
||||
@@ -22,6 +23,7 @@ module ActiveRecord #:nodoc:
|
||||
|
||||
private
|
||||
# Add associations specified via the <tt>:includes</tt> option.
|
||||
#
|
||||
# Expects a block that takes as arguments:
|
||||
# +association+ - name of the association
|
||||
# +records+ - the association record(s) to be serialized
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
module ActiveRecord
|
||||
# = Active Record Session Store
|
||||
#
|
||||
# A session store backed by an Active Record class. A default class is
|
||||
# provided, but any object duck-typing to an Active Record Session class
|
||||
# with text +session_id+ and +data+ attributes is sufficient.
|
||||
@@ -7,6 +9,7 @@ module ActiveRecord
|
||||
# +id+ (numeric primary key),
|
||||
# +session_id+ (text, or longtext if your session data exceeds 65K), and
|
||||
# +data+ (text or longtext; careful if your session data exceeds 65KB).
|
||||
#
|
||||
# The +session_id+ column should always be indexed for speedy lookups.
|
||||
# Session data is marshaled to the +data+ column in Base64 format.
|
||||
# If the data you write is larger than the column's size limit,
|
||||
@@ -14,9 +17,11 @@ module ActiveRecord
|
||||
#
|
||||
# You may configure the table name, primary key, and data column.
|
||||
# For example, at the end of <tt>config/environment.rb</tt>:
|
||||
#
|
||||
# ActiveRecord::SessionStore::Session.table_name = 'legacy_session_table'
|
||||
# ActiveRecord::SessionStore::Session.primary_key = 'session_id'
|
||||
# ActiveRecord::SessionStore::Session.data_column_name = 'legacy_session_data'
|
||||
#
|
||||
# Note that setting the primary key to the +session_id+ frees you from
|
||||
# having a separate +id+ column if you don't want it. However, you must
|
||||
# set <tt>session.model.id = session.session_id</tt> by hand! A before filter
|
||||
@@ -29,8 +34,11 @@ module ActiveRecord
|
||||
# You may provide your own session class implementation, whether a
|
||||
# feature-packed Active Record or a bare-metal high-performance SQL
|
||||
# store, by setting
|
||||
#
|
||||
# ActiveRecord::SessionStore.session_class = MySessionClass
|
||||
#
|
||||
# You must implement these methods:
|
||||
#
|
||||
# self.find_by_session_id(session_id)
|
||||
# initialize(hash_of_session_id_and_data)
|
||||
# attr_reader :session_id
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
module ActiveRecord
|
||||
# = Active Record Test Case
|
||||
#
|
||||
# Defines some test assertions to test against SQL queries.
|
||||
class TestCase < ActiveSupport::TestCase #:nodoc:
|
||||
def assert_date_from_db(expected, actual, message = nil)
|
||||
# SybaseAdapter doesn't have a separate column type just for dates,
|
||||
|
||||
@@ -1,11 +1,16 @@
|
||||
module ActiveRecord
|
||||
# Active Record automatically timestamps create and update operations if the table has fields
|
||||
# named created_at/created_on or updated_at/updated_on.
|
||||
# = Active Record Timestamp
|
||||
#
|
||||
# Active Record automatically timestamps create and update operations if the
|
||||
# table has fields named <tt>created_at/created_on</tt> or
|
||||
# <tt>updated_at/updated_on</tt>.
|
||||
#
|
||||
# Timestamping can be turned off by setting:
|
||||
#
|
||||
# Timestamping can be turned off by setting
|
||||
# <tt>ActiveRecord::Base.record_timestamps = false</tt>
|
||||
#
|
||||
# Timestamps are in the local timezone by default but you can use UTC by setting
|
||||
# Timestamps are in the local timezone by default but you can use UTC by setting:
|
||||
#
|
||||
# <tt>ActiveRecord::Base.default_timezone = :utc</tt>
|
||||
module Timestamp
|
||||
extend ActiveSupport::Concern
|
||||
@@ -16,8 +21,9 @@ module ActiveRecord
|
||||
end
|
||||
|
||||
# Saves the record with the updated_at/on attributes set to the current time.
|
||||
# If the save fails because of validation errors, an ActiveRecord::RecordInvalid exception is raised.
|
||||
# If an attribute name is passed, that attribute is used for the touch instead of the updated_at/on attributes.
|
||||
# If the save fails because of validation errors, an
|
||||
# ActiveRecord::RecordInvalid exception is raised. If an attribute name is passed,
|
||||
# that attribute is used for the touch instead of the updated_at/on attributes.
|
||||
#
|
||||
# Examples:
|
||||
#
|
||||
|
||||
Reference in New Issue
Block a user