提交 ef404c77 编写于 作者: E Evgeniy Dolzhenko

Fix a bunch of minor spelling mistakes

......@@ -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>
# tempalte in the view directory), send a complete <tt>multipart/mixed</tt> email with two parts,
# template 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+.
......
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.
# Chech those in OldApi instead.
# Check those in OldApi instead.
module DeprecatedApi #:nodoc:
extend ActiveSupport::Concern
......
......@@ -26,7 +26,7 @@ def inherited(klass)
super
end
# A list of all descendents of AbstractController::Base. This is
# A list of all descendants of AbstractController::Base. This is
# useful for initializers which need to add behavior to all controllers.
def descendants
@descendants ||= []
......
......@@ -55,7 +55,7 @@ module RequestForgeryProtection
config_accessor :request_forgery_protection_token
self.request_forgery_protection_token ||= :authenticity_token
# Controls whether request forgergy 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?
......
......@@ -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 mutliple actions (i.e. multiple
# "stories" that can involve multiple controllers and multiple 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
# (bystepping the regular exception handling from rescue_action). If the request.remote_addr is anything else, the regular
# (skipping 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.
#
......
......@@ -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 wildcard match to end of list
@q = ((q || 1.0).to_f * 100).to_i
end
......
......@@ -32,7 +32,7 @@ def path_parameters
end
private
# Convert nested Hashs to HashWithIndifferentAccess
# Convert nested Hash to HashWithIndifferentAccess
def normalize_parameters(value)
case value
when Hash
......
......@@ -31,8 +31,8 @@ def original_filename
end
module Upload
# Convert nested Hashs to HashWithIndifferentAccess and replace
# file upload hashs 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]
......
......@@ -70,7 +70,7 @@ def use(*args, &block)
end
def active
ActiveSupport::Deprecation.warn "All middlewares in the chaing 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
......
......@@ -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> followed 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
......
......@@ -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 template.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 template.assigns instead", caller)
@template.assigns || {}
end
......
......@@ -92,7 +92,7 @@ module Helpers
# # error handling
# end
#
# That's how you tipically work with resources.
# That's how you typically 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 explicitely 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 mimick 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
......
......@@ -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 doesnt 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 = [
......
......@@ -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-insensitive, but can't use downcase as might be nil
html_options["method"] = "get"
''
when /^post$/i, "", nil
......
......@@ -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
#
# Unsignificant 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"
......
......@@ -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", :lenght => 17, :separator => ' ')
# truncate("Once upon a time in a world far far away", :length => 17, :separator => ' ')
# # => "Once upon a..."
#
# truncate("And they found that many people were sleeping better.", :length => 25, :omission => '... (continued)')
......
......@@ -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, itll 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 wont
# 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.
......
......@@ -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 checkes 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
......
......@@ -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]
......
......@@ -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::AttributeMethods 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.
......
......@@ -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 inheritence in your models, it will check all the inherited
# When using inheritance 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+,
......
......@@ -13,7 +13,7 @@ module ActiveModel
# extend ActiveModel::Translation
# end
#
# TranslatedPerson.human_attribute_name('my_attribue')
# TranslatedPerson.human_attribute_name('my_attribute')
# #=> "My attribute"
#
# This also provides the required class methods for hooking into the
......
......@@ -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 unwieldly 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 retrieved. 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:
......
......@@ -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 custom validators
# and default validators in one call for a given attribute e.g.
#
# class EmailValidator < ActiveModel::EachValidator
......
......@@ -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 availible through the +options+ reader.
# Accepts options that will be made available 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
......
......@@ -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 assosications
# (has_many, has_one) when there is at least 1 child assosociated instance.
# This error is raised when trying to destroy a parent instance in a N:1, 1:1 associations
# (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 associations 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 associations 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 associations for more detail.
#
# Option examples:
# belongs_to :firm, :foreign_key => "client_of"
......
......@@ -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: revisit 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)
......
......@@ -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
......
......@@ -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 atrributes rather than afterwards in order
# after_initialize callback has to be run *before* the copying of the attributes 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)
......
......@@ -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 records 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.
#
......
......@@ -165,14 +165,14 @@ def build_association(*options)
klass.new(*options)
end
# Creates a new instance of the associated class, and immediates saves it
# Creates a new instance of the associated class, and immediately 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 immediates saves it
# Creates a new instance of the associated class, and immediately 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 explicitely disable validation with
# Unless you explicitly disable validation with
# <tt>:validate => false</tt>, it will take place when:
#
# * you explicitely 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?
......
......@@ -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 explicitly. @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
......
......@@ -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
statement_parts = [ ('add_index ' + index.table.inspect) ]
statement_parts << index.columns.inspect
statement_parts << (':name => ' + index.name.inspect)
statement_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?
statement_parts << (':length => ' + Hash[*index.columns.zip(index.lengths).flatten].inspect) if index_lengths.present?
' ' + statment_parts.join(', ')
' ' + statement_parts.join(', ')
end
stream.puts add_index_statements.sort.join("\n")
......
......@@ -763,7 +763,7 @@ def create(attributes = {})
# With any other scope, find returns nil when no data is returned.
#
# Person.find(1)
# # => raises ResourcenotFound
# # => raises ResourceNotFound
#
# 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)
......
......@@ -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 options.
UNIVERSAL_OPTIONS = [:namespace, :compress, :compress_threshold, :expires_in, :race_condition_ttl]
module Strategy
......
......@@ -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 allotted 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.
#
......
......@@ -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 accommodation;
# each group hold either division or division + 1 items.
division = size / number
modulo = size % number
......
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)
......
......@@ -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 accommodate changing Module#const_defined? in Ruby 1.9
def local_const_defined?(mod, const)
mod.const_defined?(const)
end
......
......@@ -17,7 +17,7 @@ def self.proxy_class=(klass)
@proxy_class = klass
end
# Returns the currect proxy class
# Returns the current proxy class
def self.proxy_class
@proxy_class ||= ActiveSupport::Multibyte::Chars
end
......
......@@ -23,7 +23,7 @@ module ActiveSupport
#
# event = @events.first
# event.name #=> :render
# event.duration #=> 10 (in miliseconds)
# event.duration #=> 10 (in milliseconds)
# event.result #=> "Foo"
# event.payload #=> { :extra => :information }
#
......
......@@ -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 interchangeable. Examples:
#
# t = Time.zone.now # => Sun, 18 May 2008 13:27:25 EDT -04:00
# t.hour # => 13
......
......@@ -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 comapred first on
# Compare this time zone to the parameter. The two are compared 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.
先完成此消息的编辑!
想要评论请 注册