Sha256: 660c9c457383b8793b13b7d5ce08133c5fc40a77eba6a1b9febef5bcca6c4a06

Contents?: true

Size: 353 Bytes

Versions: 1

Compression:

Stored size: 353 Bytes

Contents

module Autocompl
  module Repository
    def get_collection(model, columns, options)
      klass = model.to_s.camelize.constantize
      items = []
      for column in columns
        items.concat(klass.select(column).where("#{column} LIKE ?", "%#{options[:term]}%").limit(options[:limit]).distinct.map(&column))
      end
      items
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
autocompl-0.2.1 lib/autocompl/repository.rb