1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

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

Clean up all Rails 5 warnings. Revert auto-added periods.
This commit is contained in:
Jeremy Daer 2016-04-11 14:31:08 -07:00
commit 1a5fdf7712
14 changed files with 19 additions and 20 deletions

View file

@ -213,7 +213,7 @@ module ActionController #:nodoc:
if !verified_request? if !verified_request?
if logger && log_warning_on_csrf_failure if logger && log_warning_on_csrf_failure
logger.warn "Can't verify CSRF token authenticity" logger.warn "Can't verify CSRF token authenticity."
end end
handle_unverified_request handle_unverified_request
end end

View file

@ -1598,7 +1598,7 @@ module ActionDispatch
route_options = options.dup route_options = options.dup
if _path && option_path if _path && option_path
ActiveSupport::Deprecation.warn <<-eowarn 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} match #{_path.inspect}, :path => #{option_path.inspect}

View file

@ -517,14 +517,14 @@ module ActionDispatch
if route.segment_keys.include?(:controller) if route.segment_keys.include?(:controller)
ActiveSupport::Deprecation.warn(<<-MSG.squish) ActiveSupport::Deprecation.warn(<<-MSG.squish)
Using a dynamic :controller segment in a route is deprecated and 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 MSG
end end
if route.segment_keys.include?(:action) if route.segment_keys.include?(:action)
ActiveSupport::Deprecation.warn(<<-MSG.squish) ActiveSupport::Deprecation.warn(<<-MSG.squish)
Using a dynamic :action segment in a route is deprecated and 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 MSG
end end

View file

@ -95,7 +95,7 @@ module ActionDispatch
ActiveSupport::Deprecation.warn(<<-MSG.strip_heredoc) ActiveSupport::Deprecation.warn(<<-MSG.strip_heredoc)
xhr and xml_http_request methods are deprecated in favor of 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 MSG
process(request_method, path, params: params, headers: headers, xhr: true) process(request_method, path, params: params, headers: headers, xhr: true)

View file

@ -205,7 +205,7 @@ module ActionController
def overfill_buffer_and_die def overfill_buffer_and_die
logger = ActionController::Base.logger || Logger.new($stdout) logger = ActionController::Base.logger || Logger.new($stdout)
response.stream.on_error do response.stream.on_error do
logger.warn 'Error while streaming' logger.warn 'Error while streaming.'
error_latch.count_down error_latch.count_down
end end

View file

@ -346,7 +346,7 @@ module ActiveModel
# # => {:name=>["can't be empty"]} # # => {:name=>["can't be empty"]}
def add_on_empty(attributes, options = {}) def add_on_empty(attributes, options = {})
ActiveSupport::Deprecation.warn(<<-MESSAGE.squish) 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: To achieve the same use:
@ -368,7 +368,7 @@ module ActiveModel
# # => {:name=>["can't be blank"]} # # => {:name=>["can't be blank"]}
def add_on_blank(attributes, options = {}) def add_on_blank(attributes, options = {})
ActiveSupport::Deprecation.warn(<<-MESSAGE.squish) 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: To achieve the same use:

View file

@ -325,7 +325,7 @@ module ActiveRecord
select_value("SELECT setval('#{quoted_sequence}', #{value})", 'SCHEMA') select_value("SELECT setval('#{quoted_sequence}', #{value})", 'SCHEMA')
else 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 end
end end
@ -340,7 +340,7 @@ module ActiveRecord
end end
if @logger && pk && !sequence 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 end
if pk && sequence if pk && sequence

View file

@ -159,7 +159,7 @@ module ActiveRecord
id = id.id id = id.id
ActiveSupport::Deprecation.warn(<<-MSG.squish) ActiveSupport::Deprecation.warn(<<-MSG.squish)
You are passing an instance of ActiveRecord::Base to `find`. 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 MSG
end end

View file

@ -874,7 +874,7 @@ module ActiveRecord
example_options = options.dup example_options = options.dup
example_options[:source] = source_reflection_names.first example_options[:source] = source_reflection_names.first
ActiveSupport::Deprecation.warn \ 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" \ "specify a :source directive on your declaration like:\n" \
"\n" \ "\n" \
" class #{active_record.name} < ActiveRecord::Base\n" \ " class #{active_record.name} < ActiveRecord::Base\n" \

View file

@ -428,7 +428,7 @@ module ActiveRecord
id = id.id id = id.id
ActiveSupport::Deprecation.warn(<<-MSG.squish) ActiveSupport::Deprecation.warn(<<-MSG.squish)
You are passing an instance of ActiveRecord::Base to `update`. 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 MSG
end end
object = find(id) object = find(id)
@ -457,7 +457,7 @@ module ActiveRecord
if conditions if conditions
ActiveSupport::Deprecation.warn(<<-MESSAGE.squish) ActiveSupport::Deprecation.warn(<<-MESSAGE.squish)
Passing conditions to destroy_all is deprecated and will be removed in Rails 5.1. 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 MESSAGE
where(conditions).destroy_all where(conditions).destroy_all
else else
@ -527,7 +527,7 @@ module ActiveRecord
if conditions if conditions
ActiveSupport::Deprecation.warn(<<-MESSAGE.squish) ActiveSupport::Deprecation.warn(<<-MESSAGE.squish)
Passing conditions to delete_all is deprecated and will be removed in Rails 5.1. 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 MESSAGE
where(conditions).delete_all where(conditions).delete_all
else else

View file

@ -2,7 +2,7 @@ require "active_record/relation/batches/batch_enumerator"
module ActiveRecord module ActiveRecord
module Batches 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 # Looping through a collection of records from the database
# (using the Scoping::Named::ClassMethods.all method, for example) # (using the Scoping::Named::ClassMethods.all method, for example)

View file

@ -312,7 +312,7 @@ module ActiveRecord
conditions = conditions.id conditions = conditions.id
ActiveSupport::Deprecation.warn(<<-MSG.squish) ActiveSupport::Deprecation.warn(<<-MSG.squish)
You are passing an instance of ActiveRecord::Base to `exists?`. 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 MSG
end end
@ -467,7 +467,7 @@ module ActiveRecord
id = id.id id = id.id
ActiveSupport::Deprecation.warn(<<-MSG.squish) ActiveSupport::Deprecation.warn(<<-MSG.squish)
You are passing an instance of ActiveRecord::Base to `find`. 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 MSG
end end

View file

@ -126,7 +126,7 @@ module ActiveSupport
def set_cache_value(value, name, amount, options) # :nodoc: def set_cache_value(value, name, amount, options) # :nodoc:
ActiveSupport::Deprecation.warn(<<-MESSAGE.strip_heredoc) ActiveSupport::Deprecation.warn(<<-MESSAGE.strip_heredoc)
`set_cache_value` is deprecated and will be removed from Rails 5.1. `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 MESSAGE
write_cache_value name, value, options write_cache_value name, value, options
end end

View file

@ -65,7 +65,6 @@ module ActiveSupport
def deprecation_message(callstack, 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 ||= "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)}" "DEPRECATION WARNING: #{message} #{deprecation_caller_message(callstack)}"
end end