Sha256: 50a47c44ba7917b66b67d56fe1764901b4730ca7881bbd94cf6f707c06580fe0
Contents?: true
Size: 606 Bytes
Versions: 1
Compression:
Stored size: 606 Bytes
Contents
module Puffer class Fields < Array def field *args push Field.new(*args) 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.19 | lib/puffer/fields.rb |