Have need to have the index view to be conditionally recreated/refreshed based on user input.
Current model has multiple fields. Index view is being build with the following entry in the controller:
@prospects = Prospect.order(last_name: :asc,first_name: :asc).paginate page: params[:page], per_page: 27
What I would like to be able to do is allow the user to enter input into one or more of the current view fields, ie last_name, county, etc. which would then drive the index to be build with something similar to the following:
@prospects = Prospect.where(params[:last_name]).order(last_name: :asc,first_name: :asc).paginate page: params[:page], per_page: 27
where the parameter/value passed to the where clause is based on a non-blank input field thereby reducing the result set accordingly