File tree Expand file tree Collapse file tree 2 files changed +5
-1
lines changed Expand file tree Collapse file tree 2 files changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -350,7 +350,7 @@ def inspection_filter # :nodoc:
350
350
351
351
# Returns a string like 'Post(id:integer, title:string, body:text)'
352
352
def inspect # :nodoc:
353
- if self == Base
353
+ if self == Base || singleton_class?
354
354
super
355
355
elsif abstract_class?
356
356
"#{ super } (abstract)"
Original file line number Diff line number Diff line change @@ -47,6 +47,10 @@ def test_inspect_new_instance
47
47
assert_match ( /Topic id: nil/ , Topic . new . inspect )
48
48
end
49
49
50
+ def test_inspect_singleton_instance
51
+ assert_match ( /#<Class:#<Topic:\w +>>/ , Topic . new . singleton_class . inspect )
52
+ end
53
+
50
54
def test_inspect_limited_select_instance
51
55
Topic . stub ( :attributes_for_inspect , [ :id , :title ] ) do
52
56
assert_equal %(#<Topic id: 1>) , Topic . all . merge! ( select : "id" , where : "id = 1" ) . first . inspect
You can’t perform that action at this time.
0 commit comments