Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
张重言
rails
提交
49738f00
R
rails
项目概览
张重言
/
rails
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
rails
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
49738f00
编写于
5月 21, 2008
作者:
X
Xavier Noria
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
gsub("ActiveRecord", "Active Record")
上级
bc0e2404
变更
17
隐藏空白更改
内联
并排
Showing
17 changed file
with
55 addition
and
54 deletion
+55
-54
actionpack/lib/action_controller/assertions/model_assertions.rb
...pack/lib/action_controller/assertions/model_assertions.rb
+2
-1
actionpack/lib/action_controller/polymorphic_routes.rb
actionpack/lib/action_controller/polymorphic_routes.rb
+1
-1
actionpack/lib/action_view/helpers/form_options_helper.rb
actionpack/lib/action_view/helpers/form_options_helper.rb
+1
-1
actionpack/lib/action_view/helpers/form_tag_helper.rb
actionpack/lib/action_view/helpers/form_tag_helper.rb
+1
-1
actionpack/lib/action_view/helpers/record_tag_helper.rb
actionpack/lib/action_view/helpers/record_tag_helper.rb
+2
-2
activerecord/lib/active_record/associations.rb
activerecord/lib/active_record/associations.rb
+3
-3
activerecord/lib/active_record/attribute_methods.rb
activerecord/lib/active_record/attribute_methods.rb
+1
-1
activerecord/lib/active_record/base.rb
activerecord/lib/active_record/base.rb
+15
-15
activerecord/lib/active_record/fixtures.rb
activerecord/lib/active_record/fixtures.rb
+9
-9
activerecord/lib/active_record/migration.rb
activerecord/lib/active_record/migration.rb
+1
-1
activerecord/lib/active_record/named_scope.rb
activerecord/lib/active_record/named_scope.rb
+1
-1
activerecord/lib/active_record/observer.rb
activerecord/lib/active_record/observer.rb
+1
-1
activerecord/lib/active_record/schema_dumper.rb
activerecord/lib/active_record/schema_dumper.rb
+1
-1
activerecord/lib/active_record/transactions.rb
activerecord/lib/active_record/transactions.rb
+2
-2
railties/configs/initializers/new_rails_defaults.rb
railties/configs/initializers/new_rails_defaults.rb
+4
-4
railties/environments/environment.rb
railties/environments/environment.rb
+1
-1
railties/lib/initializer.rb
railties/lib/initializer.rb
+9
-9
未找到文件。
actionpack/lib/action_controller/assertions/model_assertions.rb
浏览文件 @
49738f00
module
ActionController
module
Assertions
module
ModelAssertions
# Ensures that the passed record is valid by ActiveRecord standards and returns any error messages if it is not.
# Ensures that the passed record is valid by Active Record standards and
# returns any error messages if it is not.
#
# ==== Examples
#
...
...
actionpack/lib/action_controller/polymorphic_routes.rb
浏览文件 @
49738f00
module
ActionController
# Polymorphic URL helpers are methods for smart resolution to a named route call when
# given an ActiveRecord model instance. They are to be used in combination with
# given an Active
Record model instance. They are to be used in combination with
# ActionController::Resources.
#
# These methods are useful when you want to generate correct URL or path to a RESTful
...
...
actionpack/lib/action_view/helpers/form_options_helper.rb
浏览文件 @
49738f00
...
...
@@ -298,7 +298,7 @@ def country_options_for_select(selected = nil, priority_countries = nil)
# a TimeZone.
#
# By default, +model+ is the TimeZone constant (which can be obtained
# in ActiveRecord as a value object). The only requirement is that the
# in Active
Record as a value object). The only requirement is that the
# +model+ parameter be an object that responds to +all+, and returns
# an array of objects that represent time zones.
#
...
...
actionpack/lib/action_view/helpers/form_tag_helper.rb
浏览文件 @
49738f00
...
...
@@ -3,7 +3,7 @@
module
ActionView
module
Helpers
# Provides a number of methods for creating form tags that doesn't rely on an ActiveRecord object assigned to the template like
# Provides a number of methods for creating form tags that doesn't rely on an Active
Record object assigned to the template like
# FormHelper does. Instead, you provide the names and values manually.
#
# NOTE: The HTML options <tt>disabled</tt>, <tt>readonly</tt>, and <tt>multiple</tt> can all be treated as booleans. So specifying
...
...
actionpack/lib/action_view/helpers/record_tag_helper.rb
浏览文件 @
49738f00
...
...
@@ -2,7 +2,7 @@ module ActionView
module
Helpers
module
RecordTagHelper
# Produces a wrapper DIV element with id and class parameters that
# relate to the specified ActiveRecord object. Usage example:
# relate to the specified Active
Record object. Usage example:
#
# <% div_for(@person, :class => "foo") do %>
# <%=h @person.name %>
...
...
@@ -17,7 +17,7 @@ def div_for(record, *args, &block)
end
# content_tag_for creates an HTML element with id and class parameters
# that relate to the specified ActiveRecord object. For example:
# that relate to the specified Active
Record object. For example:
#
# <% content_tag_for(:tr, @person) do %>
# <td><%=h @person.first_name %></td>
...
...
activerecord/lib/active_record/associations.rb
浏览文件 @
49738f00
...
...
@@ -155,7 +155,7 @@ def clear_association_cache #:nodoc:
#
# == Cardinality and associations
#
# ActiveRecord associations can be used to describe one-to-one, one-to-many and many-to-many
# Active
Record associations can be used to describe one-to-one, one-to-many and many-to-many
# relationships between models. Each model uses an association to describe its role in
# the relation. The +belongs_to+ association is always used in the model that has
# the foreign key.
...
...
@@ -520,13 +520,13 @@ def clear_association_cache #:nodoc:
#
# will execute one query to load the addresses and load the addressables with one query per addressable type.
# For example if all the addressables are either of class Person or Company then a total of 3 queries will be executed. The list of
# addressable types to load is determined on the back of the addresses loaded. This is not supported if ActiveRecord has to fallback
# addressable types to load is determined on the back of the addresses loaded. This is not supported if Active
Record has to fallback
# to the previous implementation of eager loading and will raise ActiveRecord::EagerLoadPolymorphicError. The reason is that the parent
# model's type is a column value so its corresponding table name cannot be put in the +FROM+/+JOIN+ clauses of that query.
#
# == Table Aliasing
#
# ActiveRecord uses table aliasing in the case that a table is referenced multiple times in a join. If a table is referenced only once,
# Active
Record uses table aliasing in the case that a table is referenced multiple times in a join. If a table is referenced only once,
# the standard table name is used. The second time, the table is aliased as <tt>#{reflection_name}_#{parent_table_name}</tt>. Indexes are appended
# for any more successive uses of the table name.
#
...
...
activerecord/lib/active_record/attribute_methods.rb
浏览文件 @
49738f00
...
...
@@ -94,7 +94,7 @@ def define_attribute_methods
end
# Checks whether the method is defined in the model or any of its subclasses
# that also derive from ActiveRecord. Raises DangerousAttributeError if the
# that also derive from Active
Record. Raises DangerousAttributeError if the
# method is defined by Active Record though.
def
instance_method_already_implemented?
(
method_name
)
method_name
=
method_name
.
to_s
...
...
activerecord/lib/active_record/base.rb
浏览文件 @
49738f00
...
...
@@ -2,7 +2,7 @@
require
'set'
module
ActiveRecord
#:nodoc:
# Generic ActiveRecord exception class.
# Generic Active
Record exception class.
class
ActiveRecordError
<
StandardError
end
...
...
@@ -30,19 +30,19 @@ class AssociationTypeMismatch < ActiveRecordError
class
SerializationTypeMismatch
<
ActiveRecordError
end
# Raised when adapter not specified on connection (or configuration file
config/database.yml
misses adapter field).
# Raised when adapter not specified on connection (or configuration file
<tt>config/database.yml</tt>
misses adapter field).
class
AdapterNotSpecified
<
ActiveRecordError
end
# Raised when Active
Record cannot find database adapter specified in config/database.yml
or programmatically.
# Raised when Active
Record cannot find database adapter specified in <tt>config/database.yml</tt>
or programmatically.
class
AdapterNotFound
<
ActiveRecordError
end
# Raised when connection to the database could not been established (for example when
connection=
is given a nil object).
# Raised when connection to the database could not been established (for example when
<tt>connection=</tt>
is given a nil object).
class
ConnectionNotEstablished
<
ActiveRecordError
end
# Raised when ActiveRecord cannot find record by given id or set of ids.
# Raised when Active
Record cannot find record by given id or set of ids.
class
RecordNotFound
<
ActiveRecordError
end
...
...
@@ -83,12 +83,12 @@ class ConfigurationError < ActiveRecordError
class
ReadOnlyRecord
<
ActiveRecordError
end
# Used by ActiveRecord transaction mechanism to distinguish rollback from other exceptional situations.
# Used by Active
Record transaction mechanism to distinguish rollback from other exceptional situations.
# You can use it to roll your transaction back explicitly in the block passed to +transaction+ method.
class
Rollback
<
ActiveRecordError
end
# Raised when attribute has a name reserved by Active
Record (when attribute has name of one of Active
Record instance methods).
# Raised when attribute has a name reserved by Active
Record (when attribute has name of one of Active
Record instance methods).
class
DangerousAttributeError
<
ActiveRecordError
end
...
...
@@ -966,7 +966,7 @@ def serialized_attributes
# Guesses the table name (in forced lower-case) based on the name of the class in the inheritance hierarchy descending
# directly from ActiveRecord
. So if the hierarchy looks like: Reply < Message < ActiveRecord
, then Message is used
# directly from ActiveRecord
::Base. So if the hierarchy looks like: Reply < Message < ActiveRecord::Base
, then Message is used
# to guess the table name even when called on Reply. The rules used to do the guess are handled by the Inflector class
# in Active Support, which knows almost all common English inflections. You can add new inflections in config/initializers/inflections.rb.
#
...
...
@@ -985,8 +985,8 @@ def serialized_attributes
# file class table_name
# invoice/lineitem.rb Invoice::Lineitem lineitems
#
# Additionally, the class-level
table_name_prefix
is prepended and the
#
table_name_suffix
is appended. So if you have "myapp_" as a prefix,
# Additionally, the class-level
+table_name_prefix+
is prepended and the
#
+table_name_suffix+
is appended. So if you have "myapp_" as a prefix,
# the table name guess for an Invoice class becomes "myapp_invoices".
# Invoice::Lineitem becomes "myapp_invoice_lineitems".
#
...
...
@@ -1902,7 +1902,7 @@ def compute_type(type_name)
end
end
# Returns the class descending directly from ActiveRecord in the inheritance hierarchy.
# Returns the class descending directly from Active
Record in the inheritance hierarchy.
def
class_of_active_record_descendant
(
klass
)
if
klass
.
superclass
==
Base
||
klass
.
superclass
.
abstract_class?
klass
...
...
@@ -1913,7 +1913,7 @@ def class_of_active_record_descendant(klass)
end
end
# Returns the name of the class descending directly from ActiveRecord in the inheritance hierarchy.
# Returns the name of the class descending directly from Active
Record in the inheritance hierarchy.
def
class_name_of_active_record_descendant
(
klass
)
#:nodoc:
klass
.
base_class
.
name
end
...
...
@@ -2500,9 +2500,9 @@ def create
id
end
# Sets the attribute used for single table inheritance to this class name if this is not the ActiveRecord descendent.
# Considering the hierarchy Reply < Message < ActiveRecord, this makes it possible to do Reply.new without having to
# set
Reply[Reply.inheritance_column] = "Reply"
yourself. No such attribute would be set for objects of the
# Sets the attribute used for single table inheritance to this class name if this is not the ActiveRecord
::Base
descendent.
# Considering the hierarchy Reply < Message < ActiveRecord
::Base
, this makes it possible to do Reply.new without having to
# set
<tt>Reply[Reply.inheritance_column] = "Reply"</tt>
yourself. No such attribute would be set for objects of the
# Message class in that example.
def
ensure_proper_type
unless
self
.
class
.
descends_from_active_record?
...
...
activerecord/lib/active_record/fixtures.rb
浏览文件 @
49738f00
...
...
@@ -258,7 +258,7 @@ class FixtureClassNotFound < StandardError #:nodoc:
# reginald: # generated id: 324201669
# name: Reginald the Pirate
#
# ActiveRecord looks at the fixture's model class, discovers the correct
# Active
Record looks at the fixture's model class, discovers the correct
# primary key, and generates it right before inserting the fixture
# into the database.
#
...
...
@@ -268,7 +268,7 @@ class FixtureClassNotFound < StandardError #:nodoc:
# == Label references for associations (belongs_to, has_one, has_many)
#
# Specifying foreign keys in fixtures can be very fragile, not to
# mention difficult to read. Since ActiveRecord can figure out the ID of
# mention difficult to read. Since Active
Record can figure out the ID of
# any fixture from its label, you can specify FK's by label instead of ID.
#
# === belongs_to
...
...
@@ -305,7 +305,7 @@ class FixtureClassNotFound < StandardError #:nodoc:
# name: George the Monkey
# pirate: reginald
#
# Pow! All is made clear. ActiveRecord reflects on the fixture's model class,
# Pow! All is made clear. Active
Record reflects on the fixture's model class,
# finds all the +belongs_to+ associations, and allows you to specify
# a target *label* for the *association* (monkey: george) rather than
# a target *id* for the *FK* (<tt>monkey_id: 1</tt>).
...
...
@@ -313,7 +313,7 @@ class FixtureClassNotFound < StandardError #:nodoc:
# ==== Polymorphic belongs_to
#
# Supporting polymorphic relationships is a little bit more complicated, since
# ActiveRecord needs to know what type your association is pointing at. Something
# Active
Record needs to know what type your association is pointing at. Something
# like this should look familiar:
#
# ### in fruit.rb
...
...
@@ -333,7 +333,7 @@ class FixtureClassNotFound < StandardError #:nodoc:
# apple:
# eater: george (Monkey)
#
# Just provide the polymorphic target type and ActiveRecord will take care of the rest.
# Just provide the polymorphic target type and Active
Record will take care of the rest.
#
# === has_and_belongs_to_many
#
...
...
@@ -396,15 +396,15 @@ class FixtureClassNotFound < StandardError #:nodoc:
#
# Zap! No more fruits_monkeys.yml file. We've specified the list of fruits
# on George's fixture, but we could've just as easily specified a list
# of monkeys on each fruit. As with +belongs_to+, ActiveRecord reflects on
# of monkeys on each fruit. As with +belongs_to+, Active
Record reflects on
# the fixture's model class and discovers the +has_and_belongs_to_many+
# associations.
#
# == Autofilled timestamp columns
#
# If your table/model specifies any of ActiveRecord's
# standard timestamp columns (
created_at, created_on, updated_at, updated_on
),
# they will automatically be set to
Time.now
.
# If your table/model specifies any of Active
Record's
# standard timestamp columns (
+created_at+, +created_on+, +updated_at+, +updated_on+
),
# they will automatically be set to
<tt>Time.now</tt>
.
#
# If you've set specific values, they'll be left alone.
#
...
...
activerecord/lib/active_record/migration.rb
浏览文件 @
49738f00
...
...
@@ -377,7 +377,7 @@ def current_version
end
def
proper_table_name
(
name
)
# Use the ActiveRecord objects own table_name, or pre/suffix from ActiveRecord::Base if name is a symbol/string
# Use the Active
Record objects own table_name, or pre/suffix from ActiveRecord::Base if name is a symbol/string
name
.
table_name
rescue
"
#{
ActiveRecord
::
Base
.
table_name_prefix
}#{
name
}#{
ActiveRecord
::
Base
.
table_name_suffix
}
"
end
end
...
...
activerecord/lib/active_record/named_scope.rb
浏览文件 @
49738f00
...
...
@@ -41,7 +41,7 @@ def scopes
# Nested finds and calculations also work with these compositions: <tt>Shirt.red.dry_clean_only.count</tt> returns the number of garments
# for which these criteria obtain. Similarly with <tt>Shirt.red.dry_clean_only.average(:thread_count)</tt>.
#
# All scopes are available as class methods on the ActiveRecord descendent upon which the scopes were defined. But they are also available to
# All scopes are available as class methods on the ActiveRecord
::Base
descendent upon which the scopes were defined. But they are also available to
# <tt>has_many</tt> associations. If,
#
# class Person < ActiveRecord::Base
...
...
activerecord/lib/active_record/observer.rb
浏览文件 @
49738f00
...
...
@@ -30,7 +30,7 @@ def observers
@observers
||=
[]
end
# Instantiate the global Active
Record observers
# Instantiate the global Active
Record observers.
def
instantiate_observers
return
if
@observers
.
blank?
@observers
.
each
do
|
observer
|
...
...
activerecord/lib/active_record/schema_dumper.rb
浏览文件 @
49738f00
...
...
@@ -38,7 +38,7 @@ def header(stream)
stream
.
puts
<<
HEADER
# This file is auto-generated from the current state of the database. Instead of editing this file,
# please use the migrations feature of ActiveRecord to incrementally modify your database, and
# please use the migrations feature of Active
Record to incrementally modify your database, and
# then regenerate this schema definition.
#
# Note that this schema.rb definition is the authoritative source for your database schema. If you need
...
...
activerecord/lib/active_record/transactions.rb
浏览文件 @
49738f00
...
...
@@ -30,9 +30,9 @@ def self.included(base)
# Exceptions will force a ROLLBACK that returns the database to the state before the transaction was begun. Be aware, though,
# that the objects will _not_ have their instance data returned to their pre-transactional state.
#
# == Different ActiveRecord classes in a single transaction
# == Different Active
Record classes in a single transaction
#
# Though the transaction class method is called on some ActiveRecord class,
# Though the transaction class method is called on some Active
Record class,
# the objects within the transaction block need not all be instances of
# that class.
# In this example a <tt>Balance</tt> record is transactionally saved even
...
...
railties/configs/initializers/new_rails_defaults.rb
浏览文件 @
49738f00
...
...
@@ -4,15 +4,15 @@
# Only save the attributes that have changed since the record was loaded.
ActiveRecord
::
Base
.
partial_updates
=
true
# Include ActiveRecord class name as root for JSON serialized output.
# Include Active
Record class name as root for JSON serialized output.
ActiveRecord
::
Base
.
include_root_in_json
=
true
# Store the full class name (including module namespace) in STI type column
# Store the full class name (including module namespace) in STI type column
.
ActiveRecord
::
Base
.
store_full_sti_class
=
true
# Use ISO 8601 format for JSON serialized times and dates
# Use ISO 8601 format for JSON serialized times and dates
.
ActiveSupport
.
use_standard_json_time_format
=
true
# Don't escape HTML entities in JSON, leave that for the #json_escape helper
# Don't escape HTML entities in JSON, leave that for the #json_escape helper
.
# if you're including raw json in an HTML page.
ActiveSupport
.
escape_html_entities_in_json
=
false
\ No newline at end of file
railties/environments/environment.rb
浏览文件 @
49738f00
...
...
@@ -38,7 +38,7 @@
# (by default production uses :info, the others :debug)
# config.log_level = :debug
# Make Time.zone default to the specified zone, and make ActiveRecord store time values
# Make Time.zone default to the specified zone, and make Active
Record store time values
# in the database in UTC, and return them converted to the specified local zone.
# Run `rake -D time` for a list of tasks for finding time zone names. Uncomment to use default local time.
config
.
time_zone
=
'UTC'
...
...
railties/lib/initializer.rb
浏览文件 @
49738f00
...
...
@@ -160,8 +160,8 @@ def check_ruby_version
end
# If Rails is vendored and RubyGems is available, install stub GemSpecs
# for Rails, Active
Support, ActiveRecord, ActionPack, Action
Mailer, and
# ActiveResource. This allows Gem plugins to depend on Rails even when
# for Rails, Active
Support, Active Record, Action Pack, Action
Mailer, and
# Active
Resource. This allows Gem plugins to depend on Rails even when
# the Gem version of Rails shouldn't be loaded.
def
install_gem_spec_stubs
unless
Rails
.
respond_to?
(
:vendor_rails?
)
...
...
@@ -210,8 +210,8 @@ def set_autoload_paths
end
# Requires all frameworks specified by the Configuration#frameworks
# list. By default, all frameworks (Active
Record, Active
Support,
# Action
Pack, ActionMailer, and Active
Resource) are loaded.
# list. By default, all frameworks (Active
Record, Active
Support,
# Action
Pack, Action Mailer, and Active
Resource) are loaded.
def
require_frameworks
configuration
.
frameworks
.
each
{
|
framework
|
require
(
framework
.
to_s
)
}
rescue
LoadError
=>
e
...
...
@@ -359,7 +359,7 @@ def initialize_logger
silence_warnings
{
Object
.
const_set
"RAILS_DEFAULT_LOGGER"
,
logger
}
end
# Sets the logger for Active
Record, ActionController, and Action
Mailer
# Sets the logger for Active
Record, Action Controller, and Action
Mailer
# (but only for those frameworks that are to be loaded). If the framework's
# logger is already set, it is not changed, otherwise it is set to use
# RAILS_DEFAULT_LOGGER.
...
...
@@ -409,7 +409,7 @@ def initialize_temporary_session_directory
end
end
# Sets the default value for Time.zone, and turns on ActiveRecord
time_zone_aware_attributes.
# Sets the default value for Time.zone, and turns on ActiveRecord
::Base#
time_zone_aware_attributes.
# If assigned value cannot be matched to a TimeZone, an exception will be raised.
def
initialize_time_zone
if
configuration
.
time_zone
...
...
@@ -618,9 +618,9 @@ def breakpoint_server(_ = nil)
end
alias_method
:breakpoint_server
=
,
:breakpoint_server
# Sets the default
time_zone. Setting this will enable time_zone
# awareness for Active
Record models and set the Active
Record default
# timezone to
:utc
.
# Sets the default
+time_zone+. Setting this will enable +time_zone+
# awareness for Active
Record models and set the Active
Record default
# timezone to
<tt>:utc</tt>
.
attr_accessor
:time_zone
# Create a new Configuration instance, initialized with the default
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录