You’re not receiving notifications from this thread.
how do i display search results
Following on from my prev question regarding implementing search using the geocoder gem [https://gorails.com/forum/how-do-i-implement-search-by-postcode-zipcode-using-the-geocoder-gem]
I have implemented a search feature on the index page. When i enter the postcode
it does not return any results . It gives me a url of http://localhost:3000/locations?utf8=%E2%9C%93&search=m20+2wz but nothing in the index view page.
class LocationsController < ApplicationController
@locations = Location.near(params[:search], 10)
@locations = Location.all.order("created_at DESC")
SubContractor Postcode search
Use this postcode search to quickly find subcontractors in your area
<%= form_tag locations_path, :method => :get do %>
<%= text_field_tag :search, params[:search], placeholder: "e.g M20 2WZ" %>
<%= submit_tag "Search Near", :name => nil %> </p> <% end %>
class Location < ApplicationRecord
[address, city, postcode].compact.join(',')