Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
张重言
rails
提交
7e3b4c1f
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,发现更多精彩内容 >>
提交
7e3b4c1f
编写于
3月 28, 2010
作者:
J
Jeremy Kemper
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'master' of github.com:rails/rails
上级
d1f3437c
c99194c7
变更
61
隐藏空白更改
内联
并排
Showing
61 changed file
with
147 addition
and
6 deletion
+147
-6
actionmailer/lib/action_mailer/base.rb
actionmailer/lib/action_mailer/base.rb
+1
-0
actionmailer/lib/action_mailer/old_api.rb
actionmailer/lib/action_mailer/old_api.rb
+1
-0
actionpack/lib/action_controller/metal/http_authentication.rb
...onpack/lib/action_controller/metal/http_authentication.rb
+1
-0
actionpack/lib/action_controller/metal/renderers.rb
actionpack/lib/action_controller/metal/renderers.rb
+1
-0
actionpack/lib/action_controller/railties/log_subscriber.rb
actionpack/lib/action_controller/railties/log_subscriber.rb
+2
-0
actionpack/lib/action_controller/test_case.rb
actionpack/lib/action_controller/test_case.rb
+1
-0
actionpack/lib/action_dispatch/http/cache.rb
actionpack/lib/action_dispatch/http/cache.rb
+2
-0
actionpack/lib/action_dispatch/http/filter_parameters.rb
actionpack/lib/action_dispatch/http/filter_parameters.rb
+1
-0
actionpack/lib/action_dispatch/http/mime_type.rb
actionpack/lib/action_dispatch/http/mime_type.rb
+1
-0
actionpack/lib/action_dispatch/http/response.rb
actionpack/lib/action_dispatch/http/response.rb
+1
-0
actionpack/lib/action_dispatch/http/upload.rb
actionpack/lib/action_dispatch/http/upload.rb
+2
-0
actionpack/lib/action_dispatch/middleware/session/abstract_store.rb
.../lib/action_dispatch/middleware/session/abstract_store.rb
+1
-0
actionpack/lib/action_dispatch/middleware/session/cookie_store.rb
...ck/lib/action_dispatch/middleware/session/cookie_store.rb
+1
-0
actionpack/lib/action_dispatch/routing/deprecated_mapper.rb
actionpack/lib/action_dispatch/routing/deprecated_mapper.rb
+2
-0
actionpack/lib/action_dispatch/routing/mapper.rb
actionpack/lib/action_dispatch/routing/mapper.rb
+1
-0
actionpack/lib/action_dispatch/testing/performance_test.rb
actionpack/lib/action_dispatch/testing/performance_test.rb
+3
-1
actionpack/lib/action_dispatch/testing/test_request.rb
actionpack/lib/action_dispatch/testing/test_request.rb
+2
-0
actionpack/lib/action_view/helpers/capture_helper.rb
actionpack/lib/action_view/helpers/capture_helper.rb
+2
-0
actionpack/lib/action_view/helpers/form_helper.rb
actionpack/lib/action_view/helpers/form_helper.rb
+1
-0
actionpack/lib/action_view/helpers/form_options_helper.rb
actionpack/lib/action_view/helpers/form_options_helper.rb
+1
-0
actionpack/lib/action_view/helpers/form_tag_helper.rb
actionpack/lib/action_view/helpers/form_tag_helper.rb
+1
-0
actionpack/lib/action_view/helpers/number_helper.rb
actionpack/lib/action_view/helpers/number_helper.rb
+1
-0
actionpack/lib/action_view/helpers/prototype_helper.rb
actionpack/lib/action_view/helpers/prototype_helper.rb
+1
-0
actionpack/lib/action_view/helpers/tag_helper.rb
actionpack/lib/action_view/helpers/tag_helper.rb
+1
-0
actionpack/lib/action_view/helpers/text_helper.rb
actionpack/lib/action_view/helpers/text_helper.rb
+1
-0
actionpack/lib/action_view/render/partials.rb
actionpack/lib/action_view/render/partials.rb
+2
-0
actionpack/lib/action_view/test_case.rb
actionpack/lib/action_view/test_case.rb
+1
-0
activemodel/lib/active_model/dirty.rb
activemodel/lib/active_model/dirty.rb
+3
-0
activemodel/lib/active_model/errors.rb
activemodel/lib/active_model/errors.rb
+1
-0
activemodel/lib/active_model/validator.rb
activemodel/lib/active_model/validator.rb
+1
-0
activerecord/lib/active_record/associations.rb
activerecord/lib/active_record/associations.rb
+38
-2
activerecord/lib/active_record/associations/has_many_through_association.rb
...ctive_record/associations/has_many_through_association.rb
+1
-0
activerecord/lib/active_record/attribute_methods/dirty.rb
activerecord/lib/active_record/attribute_methods/dirty.rb
+2
-0
activerecord/lib/active_record/attribute_methods/query.rb
activerecord/lib/active_record/attribute_methods/query.rb
+2
-0
activerecord/lib/active_record/base.rb
activerecord/lib/active_record/base.rb
+2
-0
activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb
...active_record/connection_adapters/abstract/query_cache.rb
+2
-0
activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb
...record/connection_adapters/abstract/schema_definitions.rb
+1
-0
activerecord/lib/active_record/connection_adapters/mysql_adapter.rb
...rd/lib/active_record/connection_adapters/mysql_adapter.rb
+1
-0
activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb
...b/active_record/connection_adapters/postgresql_adapter.rb
+1
-0
activerecord/lib/active_record/fixtures.rb
activerecord/lib/active_record/fixtures.rb
+1
-0
activerecord/lib/active_record/named_scope.rb
activerecord/lib/active_record/named_scope.rb
+1
-0
activerecord/lib/active_record/nested_attributes.rb
activerecord/lib/active_record/nested_attributes.rb
+1
-0
activerecord/lib/active_record/query_cache.rb
activerecord/lib/active_record/query_cache.rb
+2
-0
activerecord/lib/active_record/relation.rb
activerecord/lib/active_record/relation.rb
+2
-0
activerecord/lib/active_record/relation/batches.rb
activerecord/lib/active_record/relation/batches.rb
+2
-0
activerecord/lib/active_record/relation/calculations.rb
activerecord/lib/active_record/relation/calculations.rb
+2
-0
activerecord/lib/active_record/relation/finder_methods.rb
activerecord/lib/active_record/relation/finder_methods.rb
+2
-0
activerecord/lib/active_record/relation/query_methods.rb
activerecord/lib/active_record/relation/query_methods.rb
+2
-0
activerecord/lib/active_record/relation/spawn_methods.rb
activerecord/lib/active_record/relation/spawn_methods.rb
+2
-0
activerecord/lib/active_record/schema.rb
activerecord/lib/active_record/schema.rb
+2
-0
activerecord/test/cases/associations/belongs_to_associations_test.rb
...d/test/cases/associations/belongs_to_associations_test.rb
+7
-1
activerecord/test/cases/associations/has_many_associations_test.rb
...ord/test/cases/associations/has_many_associations_test.rb
+8
-0
activerecord/test/cases/associations/has_one_associations_test.rb
...cord/test/cases/associations/has_one_associations_test.rb
+9
-1
activerecord/test/models/company.rb
activerecord/test/models/company.rb
+5
-0
activeresource/lib/active_resource/base.rb
activeresource/lib/active_resource/base.rb
+1
-0
activeresource/lib/active_resource/custom_methods.rb
activeresource/lib/active_resource/custom_methods.rb
+2
-0
activeresource/lib/active_resource/validations.rb
activeresource/lib/active_resource/validations.rb
+1
-0
activesupport/lib/active_support/xml_mini/libxmlsax.rb
activesupport/lib/active_support/xml_mini/libxmlsax.rb
+1
-0
activesupport/lib/active_support/xml_mini/nokogirisax.rb
activesupport/lib/active_support/xml_mini/nokogirisax.rb
+1
-0
railties/lib/rails/generators/rails/app/templates/test/performance/browsing_test.rb
...ors/rails/app/templates/test/performance/browsing_test.rb
+1
-1
railties/lib/rails/generators/rails/resource/resource_generator.rb
...lib/rails/generators/rails/resource/resource_generator.rb
+1
-0
未找到文件。
actionmailer/lib/action_mailer/base.rb
浏览文件 @
7e3b4c1f
...
...
@@ -2,6 +2,7 @@
require
'action_mailer/tmail_compat'
require
'action_mailer/collector'
require
'active_support/core_ext/array/wrap'
require
'active_support/core_ext/object/blank'
module
ActionMailer
#:nodoc:
# Action Mailer allows you to send email from your application using a mailer model and views.
...
...
actionmailer/lib/action_mailer/old_api.rb
浏览文件 @
7e3b4c1f
require
'active_support/core_ext/object/try'
require
'active_support/core_ext/object/blank'
module
ActionMailer
module
OldApi
#:nodoc:
...
...
actionpack/lib/action_controller/metal/http_authentication.rb
浏览文件 @
7e3b4c1f
require
'active_support/base64'
require
'active_support/core_ext/object/blank'
module
ActionController
module
HttpAuthentication
...
...
actionpack/lib/action_controller/metal/renderers.rb
浏览文件 @
7e3b4c1f
require
'active_support/core_ext/class/attribute'
require
'active_support/core_ext/object/blank'
module
ActionController
def
self
.
add_renderer
(
key
,
&
block
)
...
...
actionpack/lib/action_controller/railties/log_subscriber.rb
浏览文件 @
7e3b4c1f
require
'active_support/core_ext/object/blank'
module
ActionController
module
Railties
class
LogSubscriber
<
Rails
::
LogSubscriber
...
...
actionpack/lib/action_controller/test_case.rb
浏览文件 @
7e3b4c1f
require
'rack/session/abstract/id'
require
'active_support/core_ext/object/blank'
module
ActionController
module
TemplateAssertions
...
...
actionpack/lib/action_dispatch/http/cache.rb
浏览文件 @
7e3b4c1f
require
'active_support/core_ext/object/blank'
module
ActionDispatch
module
Http
module
Cache
...
...
actionpack/lib/action_dispatch/http/filter_parameters.rb
浏览文件 @
7e3b4c1f
require
'active_support/core_ext/object/blank'
require
'active_support/core_ext/hash/keys'
require
'active_support/core_ext/object/duplicable'
module
ActionDispatch
module
Http
...
...
actionpack/lib/action_dispatch/http/mime_type.rb
浏览文件 @
7e3b4c1f
require
'set'
require
'active_support/core_ext/class/attribute_accessors'
require
'active_support/core_ext/object/blank'
module
Mime
class
Mimes
<
Array
...
...
actionpack/lib/action_dispatch/http/response.rb
浏览文件 @
7e3b4c1f
require
'digest/md5'
require
'active_support/core_ext/module/delegation'
require
'active_support/core_ext/object/blank'
module
ActionDispatch
# :nodoc:
# Represents an HTTP response generated by a controller action. One can use
...
...
actionpack/lib/action_dispatch/http/upload.rb
浏览文件 @
7e3b4c1f
require
'active_support/core_ext/object/blank'
module
ActionDispatch
module
Http
module
UploadedFile
...
...
actionpack/lib/action_dispatch/middleware/session/abstract_store.rb
浏览文件 @
7e3b4c1f
require
'rack/utils'
require
'rack/request'
require
'active_support/core_ext/object/blank'
module
ActionDispatch
module
Session
...
...
actionpack/lib/action_dispatch/middleware/session/cookie_store.rb
浏览文件 @
7e3b4c1f
require
'active_support/core_ext/hash/keys'
require
'active_support/core_ext/object/blank'
module
ActionDispatch
module
Session
...
...
actionpack/lib/action_dispatch/routing/deprecated_mapper.rb
浏览文件 @
7e3b4c1f
require
'active_support/core_ext/object/blank'
module
ActionDispatch
module
Routing
class
RouteSet
...
...
actionpack/lib/action_dispatch/routing/mapper.rb
浏览文件 @
7e3b4c1f
require
'active_support/core_ext/hash/except'
require
'active_support/core_ext/object/blank'
module
ActionDispatch
module
Routing
...
...
actionpack/lib/action_dispatch/testing/performance_test.rb
浏览文件 @
7e3b4c1f
require
'active_support/testing/performance'
require
'active_support/testing/default'
if
defined?
(
ActiveSupport
::
Testing
::
Performance
)
begin
module
ActionDispatch
# An integration test that runs a code profiler on your test methods.
# Profiling output for combinations of each test method, measurement, and
...
...
@@ -14,4 +14,6 @@ class PerformanceTest < ActionDispatch::IntegrationTest
include
ActiveSupport
::
Testing
::
Default
end
end
rescue
NameError
$stderr
.
puts
"Specify ruby-prof as application's dependency in Gemfile to run benchmarks."
end
\ No newline at end of file
actionpack/lib/action_dispatch/testing/test_request.rb
浏览文件 @
7e3b4c1f
require
'active_support/core_ext/object/blank'
module
ActionDispatch
class
TestRequest
<
Request
DEFAULT_ENV
=
Rack
::
MockRequest
.
env_for
(
'/'
)
...
...
actionpack/lib/action_view/helpers/capture_helper.rb
浏览文件 @
7e3b4c1f
require
'active_support/core_ext/object/blank'
module
ActionView
module
Helpers
# CaptureHelper exposes methods to let you extract generated markup which
...
...
actionpack/lib/action_view/helpers/form_helper.rb
浏览文件 @
7e3b4c1f
...
...
@@ -4,6 +4,7 @@
require
'action_view/helpers/form_tag_helper'
require
'active_support/core_ext/class/inheritable_attributes'
require
'active_support/core_ext/hash/slice'
require
'active_support/core_ext/object/blank'
module
ActionView
module
Helpers
...
...
actionpack/lib/action_view/helpers/form_options_helper.rb
浏览文件 @
7e3b4c1f
require
'cgi'
require
'erb'
require
'action_view/helpers/form_helper'
require
'active_support/core_ext/object/blank'
module
ActionView
module
Helpers
...
...
actionpack/lib/action_view/helpers/form_tag_helper.rb
浏览文件 @
7e3b4c1f
require
'cgi'
require
'action_view/helpers/tag_helper'
require
'active_support/core_ext/object/returning'
require
'active_support/core_ext/object/blank'
module
ActionView
module
Helpers
...
...
actionpack/lib/action_view/helpers/number_helper.rb
浏览文件 @
7e3b4c1f
require
'active_support/core_ext/big_decimal/conversions'
require
'active_support/core_ext/float/rounding'
require
'active_support/core_ext/object/blank'
module
ActionView
module
Helpers
#:nodoc:
...
...
actionpack/lib/action_view/helpers/prototype_helper.rb
浏览文件 @
7e3b4c1f
require
'set'
require
'active_support/json'
require
'active_support/core_ext/object/returning'
require
'active_support/core_ext/object/blank'
module
ActionView
module
Helpers
...
...
actionpack/lib/action_view/helpers/tag_helper.rb
浏览文件 @
7e3b4c1f
require
'active_support/core_ext/object/blank'
require
'set'
module
ActionView
...
...
actionpack/lib/action_view/helpers/text_helper.rb
浏览文件 @
7e3b4c1f
require
'active_support/core_ext/object/blank'
require
'action_view/helpers/tag_helper'
module
ActionView
...
...
actionpack/lib/action_view/render/partials.rb
浏览文件 @
7e3b4c1f
require
'active_support/core_ext/object/blank'
module
ActionView
# There's also a convenience method for rendering sub templates within the current controller that depends on a
# single object (we call this kind of sub templates for partials). It relies on the fact that partials should
...
...
actionpack/lib/action_view/test_case.rb
浏览文件 @
7e3b4c1f
require
'active_support/core_ext/object/blank'
require
'action_controller/test_case'
require
'action_view'
...
...
activemodel/lib/active_model/dirty.rb
浏览文件 @
7e3b4c1f
require
'active_model/attribute_methods'
require
'active_support/concern'
require
'active_support/hash_with_indifferent_access'
require
'active_support/core_ext/object/duplicable'
module
ActiveModel
# <tt>ActiveModel::Dirty</tt> provides a way to track changes in your
...
...
activemodel/lib/active_model/errors.rb
浏览文件 @
7e3b4c1f
require
'active_support/core_ext/array/wrap'
require
'active_support/core_ext/string/inflections'
require
'active_support/core_ext/object/blank'
require
'active_support/ordered_hash'
module
ActiveModel
...
...
activemodel/lib/active_model/validator.rb
浏览文件 @
7e3b4c1f
require
'active_support/core_ext/array/wrap'
require
"active_support/core_ext/module/anonymous"
require
'active_support/core_ext/object/blank'
module
ActiveModel
#:nodoc:
# A simple base class that can be used along with
...
...
activerecord/lib/active_record/associations.rb
浏览文件 @
7e3b4c1f
require
'active_support/core_ext/module/delegation'
require
'active_support/core_ext/enumerable'
require
'active_support/core_ext/object/blank'
module
ActiveRecord
class
InverseOfAssociationNotFoundError
<
ActiveRecordError
#:nodoc:
...
...
@@ -85,6 +86,15 @@ def initialize(reflection)
end
end
# This error is raised when trying to destroy a parent instance in a N:1, 1:1 assosications
# (has_many, has_one) when there is at least 1 child assosociated instance.
# ex: if @project.tasks.size > 0, DeleteRestrictionError will be raised when trying to destroy @project
class
DeleteRestrictionError
<
ActiveRecordError
#:nodoc:
def
initialize
(
reflection
)
super
(
"Cannot delete record because of dependent
#{
reflection
.
name
}
"
)
end
end
# See ActiveRecord::Associations::ClassMethods for documentation.
module
Associations
# :nodoc:
extend
ActiveSupport
::
Concern
...
...
@@ -830,6 +840,8 @@ module ClassMethods
# objects are deleted *without* calling their +destroy+ method. If set to <tt>:nullify</tt> all associated
# objects' foreign keys are set to +NULL+ *without* calling their +save+ callbacks. *Warning:* This option is ignored when also using
# the <tt>:through</tt> option.
# the <tt>:through</tt> option. If set to <tt>:restrict</tt>
# this object cannot be deleted if it has any associated object.
# [:finder_sql]
# Specify a complete SQL statement to fetch the association. This is a good way to go for complex
# associations that depend on multiple tables. Note: When this option is used, +find_in_collection+ is _not_ added.
...
...
@@ -1468,9 +1480,15 @@ def add_touch_callbacks(reflection, touch_attribute)
# Creates before_destroy callback methods that nullify, delete or destroy
# has_many associated objects, according to the defined :dependent rule.
# If the association is marked as :dependent => :restrict, create a callback
# that prevents deleting entirely.
#
# See HasManyAssociation#delete_records. Dependent associations
# delete children, otherwise foreign key is set to NULL.
# See HasManyAssociation#delete_records. Dependent associations
# delete children if the option is set to :destroy or :delete_all, set the
# foreign key to NULL if the option is set to :nullify, and do not touch the
# child records if the option is set to :restrict.
#
# The +extra_conditions+ parameter, which is not used within the main
# Active Record codebase, is meant to allow plugins to define extra
...
...
@@ -1530,14 +1548,24 @@ def configure_dependency_for_has_many(reflection, extra_conditions = nil)
%@
#{
dependent_conditions
}
@)
end
CALLBACK
when
:restrict
method_name
=
"has_many_dependent_restrict_for_
#{
reflection
.
name
}
"
.
to_sym
define_method
(
method_name
)
do
unless
send
(
reflection
.
name
).
empty?
raise
DeleteRestrictionError
.
new
(
reflection
)
end
end
before_destroy
method_name
else
raise
ArgumentError
,
"The :dependent option expects either :destroy, :delete_all,
or :nullify
(
#{
reflection
.
options
[
:dependent
].
inspect
}
)"
raise
ArgumentError
,
"The :dependent option expects either :destroy, :delete_all,
:nullify or :restrict
(
#{
reflection
.
options
[
:dependent
].
inspect
}
)"
end
end
end
# Creates before_destroy callback methods that nullify, delete or destroy
# has_one associated objects, according to the defined :dependent rule.
# If the association is marked as :dependent => :restrict, create a callback
# that prevents deleting entirely.
def
configure_dependency_for_has_one
(
reflection
)
if
reflection
.
options
.
include?
(
:dependent
)
name
=
reflection
.
options
[
:dependent
]
...
...
@@ -1558,8 +1586,16 @@ def #{method_name}
association.update_attribute(
#{
reflection
.
primary_key_name
.
inspect
}
, nil) if association
end
eoruby
when
:restrict
method_name
=
"has_one_dependent_restrict_for_
#{
reflection
.
name
}
"
.
to_sym
define_method
(
method_name
)
do
unless
send
(
reflection
.
name
).
nil?
raise
DeleteRestrictionError
.
new
(
reflection
)
end
end
before_destroy
method_name
else
raise
ArgumentError
,
"The :dependent option expects either :destroy, :delete
or :nullify
(
#{
reflection
.
options
[
:dependent
].
inspect
}
)"
raise
ArgumentError
,
"The :dependent option expects either :destroy, :delete
, :nullify or :restrict
(
#{
reflection
.
options
[
:dependent
].
inspect
}
)"
end
before_destroy
method_name
...
...
activerecord/lib/active_record/associations/has_many_through_association.rb
浏览文件 @
7e3b4c1f
require
"active_record/associations/through_association_scope"
require
'active_support/core_ext/object/blank'
module
ActiveRecord
module
Associations
...
...
activerecord/lib/active_record/attribute_methods/dirty.rb
浏览文件 @
7e3b4c1f
require
'active_support/core_ext/object/blank'
module
ActiveRecord
module
AttributeMethods
module
Dirty
...
...
activerecord/lib/active_record/attribute_methods/query.rb
浏览文件 @
7e3b4c1f
require
'active_support/core_ext/object/blank'
module
ActiveRecord
module
AttributeMethods
module
Query
...
...
activerecord/lib/active_record/base.rb
浏览文件 @
7e3b4c1f
...
...
@@ -13,6 +13,8 @@
require
'active_support/core_ext/string/behavior'
require
'active_support/core_ext/object/singleton_class'
require
'active_support/core_ext/module/delegation'
require
'active_support/core_ext/object/duplicable'
require
'active_support/core_ext/object/blank'
require
'arel'
require
'active_record/errors'
...
...
activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb
浏览文件 @
7e3b4c1f
require
'active_support/core_ext/object/duplicable'
module
ActiveRecord
module
ConnectionAdapters
# :nodoc:
module
QueryCache
...
...
activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb
浏览文件 @
7e3b4c1f
require
'active_support/core_ext/object/blank'
require
'date'
require
'set'
require
'bigdecimal'
...
...
activerecord/lib/active_record/connection_adapters/mysql_adapter.rb
浏览文件 @
7e3b4c1f
require
'active_record/connection_adapters/abstract_adapter'
require
'active_support/core_ext/kernel/requires'
require
'active_support/core_ext/object/blank'
require
'set'
module
MysqlCompat
#:nodoc:
...
...
activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb
浏览文件 @
7e3b4c1f
require
'active_record/connection_adapters/abstract_adapter'
require
'active_support/core_ext/kernel/requires'
require
'active_support/core_ext/object/blank'
begin
require_library_or_gem
'pg'
...
...
activerecord/lib/active_record/fixtures.rb
浏览文件 @
7e3b4c1f
...
...
@@ -4,6 +4,7 @@
require
'zlib'
require
'active_support/dependencies'
require
'active_support/core_ext/logger'
require
'active_support/core_ext/object/blank'
if
RUBY_VERSION
<
'1.9'
module
YAML
#:nodoc:
...
...
activerecord/lib/active_record/named_scope.rb
浏览文件 @
7e3b4c1f
require
'active_support/core_ext/array'
require
'active_support/core_ext/hash/except'
require
'active_support/core_ext/object/singleton_class'
require
'active_support/core_ext/object/blank'
module
ActiveRecord
module
NamedScope
...
...
activerecord/lib/active_record/nested_attributes.rb
浏览文件 @
7e3b4c1f
require
'active_support/core_ext/hash/except'
require
'active_support/core_ext/object/try'
require
'active_support/core_ext/object/blank'
module
ActiveRecord
module
NestedAttributes
#:nodoc:
...
...
activerecord/lib/active_record/query_cache.rb
浏览文件 @
7e3b4c1f
require
'active_support/core_ext/object/blank'
module
ActiveRecord
class
QueryCache
module
ClassMethods
...
...
activerecord/lib/active_record/relation.rb
浏览文件 @
7e3b4c1f
require
'active_support/core_ext/object/blank'
module
ActiveRecord
class
Relation
JoinOperation
=
Struct
.
new
(
:relation
,
:join_class
,
:on
)
...
...
activerecord/lib/active_record/relation/batches.rb
浏览文件 @
7e3b4c1f
require
'active_support/core_ext/object/blank'
module
ActiveRecord
module
Batches
# :nodoc:
# Yields each record that was found by the find +options+. The find is
...
...
activerecord/lib/active_record/relation/calculations.rb
浏览文件 @
7e3b4c1f
require
'active_support/core_ext/object/blank'
module
ActiveRecord
module
Calculations
# Count operates using three different approaches.
...
...
activerecord/lib/active_record/relation/finder_methods.rb
浏览文件 @
7e3b4c1f
require
'active_support/core_ext/object/blank'
module
ActiveRecord
module
FinderMethods
# Find operates with four different retrieval approaches:
...
...
activerecord/lib/active_record/relation/query_methods.rb
浏览文件 @
7e3b4c1f
require
'active_support/core_ext/object/blank'
module
ActiveRecord
module
QueryMethods
extend
ActiveSupport
::
Concern
...
...
activerecord/lib/active_record/relation/spawn_methods.rb
浏览文件 @
7e3b4c1f
require
'active_support/core_ext/object/blank'
module
ActiveRecord
module
SpawnMethods
def
merge
(
r
)
...
...
activerecord/lib/active_record/schema.rb
浏览文件 @
7e3b4c1f
require
'active_support/core_ext/object/blank'
module
ActiveRecord
# Allows programmers to programmatically define a schema in a portable
# DSL. This means you can define tables, indexes, etc. without using SQL
...
...
activerecord/test/cases/associations/belongs_to_associations_test.rb
浏览文件 @
7e3b4c1f
...
...
@@ -439,9 +439,15 @@ def test_dependent_delete_and_destroy_with_belongs_to
assert_equal
[
author_address
.
id
],
AuthorAddress
.
destroyed_author_address_ids
end
def
test_invalid_belongs_to_dependent_option_raises_exception
def
test_invalid_belongs_to_dependent_option_
nullify_
raises_exception
assert_raise
ArgumentError
do
Author
.
belongs_to
:special_author_address
,
:dependent
=>
:nullify
end
end
def
test_invalid_belongs_to_dependent_option_restrict_raises_exception
assert_raise
ArgumentError
do
Author
.
belongs_to
:special_author_address
,
:dependent
=>
:restrict
end
end
end
activerecord/test/cases/associations/has_many_associations_test.rb
浏览文件 @
7e3b4c1f
...
...
@@ -836,6 +836,14 @@ def test_depends_and_nullify
assert_equal
num_accounts
,
Account
.
count
end
def
test_restrict
firm
=
RestrictedFirm
.
new
(
:name
=>
'restrict'
)
firm
.
save!
child_firm
=
firm
.
companies
.
create
(
:name
=>
'child'
)
assert
!
firm
.
companies
.
empty?
assert_raise
(
ActiveRecord
::
DeleteRestrictionError
)
{
firm
.
destroy
}
end
def
test_included_in_collection
assert
companies
(
:first_firm
).
clients
.
include?
(
Client
.
find
(
2
))
end
...
...
activerecord/test/cases/associations/has_one_associations_test.rb
浏览文件 @
7e3b4c1f
...
...
@@ -177,7 +177,15 @@ def test_dependence_with_nil_associate
assert_nothing_raised
{
firm
.
destroy
}
end
def
test_succesful_build_association
def
test_dependence_with_restrict
firm
=
RestrictedFirm
.
new
(
:name
=>
'restrict'
)
firm
.
save!
account
=
firm
.
create_account
(
:credit_limit
=>
10
)
assert
!
firm
.
account
.
nil?
assert_raise
(
ActiveRecord
::
DeleteRestrictionError
)
{
firm
.
destroy
}
end
def
test_successful_build_association
firm
=
Firm
.
new
(
"name"
=>
"GlobalMegaCorp"
)
firm
.
save
...
...
activerecord/test/models/company.rb
浏览文件 @
7e3b4c1f
...
...
@@ -95,6 +95,11 @@ class DependentFirm < Company
has_many
:companies
,
:foreign_key
=>
'client_of'
,
:dependent
=>
:nullify
end
class
RestrictedFirm
<
Company
has_one
:account
,
:foreign_key
=>
"firm_id"
,
:dependent
=>
:restrict
,
:order
=>
"id"
has_many
:companies
,
:foreign_key
=>
'client_of'
,
:order
=>
"id"
,
:dependent
=>
:restrict
end
class
Client
<
Company
belongs_to
:firm
,
:foreign_key
=>
"client_of"
belongs_to
:firm_with_basic_id
,
:class_name
=>
"Firm"
,
:foreign_key
=>
"firm_id"
...
...
activeresource/lib/active_resource/base.rb
浏览文件 @
7e3b4c1f
...
...
@@ -9,6 +9,7 @@
require
'active_support/core_ext/object/blank'
require
'active_support/core_ext/object/misc'
require
'active_support/core_ext/object/to_query'
require
'active_support/core_ext/object/duplicable'
require
'set'
require
'uri'
...
...
activeresource/lib/active_resource/custom_methods.rb
浏览文件 @
7e3b4c1f
require
'active_support/core_ext/object/blank'
module
ActiveResource
# A module to support custom REST methods and sub-resources, allowing you to break out
# of the "default" REST methods with your own custom resource requests. For example,
...
...
activeresource/lib/active_resource/validations.rb
浏览文件 @
7e3b4c1f
require
'active_support/core_ext/array/wrap'
require
'active_support/core_ext/object/blank'
module
ActiveResource
class
ResourceInvalid
<
ClientError
#:nodoc:
...
...
activesupport/lib/active_support/xml_mini/libxmlsax.rb
浏览文件 @
7e3b4c1f
require
'libxml'
require
'active_support/core_ext/object/blank'
# = XmlMini LibXML implementation using a SAX-based parser
module
ActiveSupport
...
...
activesupport/lib/active_support/xml_mini/nokogirisax.rb
浏览文件 @
7e3b4c1f
require
'nokogiri'
require
'active_support/core_ext/object/blank'
# = XmlMini Nokogiri implementation using a SAX-based parser
module
ActiveSupport
...
...
railties/lib/rails/generators/rails/app/templates/test/performance/browsing_test.rb
浏览文件 @
7e3b4c1f
...
...
@@ -2,7 +2,7 @@
require
'rails/performance_test_help'
# Profiling results for each test method are written to tmp/performance.
class
BrowsingTest
<
Action
Controller
::
PerformanceTest
class
BrowsingTest
<
Action
Dispatch
::
PerformanceTest
def
test_homepage
get
'/'
end
...
...
railties/lib/rails/generators/rails/resource/resource_generator.rb
浏览文件 @
7e3b4c1f
require
'rails/generators/resource_helpers'
require
'rails/generators/rails/model/model_generator'
require
'active_support/core_ext/object/blank'
module
Rails
module
Generators
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录