Guest User

Untitled

a guest
Dec 13th, 2018
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.26 KB | None | 0 0
  1. def column_plural_assocation_value_from_value(column, value)
  2. # it's an array of ids
  3. value = [value] unless value.is_a?(Array)
  4. if value and not value.empty?
  5. ids = value.select {|id| id.present?}
  6. ids.empty? ? [] : column.association.klass.find(ids)
  7. end
  8. end
Add Comment
Please, Sign In to add comment