optimize the regex

This commit is contained in:
Anton Sozontov 2013-06-17 17:55:40 +04:00
parent b3794d9ed3
commit 64b8f8e276
1 changed files with 1 additions and 1 deletions

View File

@ -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