File tree 2 files changed +9
-1
lines changed
2 files changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -44,7 +44,8 @@ def excluded?
44
44
end
45
45
46
46
def object_label
47
- bindings [ :object ] . send object_label_method
47
+ bindings [ :object ] . send ( object_label_method ) . presence ||
48
+ bindings [ :object ] . send ( :rails_admin_default_object_label_method )
48
49
end
49
50
50
51
# The display for a model instance (i.e. a single database record).
Original file line number Diff line number Diff line change 26
26
c = Comment . new ( content : 'test' )
27
27
expect ( RailsAdmin . config ( Comment ) . with ( object : c ) . object_label ) . to eq ( 'test' )
28
28
end
29
+
30
+ context 'when the object_label_method is blank' do
31
+ it 'uses the rails admin default' do
32
+ c = Comment . create ( content : '' , id : '1' )
33
+ expect ( RailsAdmin . config ( Comment ) . with ( object : c ) . object_label ) . to eq ( 'Comment #1' )
34
+ end
35
+ end
29
36
end
30
37
31
38
describe '#object_label_method' do
You can’t perform that action at this time.
0 commit comments