hopsoft / tag_columns

Fast & simple Rails ActiveRecord model tagging using PostgreSQL's Array datatype
MIT License
52 stars 3 forks source link

Do not raise error when column value is nil #5

Closed coderberry closed 3 years ago

coderberry commented 3 years ago

This fix will resolve issues where a column may not have an established value yet, and therefore cannot save.

coveralls commented 3 years ago

Coverage Status

Coverage remained the same at 12.698% when pulling 7c0f80562da56ee122b09cee6c2d261fe925218a on coderberry:patch-1 into 0180f9dfaee78aae7fe48e609ce73073bd0d960f on hopsoft:master.

hopsoft commented 3 years ago

Did a little digging around this and would prefer to fix in tag_columns_sanitize_list like so:

def tag_columns_sanitize_list(values = [])
  return [] if values.nil?
  values.select(&:present?).map(&:to_s).uniq.sort
end