@@ -9,7 +9,7 @@ module AnnotateModels
9
9
END_MARK = "== Schema Information End"
10
10
PATTERN = /^\r ?\n ?# (?:#{ COMPAT_PREFIX } |#{ COMPAT_PREFIX_MD } ).*?\r ?\n (#.*\r ?\n )*(\r ?\n )*/
11
11
12
- MATCHED_TYPES = %w( test fixture factory serializer scaffold controller helper )
12
+ MATCHED_TYPES = %w( test fixture factory serializer scaffold controller admin helper )
13
13
14
14
# File.join for windows reverse bar compat?
15
15
# I dont use windows, can`t test
@@ -49,6 +49,9 @@ module AnnotateModels
49
49
# Controller files
50
50
CONTROLLER_DIR = File . join ( "app" , "controllers" )
51
51
52
+ # Active admin registry files
53
+ ACTIVEADMIN_DIR = File . join ( "app" , "admin" )
54
+
52
55
# Helper files
53
56
HELPER_DIR = File . join ( "app" , "helpers" )
54
57
@@ -121,6 +124,10 @@ def get_patterns(pattern_types=MATCHED_TYPES)
121
124
[
122
125
File . join ( root_directory , CONTROLLER_DIR , "%PLURALIZED_MODEL_NAME%_controller.rb" )
123
126
]
127
+ when 'admin'
128
+ [
129
+ File . join ( root_directory , ACTIVEADMIN_DIR , "%MODEL_NAME%.rb" )
130
+ ]
124
131
when 'helper'
125
132
[
126
133
File . join ( root_directory , HELPER_DIR , "%PLURALIZED_MODEL_NAME%_helper.rb" )
@@ -282,7 +289,7 @@ def get_index_info(klass, options={})
282
289
end
283
290
284
291
def hide_limit? ( col_type , options )
285
- excludes =
292
+ excludes =
286
293
if options [ :hide_limit_column_types ] . blank?
287
294
NO_LIMIT_COL_TYPES
288
295
else
@@ -320,7 +327,7 @@ def get_foreign_key_info(klass, options={})
320
327
# a schema info block (a comment starting with "== Schema Information"), check if it
321
328
# matches the block that is already there. If so, leave it be. If not, remove the old
322
329
# info block and write a new one.
323
- #
330
+ #
324
331
# == Returns:
325
332
# true or false depending on whether the file was modified.
326
333
#
@@ -433,7 +440,7 @@ def annotate(klass, file, header, options={})
433
440
unless options [ exclusion_key ]
434
441
self . get_patterns ( key ) .
435
442
map { |f | resolve_filename ( f , model_name , table_name ) } .
436
- each { |f |
443
+ each { |f |
437
444
if annotate_one_file ( f , info , position_key , options_with_position ( options , position_key ) )
438
445
annotated << f
439
446
end
0 commit comments