@@ -383,25 +383,25 @@ def assert_valid_enum_options(options)
383
383
384
384
ENUM_CONFLICT_MESSAGE = \
385
385
"You tried to define an enum named \" %{enum}\" on the model \" %{klass}\" , but " \
386
- "this will generate a %{type} method \" %{method}\" , which is already defined " \
386
+ "this will generate %{type} method \" %{method}\" , which is already defined " \
387
387
"by %{source}."
388
388
private_constant :ENUM_CONFLICT_MESSAGE
389
389
390
390
def detect_enum_conflict! ( enum_name , method_name , klass_method = false )
391
391
if klass_method && dangerous_class_method? ( method_name )
392
- raise_conflict_error ( enum_name , method_name , type : " class")
392
+ raise_conflict_error ( enum_name , method_name , "a class")
393
393
elsif klass_method && method_defined_within? ( method_name , Relation )
394
- raise_conflict_error ( enum_name , method_name , type : " class", source : Relation . name )
394
+ raise_conflict_error ( enum_name , method_name , "a class", source : Relation . name )
395
395
elsif klass_method && method_name . to_sym == :id
396
- raise_conflict_error ( enum_name , method_name )
396
+ raise_conflict_error ( enum_name , method_name , "an instance" )
397
397
elsif !klass_method && dangerous_attribute_method? ( method_name )
398
- raise_conflict_error ( enum_name , method_name )
398
+ raise_conflict_error ( enum_name , method_name , "an instance" )
399
399
elsif !klass_method && method_defined_within? ( method_name , _enum_methods_module , Module )
400
- raise_conflict_error ( enum_name , method_name , source : "another enum" )
400
+ raise_conflict_error ( enum_name , method_name , "an instance" , source : "another enum" )
401
401
end
402
402
end
403
403
404
- def raise_conflict_error ( enum_name , method_name , type : "instance" , source : "Active Record" )
404
+ def raise_conflict_error ( enum_name , method_name , type , source : "Active Record" )
405
405
raise ArgumentError , ENUM_CONFLICT_MESSAGE % {
406
406
enum : enum_name ,
407
407
klass : name ,
0 commit comments