Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 2 additions & 13 deletions lib/annotate_rb/model_annotator/model_wrapper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -113,21 +113,10 @@ def max_schema_info_width
end
end

# TODO: Simplify this conditional
def is_column_primary_key?(column_name)
if primary_key
if primary_key.is_a?(Array)
# If the model has multiple primary keys, check if this column is one of them
if primary_key.collect(&:to_sym).include?(column_name.to_sym)
return true
end
elsif column_name.to_sym == primary_key.to_sym
# If model has 1 primary key, check if this column is it
return true
end
end
return false unless primary_key

false
Array(primary_key).map(&:to_sym).include?(column_name.to_sym)
end

def built_attributes
Expand Down
Loading