Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def column_plural_assocation_value_from_value(column, value)
- # it's an array of ids
- value = [value] unless value.is_a?(Array)
- if value and not value.empty?
- ids = value.select {|id| id.present?}
- ids.empty? ? [] : column.association.klass.find(ids)
- end
- end
Add Comment
Please, Sign In to add comment