EagerELK / ditty

Sinatra Based Web Application Framework
MIT License
8 stars 7 forks source link

Add the ability to define searchable fields #1

Closed jrgns closed 7 years ago

jrgns commented 7 years ago

The Component helper currently allows a developer to specify filter fields for a model that allows you to filter list results according to that field. As an example https://ditty.io/products?type=online will only return products where the type field equals online

Extend the Component helper to allow a developer to specify search fields in a controller:

module Ditty
  class Product < Ditty::Component
    SEARCHABLE = [ :description, :name ]
  end
end

Where each specified field will be included in the DB search. In the example above, this URL will search for the term free in the description and name fields: field: https://ditty.io/products?q=free

tegon commented 7 years ago

Hi! Can I tackle this one?

jrgns commented 7 years ago

@tegon Please do!

jrgns commented 7 years ago

@tegon Still keen to do this?

tegon commented 7 years ago

@jrgns I haven't started working on this yet, I have some other tasks to finish before. If you want to do it or give it to someone else, feel free to do it. There's no problem for me.

tegon commented 7 years ago

@jrgns I've implemented this in #4. Please let me know what you think of the solution.

jrgns commented 7 years ago

Thanx @tegon I've added you to the Contributors file.