mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Merge pull request #39477 from p8/improve-inspect
Make custom inspect methods more consistent
This commit is contained in:
commit
35fe9bc0aa
6 changed files with 6 additions and 6 deletions
|
@ -855,7 +855,7 @@ module ActionController
|
|||
end
|
||||
|
||||
def inspect
|
||||
"<#{self.class} #{@parameters} permitted: #{@permitted}>"
|
||||
"#<#{self.class} #{@parameters} permitted: #{@permitted}>"
|
||||
end
|
||||
|
||||
def self.hook_into_yaml_loading # :nodoc:
|
||||
|
|
|
@ -369,7 +369,7 @@ class ParametersAccessorsTest < ActiveSupport::TestCase
|
|||
|
||||
test "inspect shows both class name, parameters and permitted flag" do
|
||||
assert_equal(
|
||||
'<ActionController::Parameters {"person"=>{"age"=>"32", '\
|
||||
'#<ActionController::Parameters {"person"=>{"age"=>"32", '\
|
||||
'"name"=>{"first"=>"David", "last"=>"Heinemeier Hansson"}, ' \
|
||||
'"addresses"=>[{"city"=>"Chicago", "state"=>"Illinois"}]}} permitted: false>',
|
||||
@params.inspect
|
||||
|
|
|
@ -169,7 +169,7 @@ module ActiveModel
|
|||
end
|
||||
|
||||
def inspect # :nodoc:
|
||||
"<##{self.class.name} attribute=#{@attribute}, type=#{@type}, options=#{@options.inspect}>"
|
||||
"#<#{self.class.name} attribute=#{@attribute}, type=#{@type}, options=#{@options.inspect}>"
|
||||
end
|
||||
|
||||
protected
|
||||
|
|
|
@ -104,7 +104,7 @@ module ActiveSupport
|
|||
end
|
||||
|
||||
def inspect # :nodoc:
|
||||
"<##{self.class.name} entries=#{@data.size}, size=#{@cache_size}, options=#{@options.inspect}>"
|
||||
"#<#{self.class.name} entries=#{@data.size}, size=#{@cache_size}, options=#{@options.inspect}>"
|
||||
end
|
||||
|
||||
# Synchronize calls to the cache. This should be called wherever the underlying cache implementation
|
||||
|
|
|
@ -195,7 +195,7 @@ module ActiveSupport
|
|||
|
||||
def inspect
|
||||
instance = @redis || @redis_options
|
||||
"<##{self.class} options=#{options.inspect} redis=#{instance.inspect}>"
|
||||
"#<#{self.class} options=#{options.inspect} redis=#{instance.inspect}>"
|
||||
end
|
||||
|
||||
# Cache Store API implementation.
|
||||
|
|
|
@ -1319,7 +1319,7 @@ module ApplicationTests
|
|||
app "development"
|
||||
|
||||
post "/posts.json", '{ "title": "foo", "name": "bar" }', "CONTENT_TYPE" => "application/json"
|
||||
assert_equal '<ActionController::Parameters {"title"=>"foo"} permitted: false>', last_response.body
|
||||
assert_equal '#<ActionController::Parameters {"title"=>"foo"} permitted: false>', last_response.body
|
||||
end
|
||||
|
||||
test "config.action_controller.permit_all_parameters = true" do
|
||||
|
|
Loading…
Reference in a new issue