Sha256: 5f499ab108e89be77dd12276c505073e5c743dfc5eda9a8dd1fac046a0b66d39
Contents?: true
Size: 622 Bytes
Versions: 1
Compression:
Stored size: 622 Bytes
Contents
module Puffer class Fields < Array def field *args, &block push Field.new(*args, &block) last end def searchable @searchable ||= map { |f| f if f.column && [:text, :string, :integer, :decimal, :float].include?(f.column.type) }.compact end def searches query searchable.map { |f| "#{f.query_column} like '%#{query}%'" if f.query_column.present? }.compact.join(' or ') if query end def boolean @boolean ||= reject { |f| f.type != :boolean } end def includes @includes ||= map {|f| f.path unless f.native?}.compact.to_includes end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
puffer-0.0.20 | lib/puffer/fields.rb |