We will implement a filter system so companies can search for the masseur they need more easily.
How
[ ] Run $gem install pg_search
[x] Add gem ‘pg_search’ to the Gemfile
[x] Include pg_search in the MasseurProfile model (after the relationships):
include PgSearch
pg_search_scope :search, against: [:working_place, :pricing, :massage_types]
[x] Add search to the routes.rb file, so we’ll have access to the search routes: resources :search, only: [:index]
[x] Add a search filter form in the view masseurs/index.rb with the 3 parameters : City, Massage_type. The form will be with dropdowns, checkboxes and a submit button.
[x] Complete the def index method in the masseurs_profile controller in order to display the masseurs on the basis of the data retrieved from the filter form:
def index
if params[:query].present?
@masseur_profile = MasseurProfile.search(params[:query])
else
@masseur_profile = MasseurProfile.all
end
end
Must Have
[x] A filter form above or next to the masseurs panel allowing to display the masseurs depending on their city, massage_types.
Why
We will implement a filter system so companies can search for the masseur they need more easily.
How
[ ] Run
$gem install pg_search
[x] Add
gem ‘pg_search’
to the Gemfile[x] Include pg_search in the MasseurProfile model (after the relationships):
[x] Add search to the
routes.rb
file, so we’ll have access to the search routes:resources :search, only: [:index]
[x] Add a search filter form in the view masseurs/index.rb with the 3 parameters : City, Massage_type. The form will be with dropdowns, checkboxes and a submit button.
[x] Complete the
def index
method in the masseurs_profile controller in order to display the masseurs on the basis of the data retrieved from the filter form:Must Have
Reading List
Notes
pg_search_scope
Massage_type_search_by_massage_type("Suédois") -> la liste des masseur_profile qui pratiquent le message suédois
Imprimer le masseur_profile.first_name, last_name price & address
Searching against multiple columns