How do I create a link to a list of records where field X contains Y in Ruby on Rails? -


If I change I get exact results ...

  def index @ Listing = listing all ended  

to ...

DIF index @ listing = listings. Where ("normal_use == 'industrial'") end

... listings_controller.rb

Listing index view shows a list of all the lists where the normal_ues in the field The word word is industrial though, I can not use the index view to show all listings now if I do this.

I want to add a link at the top of my listing index view which leads the listing down from "all" to just "industrial" listings.

I do not know which code should go to any, all or any of the following places:

  • Controller \ listings_controller.rb
  • Assistant \ listings_helpers.rb
  • Model \ listing.rb
  • Scenes \ listings \ index.html.erb
  • config \ routes RB

Any help would be appreciated.

Thanks,

chip

  DIF index if parameter [: Use] @ listing = listing.fund (: all,: conditions = & gt; {: general_use = & gt; parameters [: usage]}) Other @ listings = listings. All End End  

In your opinion, add a link to Use = industrial and you are all set.


Comments