I get the exact result I want if I change...
def index
@listings = Listing.all
end
to...
def index
@listings = Listing.where("general_use == 'Industrial'")
end
... in listings_controller.rb
The Listings index view shows a list of all Listings where the general_use field contains the word Industrial. However, I can no longer use the index view to show all listings if I do this.
I want to add a link at the top of my listings index view that narrows the listings down from "all" to just the "industrial" listings.
I don't know what code should go in any, all or none of the following places:
- controllers\listings_controller.rb
- helpers\listings_helpers.rb
- models\listing.rb
- views\listings\index.html.erb
- config\routes.rb
Any help would be greatly appreciated.
Thanks,
Chip