Hi all,
I am currently trying to get a bunch of links to to display all the related console records upon button click so e.g. If a user clicks on the Dreamcast link then I would like it to display all records that have Dreamcast stored as their console.
I have the following example code in my index class:
<%= link_to 'DREAMCAST', games_path(:console => 'Dreamcast')%>
the above code is repeating for each individual console.
Now in my gamescontroller I have the following in my index:
def index @games = Game.paginate(:per_page => 4, :page => params[:page]).search(params[:search]) @games = @games.find_by_console(params[:console]) unless params[:console].blank? end
The problem I receive is that when I click on the Gaming section of my website I receive the following error message which I assume is to say activerecord is not connecting:
undefined method `find_by_console' for #<WillPaginate::Collection:0x52cb9d8>
How would I go about solving this problem I have come across?