Skip to content

Commit e007765

Browse files
committed
Use NO_DEFAULT_COL_TYPES as default when the hide_default_column_types option is not provided
1 parent dbf19d7 commit e007765

File tree

3 files changed

+21
-3
lines changed

3 files changed

+21
-3
lines changed

.rubocop_todo.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ Metrics/MethodLength:
105105
# Offense count: 2
106106
# Configuration parameters: CountComments.
107107
Metrics/ModuleLength:
108-
Max: 527
108+
Max: 531
109109

110110
# Offense count: 7
111111
Metrics/PerceivedComplexity:

lib/annotate/annotate_models.rb

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -321,9 +321,13 @@ def hide_limit?(col_type, options)
321321
end
322322

323323
def hide_default?(col_type, options)
324-
return false if options[:hide_default_column_types].blank?
324+
excludes =
325+
if options[:hide_default_column_types].blank?
326+
NO_DEFAULT_COL_TYPES
327+
else
328+
options[:hide_default_column_types].split(',')
329+
end
325330

326-
excludes = options[:hide_default_column_types].split(',')
327331
excludes.include?(col_type)
328332
end
329333

spec/annotate/annotate_models_spec.rb

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -305,6 +305,20 @@ def self.when_called_with(options = {})
305305
#
306306
# Table name: users
307307
#
308+
# profile :json not null
309+
# settings :jsonb not null
310+
# parameters :hstore not null
311+
#
312+
EOS
313+
314+
when_called_with hide_default_column_types: 'skip',
315+
with_columns: mocked_columns_without_id,
316+
returns:
317+
<<-EOS.strip_heredoc
318+
# Schema Info
319+
#
320+
# Table name: users
321+
#
308322
# profile :json default({}), not null
309323
# settings :jsonb default({}), not null
310324
# parameters :hstore default({}), not null

0 commit comments

Comments
 (0)