提交 1a5fdf77 编写于 作者: J Jeremy Daer

Merge pull request #24492 from vipulnsward/pass-over-warnings

Clean up all Rails 5 warnings. Revert auto-added periods.
......@@ -213,7 +213,7 @@ def verify_authenticity_token
if !verified_request?
if logger && log_warning_on_csrf_failure
logger.warn "Can't verify CSRF token authenticity"
logger.warn "Can't verify CSRF token authenticity."
end
handle_unverified_request
end
......
......@@ -1598,7 +1598,7 @@ def match(path, *rest)
route_options = options.dup
if _path && option_path
ActiveSupport::Deprecation.warn <<-eowarn
Specifying strings for both :path and the route path is deprecated. Change things like this:
Specifying strings for both :path and the route path is deprecated. Change things like this:
match #{_path.inspect}, :path => #{option_path.inspect}
......
......@@ -517,14 +517,14 @@ def add_route(mapping, path_ast, name, anchor)
if route.segment_keys.include?(:controller)
ActiveSupport::Deprecation.warn(<<-MSG.squish)
Using a dynamic :controller segment in a route is deprecated and
will be removed in Rails 5.1
will be removed in Rails 5.1.
MSG
end
if route.segment_keys.include?(:action)
ActiveSupport::Deprecation.warn(<<-MSG.squish)
Using a dynamic :action segment in a route is deprecated and
will be removed in Rails 5.1
will be removed in Rails 5.1.
MSG
end
......
......@@ -95,7 +95,7 @@ def xml_http_request(request_method, path, *args)
ActiveSupport::Deprecation.warn(<<-MSG.strip_heredoc)
xhr and xml_http_request methods are deprecated in favor of
`get "/posts", xhr: true` and `post "/posts/1", xhr: true`
`get "/posts", xhr: true` and `post "/posts/1", xhr: true`.
MSG
process(request_method, path, params: params, headers: headers, xhr: true)
......
......@@ -205,7 +205,7 @@ def exception_in_exception_callback
def overfill_buffer_and_die
logger = ActionController::Base.logger || Logger.new($stdout)
response.stream.on_error do
logger.warn 'Error while streaming'
logger.warn 'Error while streaming.'
error_latch.count_down
end
......
......@@ -346,7 +346,7 @@ def add(attribute, message = :invalid, options = {})
# # => {:name=>["can't be empty"]}
def add_on_empty(attributes, options = {})
ActiveSupport::Deprecation.warn(<<-MESSAGE.squish)
ActiveModel::Errors#add_on_empty is deprecated and will be removed in Rails 5.1
ActiveModel::Errors#add_on_empty is deprecated and will be removed in Rails 5.1.
To achieve the same use:
......@@ -368,7 +368,7 @@ def add_on_empty(attributes, options = {})
# # => {:name=>["can't be blank"]}
def add_on_blank(attributes, options = {})
ActiveSupport::Deprecation.warn(<<-MESSAGE.squish)
ActiveModel::Errors#add_on_blank is deprecated and will be removed in Rails 5.1
ActiveModel::Errors#add_on_blank is deprecated and will be removed in Rails 5.1.
To achieve the same use:
......
......@@ -325,7 +325,7 @@ def set_pk_sequence!(table, value) #:nodoc:
select_value("SELECT setval('#{quoted_sequence}', #{value})", 'SCHEMA')
else
@logger.warn "#{table} has primary key #{pk} with no default sequence" if @logger
@logger.warn "#{table} has primary key #{pk} with no default sequence." if @logger
end
end
end
......@@ -340,7 +340,7 @@ def reset_pk_sequence!(table, pk = nil, sequence = nil) #:nodoc:
end
if @logger && pk && !sequence
@logger.warn "#{table} has primary key #{pk} with no default sequence"
@logger.warn "#{table} has primary key #{pk} with no default sequence."
end
if pk && sequence
......
......@@ -159,7 +159,7 @@ def find(*ids) # :nodoc:
id = id.id
ActiveSupport::Deprecation.warn(<<-MSG.squish)
You are passing an instance of ActiveRecord::Base to `find`.
Please pass the id of the object by calling `.id`
Please pass the id of the object by calling `.id`.
MSG
end
......
......@@ -874,7 +874,7 @@ def source_reflection_name # :nodoc:
example_options = options.dup
example_options[:source] = source_reflection_names.first
ActiveSupport::Deprecation.warn \
"Ambiguous source reflection for through association. Please " \
"Ambiguous source reflection for through association. Please " \
"specify a :source directive on your declaration like:\n" \
"\n" \
" class #{active_record.name} < ActiveRecord::Base\n" \
......
......@@ -428,7 +428,7 @@ def update(id = :all, attributes)
id = id.id
ActiveSupport::Deprecation.warn(<<-MSG.squish)
You are passing an instance of ActiveRecord::Base to `update`.
Please pass the id of the object by calling `.id`
Please pass the id of the object by calling `.id`.
MSG
end
object = find(id)
......@@ -457,7 +457,7 @@ def destroy_all(conditions = nil)
if conditions
ActiveSupport::Deprecation.warn(<<-MESSAGE.squish)
Passing conditions to destroy_all is deprecated and will be removed in Rails 5.1.
To achieve the same use where(conditions).destroy_all
To achieve the same use where(conditions).destroy_all.
MESSAGE
where(conditions).destroy_all
else
......@@ -527,7 +527,7 @@ def delete_all(conditions = nil)
if conditions
ActiveSupport::Deprecation.warn(<<-MESSAGE.squish)
Passing conditions to delete_all is deprecated and will be removed in Rails 5.1.
To achieve the same use where(conditions).delete_all
To achieve the same use where(conditions).delete_all.
MESSAGE
where(conditions).delete_all
else
......
......@@ -2,7 +2,7 @@
module ActiveRecord
module Batches
ORDER_OR_LIMIT_IGNORED_MESSAGE = "Scoped order and limit are ignored, it's forced to be batch order and batch size"
ORDER_OR_LIMIT_IGNORED_MESSAGE = "Scoped order and limit are ignored, it's forced to be batch order and batch size."
# Looping through a collection of records from the database
# (using the Scoping::Named::ClassMethods.all method, for example)
......
......@@ -312,7 +312,7 @@ def exists?(conditions = :none)
conditions = conditions.id
ActiveSupport::Deprecation.warn(<<-MSG.squish)
You are passing an instance of ActiveRecord::Base to `exists?`.
Please pass the id of the object by calling `.id`
Please pass the id of the object by calling `.id`.
MSG
end
......@@ -467,7 +467,7 @@ def find_one(id)
id = id.id
ActiveSupport::Deprecation.warn(<<-MSG.squish)
You are passing an instance of ActiveRecord::Base to `find`.
Please pass the id of the object by calling `.id`
Please pass the id of the object by calling `.id`.
MSG
end
......
......@@ -126,7 +126,7 @@ def delete_entry(key, options) # :nodoc:
def set_cache_value(value, name, amount, options) # :nodoc:
ActiveSupport::Deprecation.warn(<<-MESSAGE.strip_heredoc)
`set_cache_value` is deprecated and will be removed from Rails 5.1.
Please use `write_cache_value`
Please use `write_cache_value` instead.
MESSAGE
write_cache_value name, value, options
end
......
......@@ -65,7 +65,6 @@ def deprecated_method_warning(method_name, message = nil)
def deprecation_message(callstack, message = nil)
message ||= "You are using deprecated behavior which will be removed from the next major or minor release."
message += '.' unless message =~ /\.$/
"DEPRECATION WARNING: #{message} #{deprecation_caller_message(callstack)}"
end
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册