Re: [Rails] Filter Index Page

2013-01-30 Thread Walter Lee Davis
On Jan 30, 2013, at 6:33 AM, Ryo Saeba wrote: So this is what the method in the controller looks now def index if(params[:q]) render :partial = 'search_results', :locals = @games else render :partial = 'no_search_yet' end end and I removed the one @ in the index

Re: [Rails] Filter Index Page

2013-01-30 Thread Walter Lee Davis
On Jan 30, 2013, at 9:54 AM, Ryo Saeba wrote: in my console it says: Started GET /games?utf8=%E2%9C%93search=megacommit=Search for 127.0.0.1 at 2013-01-30 15:52:18 +0100 Processing by GamesController#index as HTML Parameters: {utf8=V, search=mega, commit=Search} Rendered

Re: [Rails] Filter Index Page

2013-01-30 Thread Walter Lee Davis
On Jan 30, 2013, at 1:01 PM, Ryo Saeba wrote: This is really weird. Having used :q as a name actually opens the no search yet partial, wether I used the search function or not. but using :search in my if clause I get a NameError in my index file. undefined local variable or method

[Rails] Filter Index Page

2013-01-29 Thread Ryo Saeba
Hi, I'm new here and started working with rails only a month ago. I'm trying to develop a VideoGame Database that is supposed to contain many many entries. Here's my problem. Currently any new gameentry is listed in my index-page like this [code] % @games.each do |game| % tr td%=

Re: [Rails] Filter Index Page

2013-01-29 Thread Walter Lee Davis
On Jan 29, 2013, at 10:56 AM, Ryo Saeba wrote: Hi, I'm new here and started working with rails only a month ago. I'm trying to develop a VideoGame Database that is supposed to contain many many entries. Here's my problem. Currently any new gameentry is listed in my index-page like this

Re: [Rails] Filter Index Page

2013-01-29 Thread Walter Lee Davis
Okay, then you should set that up in your index method. Decide what you do want to show (maybe a partial with How to Search instructions) and show that instead of ModelName.all. def index if(params[:q]) #do your search thing else render :partial = 'search/instructions' end end