diff --git a/lib/annotate/annotate_models/file_patterns.rb b/lib/annotate/annotate_models/file_patterns.rb index 262d3e0a2..f6cf3c0e7 100644 --- a/lib/annotate/annotate_models/file_patterns.rb +++ b/lib/annotate/annotate_models/file_patterns.rb @@ -59,7 +59,10 @@ def generate(root_directory, pattern_type, options) when 'controller' [File.join(root_directory, CONTROLLER_DIR, '%PLURALIZED_MODEL_NAME%_controller.rb')] when 'admin' - [File.join(root_directory, ACTIVEADMIN_DIR, '%MODEL_NAME%.rb')] + [ + File.join(root_directory, ACTIVEADMIN_DIR, '%MODEL_NAME%.rb'), + File.join(root_directory, ACTIVEADMIN_DIR, '%PLURALIZED_MODEL_NAME%.rb') + ] when 'helper' [File.join(root_directory, HELPER_DIR, '%PLURALIZED_MODEL_NAME%_helper.rb')] else diff --git a/spec/lib/annotate/annotate_models/file_patterns_spec.rb b/spec/lib/annotate/annotate_models/file_patterns_spec.rb index 9c3138625..eabc1c5da 100644 --- a/spec/lib/annotate/annotate_models/file_patterns_spec.rb +++ b/spec/lib/annotate/annotate_models/file_patterns_spec.rb @@ -119,10 +119,8 @@ context 'when pattern_type is "admin"' do let(:pattern_type) { 'admin' } - it 'returns patterns of admin files' do - is_expected.to eq([ - '/root/app/admin/%MODEL_NAME%.rb' - ]) + it 'returns both singular and pluralized model names' do + is_expected.to eq(['/root/app/admin/%MODEL_NAME%.rb', '/root/app/admin/%PLURALIZED_MODEL_NAME%.rb']) end end