optimize the regex
This commit is contained in:
parent
b3794d9ed3
commit
64b8f8e276
|
@ -450,7 +450,7 @@ module SimpleForm
|
|||
def lookup_model_names #:nodoc:
|
||||
@lookup_model_names ||= begin
|
||||
child_index = options[:child_index]
|
||||
names = object_name.to_s.scan(/(?!\d+)(\w+)/).flatten
|
||||
names = object_name.to_s.scan(/(?!\d)\w+/).flatten
|
||||
names.delete(child_index) if child_index
|
||||
names.each { |name| name.gsub!('_attributes', '') }
|
||||
names.freeze
|
||||
|
|
Loading…
Reference in New Issue