Sha256: ccb4dd6ff727fe0e73ffbe9e20e837b41b04c477ad41d3422aa54595a1c1f096

Contents?: true

Size: 484 Bytes

Versions: 7

Compression:

Stored size: 484 Bytes

Contents

class Forest::User
  include ForestLiana::Collection

  collection :User

  filter_cap_name = lambda do |condition, where|
    capitalize_name = condition['value'].capitalize
    "name IS '#{capitalize_name}'"
  end

  search_cap_name = lambda do |query, search|
    # Injects your new filter into the query.
    query.or(User.where("name = '#{search}'"))
  end

  field :cap_name, type: 'String', filter: filter_cap_name, search: search_cap_name do
    object.name.upcase
  end

end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
forest_liana-9.7.0 spec/dummy/lib/forest_liana/collections/user.rb
forest_liana-9.6.4 spec/dummy/lib/forest_liana/collections/user.rb
forest_liana-9.6.3 spec/dummy/lib/forest_liana/collections/user.rb
forest_liana-9.6.0 spec/dummy/lib/forest_liana/collections/user.rb
forest_liana-9.5.7 spec/dummy/lib/forest_liana/collections/user.rb
forest_liana-9.5.6 spec/dummy/lib/forest_liana/collections/user.rb
forest_liana-9.5.5 spec/dummy/lib/forest_liana/collections/user.rb