Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
张重言
rails
提交
ef404c77
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,发现更多精彩内容 >>
提交
ef404c77
编写于
6月 15, 2010
作者:
E
Evgeniy Dolzhenko
浏览文件
操作
浏览文件
下载
差异文件
Fix a bunch of minor spelling mistakes
上级
3cc2d196
ed507300
变更
43
隐藏空白更改
内联
并排
Showing
43 changed file
with
66 addition
and
65 deletion
+66
-65
actionmailer/lib/action_mailer/base.rb
actionmailer/lib/action_mailer/base.rb
+1
-1
actionmailer/lib/action_mailer/deprecated_api.rb
actionmailer/lib/action_mailer/deprecated_api.rb
+1
-1
actionpack/lib/abstract_controller/base.rb
actionpack/lib/abstract_controller/base.rb
+1
-1
actionpack/lib/action_controller/metal/request_forgery_protection.rb
...lib/action_controller/metal/request_forgery_protection.rb
+1
-1
actionpack/lib/action_controller/test_case.rb
actionpack/lib/action_controller/test_case.rb
+2
-2
actionpack/lib/action_dispatch/http/mime_type.rb
actionpack/lib/action_dispatch/http/mime_type.rb
+1
-1
actionpack/lib/action_dispatch/http/parameters.rb
actionpack/lib/action_dispatch/http/parameters.rb
+1
-1
actionpack/lib/action_dispatch/http/upload.rb
actionpack/lib/action_dispatch/http/upload.rb
+2
-2
actionpack/lib/action_dispatch/middleware/stack.rb
actionpack/lib/action_dispatch/middleware/stack.rb
+1
-1
actionpack/lib/action_dispatch/testing/assertions/selector.rb
...onpack/lib/action_dispatch/testing/assertions/selector.rb
+1
-1
actionpack/lib/action_dispatch/testing/test_response.rb
actionpack/lib/action_dispatch/testing/test_response.rb
+2
-2
actionpack/lib/action_view/helpers/form_helper.rb
actionpack/lib/action_view/helpers/form_helper.rb
+3
-3
actionpack/lib/action_view/helpers/form_options_helper.rb
actionpack/lib/action_view/helpers/form_options_helper.rb
+2
-2
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/number_helper.rb
actionpack/lib/action_view/helpers/number_helper.rb
+1
-1
actionpack/lib/action_view/helpers/text_helper.rb
actionpack/lib/action_view/helpers/text_helper.rb
+1
-1
actionpack/lib/action_view/helpers/translation_helper.rb
actionpack/lib/action_view/helpers/translation_helper.rb
+2
-2
actionpack/lib/action_view/render/layouts.rb
actionpack/lib/action_view/render/layouts.rb
+1
-1
activemodel/README
activemodel/README
+2
-1
activemodel/lib/active_model/attribute_methods.rb
activemodel/lib/active_model/attribute_methods.rb
+1
-1
activemodel/lib/active_model/errors.rb
activemodel/lib/active_model/errors.rb
+1
-1
activemodel/lib/active_model/translation.rb
activemodel/lib/active_model/translation.rb
+1
-1
activemodel/lib/active_model/validations.rb
activemodel/lib/active_model/validations.rb
+2
-2
activemodel/lib/active_model/validations/validates.rb
activemodel/lib/active_model/validations/validates.rb
+1
-1
activemodel/lib/active_model/validator.rb
activemodel/lib/active_model/validator.rb
+2
-2
activerecord/lib/active_record/associations.rb
activerecord/lib/active_record/associations.rb
+5
-5
activerecord/lib/active_record/associations/through_association_scope.rb
...b/active_record/associations/through_association_scope.rb
+1
-1
activerecord/lib/active_record/autosave_association.rb
activerecord/lib/active_record/autosave_association.rb
+1
-1
activerecord/lib/active_record/base.rb
activerecord/lib/active_record/base.rb
+1
-1
activerecord/lib/active_record/nested_attributes.rb
activerecord/lib/active_record/nested_attributes.rb
+1
-1
activerecord/lib/active_record/reflection.rb
activerecord/lib/active_record/reflection.rb
+4
-4
activerecord/lib/active_record/relation.rb
activerecord/lib/active_record/relation.rb
+1
-1
activerecord/lib/active_record/schema_dumper.rb
activerecord/lib/active_record/schema_dumper.rb
+6
-6
activeresource/lib/active_resource/base.rb
activeresource/lib/active_resource/base.rb
+2
-2
activesupport/lib/active_support/cache.rb
activesupport/lib/active_support/cache.rb
+1
-1
activesupport/lib/active_support/cache/memory_store.rb
activesupport/lib/active_support/cache/memory_store.rb
+1
-1
activesupport/lib/active_support/core_ext/array/grouping.rb
activesupport/lib/active_support/core_ext/array/grouping.rb
+1
-1
activesupport/lib/active_support/core_ext/range/overlaps.rb
activesupport/lib/active_support/core_ext/range/overlaps.rb
+1
-1
activesupport/lib/active_support/dependencies.rb
activesupport/lib/active_support/dependencies.rb
+1
-1
activesupport/lib/active_support/multibyte.rb
activesupport/lib/active_support/multibyte.rb
+1
-1
activesupport/lib/active_support/notifications.rb
activesupport/lib/active_support/notifications.rb
+1
-1
activesupport/lib/active_support/time_with_zone.rb
activesupport/lib/active_support/time_with_zone.rb
+1
-1
activesupport/lib/active_support/values/time_zone.rb
activesupport/lib/active_support/values/time_zone.rb
+1
-1
未找到文件。
actionmailer/lib/action_mailer/base.rb
浏览文件 @
ef404c77
...
...
@@ -182,7 +182,7 @@ module ActionMailer #:nodoc:
# end
#
# Which will (if it had both a <tt>welcome.text.plain.erb</tt> and <tt>welcome.text.html.erb</tt>
# temp
al
te in the view directory), send a complete <tt>multipart/mixed</tt> email with two parts,
# temp
la
te in the view directory), send a complete <tt>multipart/mixed</tt> email with two parts,
# the first part being a <tt>multipart/alternative</tt> with the text and HTML email parts inside,
# and the second being a <tt>application/pdf</tt> with a Base64 encoded copy of the file.pdf book
# with the filename +free_book.pdf+.
...
...
actionmailer/lib/action_mailer/deprecated_api.rb
浏览文件 @
ef404c77
module
ActionMailer
# This is the API which is deprecated and is going to be removed on Rails 3.1 release.
# Part of the old API will be deprecated after 3.1, for a smoother deprecation process.
# Chec
h
those in OldApi instead.
# Chec
k
those in OldApi instead.
module
DeprecatedApi
#:nodoc:
extend
ActiveSupport
::
Concern
...
...
actionpack/lib/abstract_controller/base.rb
浏览文件 @
ef404c77
...
...
@@ -26,7 +26,7 @@ def inherited(klass)
super
end
# A list of all descend
e
nts of AbstractController::Base. This is
# A list of all descend
a
nts of AbstractController::Base. This is
# useful for initializers which need to add behavior to all controllers.
def
descendants
@descendants
||=
[]
...
...
actionpack/lib/action_controller/metal/request_forgery_protection.rb
浏览文件 @
ef404c77
...
...
@@ -55,7 +55,7 @@ module RequestForgeryProtection
config_accessor
:request_forgery_protection_token
self
.
request_forgery_protection_token
||=
:authenticity_token
# Controls whether request forger
g
y protection is turned on or not. Turned off by default only in test mode.
# Controls whether request forgery protection is turned on or not. Turned off by default only in test mode.
config_accessor
:allow_forgery_protection
self
.
allow_forgery_protection
=
true
if
allow_forgery_protection
.
nil?
...
...
actionpack/lib/action_controller/test_case.rb
浏览文件 @
ef404c77
...
...
@@ -188,7 +188,7 @@ def initialize(session = {})
# Superclass for ActionController functional tests. Functional tests allow you to
# test a single controller action per test method. This should not be confused with
# integration tests (see ActionController::IntegrationTest), which are more like
# "stories" that can involve multiple controllers and mu
tl
iple actions (i.e. multiple
# "stories" that can involve multiple controllers and mu
lt
iple actions (i.e. multiple
# different HTTP requests).
#
# == Basic example
...
...
@@ -442,7 +442,7 @@ def build_request_uri(action, parameters)
end
# When the request.remote_addr remains the default for testing, which is 0.0.0.0, the exception is simply raised inline
# (
byste
pping the regular exception handling from rescue_action). If the request.remote_addr is anything else, the regular
# (
ski
pping the regular exception handling from rescue_action). If the request.remote_addr is anything else, the regular
# rescue_action process takes place. This means you can test your rescue_action code by setting remote_addr to something else
# than 0.0.0.0.
#
...
...
actionpack/lib/action_dispatch/http/mime_type.rb
浏览文件 @
ef404c77
...
...
@@ -60,7 +60,7 @@ class AcceptItem #:nodoc:
def
initialize
(
order
,
name
,
q
=
nil
)
@order
=
order
@name
=
name
.
strip
q
||=
0.0
if
@name
==
Mime
::
ALL
# default wilcard match to end of list
q
||=
0.0
if
@name
==
Mime
::
ALL
# default wil
d
card match to end of list
@q
=
((
q
||
1.0
).
to_f
*
100
).
to_i
end
...
...
actionpack/lib/action_dispatch/http/parameters.rb
浏览文件 @
ef404c77
...
...
@@ -32,7 +32,7 @@ def path_parameters
end
private
# Convert nested Hash
s
to HashWithIndifferentAccess
# Convert nested Hash to HashWithIndifferentAccess
def
normalize_parameters
(
value
)
case
value
when
Hash
...
...
actionpack/lib/action_dispatch/http/upload.rb
浏览文件 @
ef404c77
...
...
@@ -31,8 +31,8 @@ def original_filename
end
module
Upload
# Convert nested Hash
s
to HashWithIndifferentAccess and replace
# file upload hash
s
with UploadedFile objects
# Convert nested Hash to HashWithIndifferentAccess and replace
# file upload hash with UploadedFile objects
def
normalize_parameters
(
value
)
if
Hash
===
value
&&
value
.
has_key?
(
:tempfile
)
upload
=
value
[
:tempfile
]
...
...
actionpack/lib/action_dispatch/middleware/stack.rb
浏览文件 @
ef404c77
...
...
@@ -70,7 +70,7 @@ def use(*args, &block)
end
def
active
ActiveSupport
::
Deprecation
.
warn
"All middlewares in the chain
g
are active since the laziness "
<<
ActiveSupport
::
Deprecation
.
warn
"All middlewares in the chain are active since the laziness "
<<
"was removed from the middleware stack"
,
caller
end
...
...
actionpack/lib/action_dispatch/testing/assertions/selector.rb
浏览文件 @
ef404c77
...
...
@@ -359,7 +359,7 @@ def count_description(min, max, count) #:nodoc:
# position. Possible values are <tt>:top</tt>, <tt>:bottom</tt>, <tt>:before</tt>
# and <tt>:after</tt>.
#
# Use the argument <tt>:redirect</tt> follwed by a path to check that an statement
# Use the argument <tt>:redirect</tt> foll
o
wed by a path to check that an statement
# which redirects to the specified path is generated.
#
# Using the <tt>:remove</tt> statement, you will be able to pass a block, but it will
...
...
actionpack/lib/action_dispatch/testing/test_response.rb
浏览文件 @
ef404c77
...
...
@@ -53,7 +53,7 @@ def redirect_url_match?(pattern)
# Returns the template of the file which was used to
# render this response (or nil)
def
rendered
ActiveSupport
::
Deprecation
.
warn
(
"response.rendered has been deprecated. Use tempate.rendered instead"
,
caller
)
ActiveSupport
::
Deprecation
.
warn
(
"response.rendered has been deprecated. Use temp
l
ate.rendered instead"
,
caller
)
@template
.
instance_variable_get
(
:@_rendered
)
end
...
...
@@ -89,7 +89,7 @@ def has_session_object?(name=nil)
# A shortcut to the template.assigns
def
template_objects
ActiveSupport
::
Deprecation
.
warn
(
"response.template_objects has been deprecated. Use tempate.assigns instead"
,
caller
)
ActiveSupport
::
Deprecation
.
warn
(
"response.template_objects has been deprecated. Use temp
l
ate.assigns instead"
,
caller
)
@template
.
assigns
||
{}
end
...
...
actionpack/lib/action_view/helpers/form_helper.rb
浏览文件 @
ef404c77
...
...
@@ -92,7 +92,7 @@ module Helpers
# # error handling
# end
#
# That's how you t
i
pically work with resources.
# That's how you t
y
pically work with resources.
module
FormHelper
extend
ActiveSupport
::
Concern
...
...
@@ -269,7 +269,7 @@ module FormHelper
# <tt>labelling_form</tt>.
#
# The custom FormBuilder class is automatically merged with the options
# of a nested fields_for call, unless it's explicit
e
ly set.
# of a nested fields_for call, unless it's explicitly set.
#
# In many cases you will want to wrap the above in another helper, so you
# could do something like the following:
...
...
@@ -717,7 +717,7 @@ def text_area(object_name, method, options = {})
#
# To prevent this the helper generates an auxiliary hidden field before
# the very check box. The hidden field has the same name and its
# attributes mimic
k
an unchecked check box.
# attributes mimic an unchecked check box.
#
# This way, the client either sends only the hidden field (representing
# the check box is unchecked), or both fields. Since the HTML specification
...
...
actionpack/lib/action_view/helpers/form_options_helper.rb
浏览文件 @
ef404c77
...
...
@@ -412,8 +412,8 @@ def option_groups_from_collection_for_select(collection, group_method, group_lab
# * +selected_key+ - A value equal to the +value+ attribute for one of the <tt><option></tt> tags,
# which will have the +selected+ attribute set. Note: It is possible for this value to match multiple options
# as you might have the same option in multiple groups. Each will then get <tt>selected="selected"</tt>.
# * +prompt+ - set to true or a prompt string. When the select element doesn
’
t have a value yet, this
# prepends an option with a generic prompt
— "Please select" —
or the given prompt string.
# * +prompt+ - set to true or a prompt string. When the select element doesn
'
t have a value yet, this
# prepends an option with a generic prompt
- "Please select" -
or the given prompt string.
#
# Sample usage (Array):
# grouped_options = [
...
...
actionpack/lib/action_view/helpers/form_tag_helper.rb
浏览文件 @
ef404c77
...
...
@@ -535,7 +535,7 @@ def html_options_for_form(url_for_options, options, *parameters_for_url)
def
extra_tags_for_form
(
html_options
)
case
method
=
html_options
.
delete
(
"method"
).
to_s
when
/^get$/i
# must be case-insentive, but can't use downcase as might be nil
when
/^get$/i
# must be case-insen
si
tive, but can't use downcase as might be nil
html_options
[
"method"
]
=
"get"
''
when
/^post$/i
,
""
,
nil
...
...
actionpack/lib/action_view/helpers/number_helper.rb
浏览文件 @
ef404c77
...
...
@@ -332,7 +332,7 @@ def number_with_precision(number, *args)
# number_to_human_size(483989, :precision => 2) # => 470 KB
# number_to_human_size(1234567, :precision => 2, :separator => ',') # => 1,2 MB
#
#
Un
significant zeros after the fractional separator are stripped out by default (set
#
Non-
significant zeros after the fractional separator are stripped out by default (set
# <tt>:strip_insignificant_zeros</tt> to +false+ to change that):
# number_to_human_size(1234567890123, :precision => 5) # => "1.1229 TB"
# number_to_human_size(524288000, :precision=>5) # => "500 MB"
...
...
actionpack/lib/action_view/helpers/text_helper.rb
浏览文件 @
ef404c77
...
...
@@ -49,7 +49,7 @@ def safe_concat(string)
# truncate("Once upon a time in a world far far away", :length => 17)
# # => "Once upon a ti..."
#
# truncate("Once upon a time in a world far far away", :leng
ht
=> 17, :separator => ' ')
# truncate("Once upon a time in a world far far away", :leng
th
=> 17, :separator => ' ')
# # => "Once upon a..."
#
# truncate("And they found that many people were sleeping better.", :length => 25, :omission => '... (continued)')
...
...
actionpack/lib/action_view/helpers/translation_helper.rb
浏览文件 @
ef404c77
...
...
@@ -11,8 +11,8 @@ module TranslationHelper
# to translate many keys within the same partials and gives you a simple framework for scoping them consistently. If you don't
# prepend the key with a period, nothing is converted.
#
# Third, it
’
ll mark the translation as safe HTML if the key has the suffix "_html" or the last element of the key is the word
# "html". For example, calling translate("footer_html") or translate("footer.html") will return a safe HTML string that won
’
t
# Third, it
'
ll mark the translation as safe HTML if the key has the suffix "_html" or the last element of the key is the word
# "html". For example, calling translate("footer_html") or translate("footer.html") will return a safe HTML string that won
'
t
# be escaped by other HTML helper methods. This naming convention helps to identify translations that include HTML tags so that
# you know what kind of output to expect when you call translate in a template.
...
...
actionpack/lib/action_view/render/layouts.rb
浏览文件 @
ef404c77
...
...
@@ -55,7 +55,7 @@ def _layout_for(name = nil, &block) #:nodoc:
end
# This is the method which actually finds the layout using details in the lookup
# context object. If no layout is found, it check
e
s if at least a layout with
# context object. If no layout is found, it checks if at least a layout with
# the given name exists across all details before raising the error.
def
find_layout
(
layout
)
begin
...
...
activemodel/README
浏览文件 @
ef404c77
...
...
@@ -177,7 +177,8 @@ functionality from the following modules:
end
person = Person.new(:first_name => 'zoolander')
person = Person.new
person.first_name = 'zoolander'
person.valid? #=> false
{Learn more}[link:classes/ActiveModel/Validations.html]
...
...
activemodel/lib/active_model/attribute_methods.rb
浏览文件 @
ef404c77
...
...
@@ -46,7 +46,7 @@ class MissingAttributeError < NoMethodError
# end
# end
#
# Notice that whenever you include ActiveModel::AtributeMethods in your class,
# Notice that whenever you include ActiveModel::At
t
ributeMethods in your class,
# it requires you to implement a <tt>attributes</tt> methods which returns a hash
# with each attribute name in your model as hash key and the attribute value as
# hash value.
...
...
activemodel/lib/active_model/errors.rb
浏览文件 @
ef404c77
...
...
@@ -246,7 +246,7 @@ def full_messages
# (e.g. <tt>activemodel.errors.messages.MESSAGE</tt>). The translated model name,
# translated attribute name and the value are available for interpolation.
#
# When using inherit
ence in your models, it will check all the inherited
# When using inherit
ance in your models, it will check all the inherited
# models too, but only if the model itself hasn't been found. Say you have
# <tt>class Admin < User; end</tt> and you wanted the translation for
# the <tt>:blank</tt> error +message+ for the <tt>title</tt> +attribute+,
...
...
activemodel/lib/active_model/translation.rb
浏览文件 @
ef404c77
...
...
@@ -13,7 +13,7 @@ module ActiveModel
# extend ActiveModel::Translation
# end
#
# TranslatedPerson.human_attribute_name('my_attribue')
# TranslatedPerson.human_attribute_name('my_attribu
t
e')
# #=> "My attribute"
#
# This also provides the required class methods for hooking into the
...
...
activemodel/lib/active_model/validations.rb
浏览文件 @
ef404c77
...
...
@@ -91,7 +91,7 @@ def validates_each(*attr_names, &block)
end
# Adds a validation method or block to the class. This is useful when
# overriding the +validate+ instance method becomes too unwield
l
y and
# overriding the +validate+ instance method becomes too unwieldy and
# you're looking for more descriptive declaration of your validations.
#
# This can be done with a symbol pointing to a method:
...
...
@@ -176,7 +176,7 @@ def invalid?(context = nil)
!
valid?
(
context
)
end
# Hook method defining how an attribute value should be retieved. By default
# Hook method defining how an attribute value should be ret
r
ieved. By default
# this is assumed to be an instance named after the attribute. Override this
# method in subclasses should you need to retrieve the value for a given
# attribute differently:
...
...
activemodel/lib/active_model/validations/validates.rb
浏览文件 @
ef404c77
...
...
@@ -20,7 +20,7 @@ module ClassMethods
# validates :username, :presence => true
# validates :username, :uniqueness => true
#
# The power of the +validates+ method comes when using cusom validators
# The power of the +validates+ method comes when using cus
t
om validators
# and default validators in one call for a given attribute e.g.
#
# class EmailValidator < ActiveModel::EachValidator
...
...
activemodel/lib/active_model/validator.rb
浏览文件 @
ef404c77
...
...
@@ -109,7 +109,7 @@ def self.kind
@kind
||=
name
.
split
(
'::'
).
last
.
underscore
.
sub
(
/_validator$/
,
''
).
to_sym
unless
anonymous?
end
# Accepts options that will be made avail
i
ble through the +options+ reader.
# Accepts options that will be made avail
a
ble through the +options+ reader.
def
initialize
(
options
)
@options
=
options
end
...
...
@@ -155,7 +155,7 @@ def validate(record)
end
end
#
Override this method in subclasses with the validation logic, adding
#
Override this method in subclasses with the validation logic, adding
# errors to the records +errors+ array where necessary.
def
validate_each
(
record
,
attribute
,
value
)
raise
NotImplementedError
...
...
activerecord/lib/active_record/associations.rb
浏览文件 @
ef404c77
...
...
@@ -88,8 +88,8 @@ def initialize(reflection)
end
end
# This error is raised when trying to destroy a parent instance in a N:1, 1:1 asso
sic
ations
# (has_many, has_one) when there is at least 1 child asso
so
ciated instance.
# This error is raised when trying to destroy a parent instance in a N:1, 1:1 asso
ci
ations
# (has_many, has_one) when there is at least 1 child associated instance.
# ex: if @project.tasks.size > 0, DeleteRestrictionError will be raised when trying to destroy @project
class
DeleteRestrictionError
<
ActiveRecordError
#:nodoc:
def
initialize
(
reflection
)
...
...
@@ -890,7 +890,7 @@ module ClassMethods
# [:inverse_of]
# Specifies the name of the <tt>belongs_to</tt> association on the associated object that is the inverse of this <tt>has_many</tt>
# association. Does not work in combination with <tt>:through</tt> or <tt>:as</tt> options.
# See ActiveRecord::Associations::ClassMethods's overview on Bi-directional assocations for more detail.
# See ActiveRecord::Associations::ClassMethods's overview on Bi-directional assoc
i
ations for more detail.
#
# Option examples:
# has_many :comments, :order => "posted_on"
...
...
@@ -1005,7 +1005,7 @@ def has_many(association_id, options = {}, &extension)
# [:inverse_of]
# Specifies the name of the <tt>belongs_to</tt> association on the associated object that is the inverse of this <tt>has_one</tt>
# association. Does not work in combination with <tt>:through</tt> or <tt>:as</tt> options.
# See ActiveRecord::Associations::ClassMethods's overview on Bi-directional assocations for more detail.
# See ActiveRecord::Associations::ClassMethods's overview on Bi-directional assoc
i
ations for more detail.
#
# Option examples:
# has_one :credit_card, :dependent => :destroy # destroys the associated credit card
...
...
@@ -1110,7 +1110,7 @@ def has_one(association_id, options = {})
# [:inverse_of]
# Specifies the name of the <tt>has_one</tt> or <tt>has_many</tt> association on the associated object that is the inverse of this <tt>belongs_to</tt>
# association. Does not work in combination with the <tt>:polymorphic</tt> options.
# See ActiveRecord::Associations::ClassMethods's overview on Bi-directional assocations for more detail.
# See ActiveRecord::Associations::ClassMethods's overview on Bi-directional assoc
i
ations for more detail.
#
# Option examples:
# belongs_to :firm, :foreign_key => "client_of"
...
...
activerecord/lib/active_record/associations/through_association_scope.rb
浏览文件 @
ef404c77
...
...
@@ -91,7 +91,7 @@ def construct_owner_attributes(reflection)
# Construct attributes for :through pointing to owner and associate.
def
construct_join_attributes
(
associate
)
# TODO: revist this to allow it for deletion, supposing dependent option is supported
# TODO: revis
i
t this to allow it for deletion, supposing dependent option is supported
raise
ActiveRecord
::
HasManyThroughCantAssociateThroughHasOneOrManyReflection
.
new
(
@owner
,
@reflection
)
if
[
:has_one
,
:has_many
].
include?
(
@reflection
.
source_reflection
.
macro
)
join_attributes
=
construct_owner_attributes
(
@reflection
.
through_reflection
).
merge
(
@reflection
.
source_reflection
.
primary_key_name
=>
associate
.
id
)
...
...
activerecord/lib/active_record/autosave_association.rb
浏览文件 @
ef404c77
...
...
@@ -375,7 +375,7 @@ def save_belongs_to_association(reflection)
if
association
.
updated?
association_id
=
association
.
send
(
reflection
.
options
[
:primary_key
]
||
:id
)
self
[
reflection
.
primary_key_name
]
=
association_id
# TODO: Removing this code doesn't seem to matter
…
# TODO: Removing this code doesn't seem to matter
...
if
reflection
.
options
[
:polymorphic
]
self
[
reflection
.
options
[
:foreign_type
]]
=
association
.
class
.
base_class
.
name
.
to_s
end
...
...
activerecord/lib/active_record/base.rb
浏览文件 @
ef404c77
...
...
@@ -1446,7 +1446,7 @@ def initialize_copy(other)
# For example in the test suite the topic model's after_initialize method sets the author_email_address to
# test@test.com. I would have thought this would mean that all cloned models would have an author email address
# of test@test.com. However the test_clone test method seems to test that this is not the case. As a result the
# after_initialize callback has to be run *before* the copying of the at
r
ributes rather than afterwards in order
# after_initialize callback has to be run *before* the copying of the at
t
ributes rather than afterwards in order
# for all tests to pass. This makes no sense to me.
callback
(
:after_initialize
)
if
respond_to_without_attributes?
(
:after_initialize
)
cloned_attributes
=
other
.
clone_attributes
(
:read_attribute_before_type_cast
)
...
...
activerecord/lib/active_record/nested_attributes.rb
浏览文件 @
ef404c77
...
...
@@ -278,7 +278,7 @@ def _destroy
# Assigns the given attributes to the association.
#
# If update_only is false and the given attributes include an <tt>:id</tt>
# that matches the existing record
’
s id, then the existing record will be
# that matches the existing record
'
s id, then the existing record will be
# modified. If update_only is true, a new record is only created when no
# object exists. Otherwise a new record will be built.
#
...
...
activerecord/lib/active_record/reflection.rb
浏览文件 @
ef404c77
...
...
@@ -165,14 +165,14 @@ def build_association(*options)
klass
.
new
(
*
options
)
end
# Creates a new instance of the associated class, and immediate
s
saves it
# Creates a new instance of the associated class, and immediate
ly
saves it
# with ActiveRecord::Base#save. +options+ will be passed to the class's
# creation method. Returns the newly created object.
def
create_association
(
*
options
)
klass
.
create
(
*
options
)
end
# Creates a new instance of the associated class, and immediate
s
saves it
# Creates a new instance of the associated class, and immediate
ly
saves it
# with ActiveRecord::Base#save!. +options+ will be passed to the class's
# creation method. If the created record doesn't pass validations, then an
# exception will be raised.
...
...
@@ -267,10 +267,10 @@ def collection?
# Returns whether or not the association should be validated as part of
# the parent's validation.
#
# Unless you explicit
e
ly disable validation with
# Unless you explicitly disable validation with
# <tt>:validate => false</tt>, it will take place when:
#
# * you explicit
e
ly enable validation; <tt>:validate => true</tt>
# * you explicitly enable validation; <tt>:validate => true</tt>
# * you use autosave; <tt>:autosave => true</tt>
# * the association is a +has_many+ association
def
validate?
...
...
activerecord/lib/active_record/relation.rb
浏览文件 @
ef404c77
...
...
@@ -67,7 +67,7 @@ def to_a
preload
+=
@includes_values
unless
eager_loading?
preload
.
each
{
|
associations
|
@klass
.
send
(
:preload_associations
,
@records
,
associations
)
}
# @readonly_value is true only if set explicity. @implicit_readonly is true if there are JOINS and no explicit SELECT.
# @readonly_value is true only if set explicit
l
y. @implicit_readonly is true if there are JOINS and no explicit SELECT.
readonly
=
@readonly_value
.
nil?
?
@implicit_readonly
:
@readonly_value
@records
.
each
{
|
record
|
record
.
readonly!
}
if
readonly
...
...
activerecord/lib/active_record/schema_dumper.rb
浏览文件 @
ef404c77
...
...
@@ -173,15 +173,15 @@ def default_string(value)
def
indexes
(
table
,
stream
)
if
(
indexes
=
@connection
.
indexes
(
table
)).
any?
add_index_statements
=
indexes
.
map
do
|
index
|
statment_parts
=
[
(
'add_index '
+
index
.
table
.
inspect
)
]
statment_parts
<<
index
.
columns
.
inspect
statment_parts
<<
(
':name => '
+
index
.
name
.
inspect
)
statment_parts
<<
':unique => true'
if
index
.
unique
stat
e
ment_parts
=
[
(
'add_index '
+
index
.
table
.
inspect
)
]
stat
e
ment_parts
<<
index
.
columns
.
inspect
stat
e
ment_parts
<<
(
':name => '
+
index
.
name
.
inspect
)
stat
e
ment_parts
<<
':unique => true'
if
index
.
unique
index_lengths
=
index
.
lengths
.
compact
if
index
.
lengths
.
is_a?
(
Array
)
statment_parts
<<
(
':length => '
+
Hash
[
*
index
.
columns
.
zip
(
index
.
lengths
).
flatten
].
inspect
)
if
index_lengths
.
present?
stat
e
ment_parts
<<
(
':length => '
+
Hash
[
*
index
.
columns
.
zip
(
index
.
lengths
).
flatten
].
inspect
)
if
index_lengths
.
present?
' '
+
statment_parts
.
join
(
', '
)
' '
+
stat
e
ment_parts
.
join
(
', '
)
end
stream
.
puts
add_index_statements
.
sort
.
join
(
"
\n
"
)
...
...
activeresource/lib/active_resource/base.rb
浏览文件 @
ef404c77
...
...
@@ -763,7 +763,7 @@ def create(attributes = {})
# With any other scope, find returns nil when no data is returned.
#
# Person.find(1)
# # => raises Resource
n
otFound
# # => raises Resource
N
otFound
#
# Person.find(:all)
# Person.find(:first)
...
...
@@ -941,7 +941,7 @@ def schema
end
# This is a list of known attributes for this resource. Either
# gathered fromthe provided <tt>schema</tt>, or from the attributes
# gathered from
the provided <tt>schema</tt>, or from the attributes
# set on this instance after it has been fetched from the remote system.
def
known_attributes
self
.
class
.
known_attributes
+
self
.
attributes
.
keys
.
map
(
&
:to_s
)
...
...
activesupport/lib/active_support/cache.rb
浏览文件 @
ef404c77
...
...
@@ -22,7 +22,7 @@ module Cache
EMPTY_OPTIONS
=
{}.
freeze
# These options mean something to all cache implementations. Individual cache
# implementations may support additional optons.
# implementations may support additional opt
i
ons.
UNIVERSAL_OPTIONS
=
[
:namespace
,
:compress
,
:compress_threshold
,
:expires_in
,
:race_condition_ttl
]
module
Strategy
...
...
activesupport/lib/active_support/cache/memory_store.rb
浏览文件 @
ef404c77
...
...
@@ -10,7 +10,7 @@ module Cache
# appropriate cache for you.
#
# This cache has a bounded size specified by the :size options to the
# initializer (default is 32Mb). When the cache exceeds the alotted size,
# initializer (default is 32Mb). When the cache exceeds the al
l
otted size,
# a cleanup will occur which tries to prune the cache down to three quarters
# of the maximum size by removing the least recently used entries.
#
...
...
activesupport/lib/active_support/core_ext/array/grouping.rb
浏览文件 @
ef404c77
...
...
@@ -55,7 +55,7 @@ def in_groups_of(number, fill_with = nil)
# ["6", "7"]
def
in_groups
(
number
,
fill_with
=
nil
)
# size / number gives minor group size;
# size % number gives how many objects need extra accomodation;
# size % number gives how many objects need extra accom
m
odation;
# each group hold either division or division + 1 items.
division
=
size
/
number
modulo
=
size
%
number
...
...
activesupport/lib/active_support/core_ext/range/overlaps.rb
浏览文件 @
ef404c77
class
Range
# Compare two ranges and see if they overlap eachother
# Compare two ranges and see if they overlap each
other
# (1..5).overlaps?(4..6) # => true
# (1..5).overlaps?(7..9) # => false
def
overlaps?
(
other
)
...
...
activesupport/lib/active_support/dependencies.rb
浏览文件 @
ef404c77
...
...
@@ -340,7 +340,7 @@ def qualified_const_defined?(path)
if
Module
.
method
(:
const_defined?
).
arity
==
1
# Does this module define this constant?
# Wrapper to accomodate changing Module#const_defined? in Ruby 1.9
# Wrapper to accom
m
odate changing Module#const_defined? in Ruby 1.9
def
local_const_defined?
(
mod
,
const
)
mod
.
const_defined?
(
const
)
end
...
...
activesupport/lib/active_support/multibyte.rb
浏览文件 @
ef404c77
...
...
@@ -17,7 +17,7 @@ def self.proxy_class=(klass)
@proxy_class
=
klass
end
# Returns the curre
c
t proxy class
# Returns the curre
n
t proxy class
def
self
.
proxy_class
@proxy_class
||=
ActiveSupport
::
Multibyte
::
Chars
end
...
...
activesupport/lib/active_support/notifications.rb
浏览文件 @
ef404c77
...
...
@@ -23,7 +23,7 @@ module ActiveSupport
#
# event = @events.first
# event.name #=> :render
# event.duration #=> 10 (in miliseconds)
# event.duration #=> 10 (in mil
l
iseconds)
# event.result #=> "Foo"
# event.payload #=> { :extra => :information }
#
...
...
activesupport/lib/active_support/time_with_zone.rb
浏览文件 @
ef404c77
...
...
@@ -18,7 +18,7 @@ module ActiveSupport
#
# See Time and TimeZone for further documentation of these methods.
#
# TimeWithZone instances implement the same API as Ruby Time instances, so that Time and TimeWithZone instances are interchangable. Examples:
# TimeWithZone instances implement the same API as Ruby Time instances, so that Time and TimeWithZone instances are interchang
e
able. Examples:
#
# t = Time.zone.now # => Sun, 18 May 2008 13:27:25 EDT -04:00
# t.hour # => 13
...
...
activesupport/lib/active_support/values/time_zone.rb
浏览文件 @
ef404c77
...
...
@@ -224,7 +224,7 @@ def formatted_offset(colon=true, alternate_utc_string = nil)
utc_offset
==
0
&&
alternate_utc_string
||
self
.
class
.
seconds_to_utc_offset
(
utc_offset
,
colon
)
end
# Compare this time zone to the parameter. The two are com
ap
red first on
# Compare this time zone to the parameter. The two are com
pa
red first on
# their offsets, and then by name.
def
<
=>
(
zone
)
result
=
(
utc_offset
<=>
zone
.
utc_offset
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录