How do I add addition parameters to the URL for the paginator.helper? From what I get from the docs, I''m supposed to put a hash in there but its not working. The links show up, but only to the next page, which comes up blank cause the searchwords parameter isn''t getting passed on. But it works if I add the "&searchwords=love" for instance. I hope I am explaining this ok! it sounds pretty convuluted as I read it! heres my view: <%= @nasb_pager.basic_html(self,2,false,{"searchwords" => @searchwords}) %> i tried putting "params=" and about a gazillin other things, im going nutz! and the relevent controller: def searchresults searchwords = @params[''searchwords''] @nasb_pager = Paginator.new self,Nasb.find_all(["MATCH (text) AGAINST(?)",searchwords]).length,30, @params[''page'']
On Tue, 22 Mar 2005 00:59:35 -0500, Todd Yarling <toddyarling-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> heres my view: > <%= @nasb_pager.basic_html(self,2,false,{"searchwords" => @searchwords}) %>Here you are referencing the variable "@searchwords", which is an instance variable.> and the relevent controller: > def searchresults > searchwords = @params[''searchwords''] > @nasb_pager = Paginator.new self,Nasb.find_all(["MATCH (text) > AGAINST(?)",searchwords]).length,30, @params[''page'']Here you are setting the variable "searchwords", which is a local variable, and is completely separate and unrelated to @searchwords. What I would suggest is to get rid of both of those variables and use @params[''searchwords''] directly. In your view: <%= @nasb_pager.basic_html(self,2,false,{"searchwords" => @params[''searchwords'']}) %> In your controller: def searchresults @nasb_pager = Paginator.new( self, Nasb.count( [ "MATCH (text) AGAINST(?)", @params[''searchwords''] ] ), 30, @params[''page''] ) @nasb = Nasb.find_all nil, nil, @person_pages.current.to_sql end Keep in mind this is untested, but this is based on actual paginator code from my rails app, and stuff I got straight from the docs, so it should work with minimal modifications. -- One Guy With A Camera http://rbpark.ath.cx
With a few changes, somehow, that works, tho I swear I tried calling it with @params[] thanks! BTW didn''t mean to double post, but my posts don''t show up in my client for some reason On Tuesday 22 March 2005 02:16 am, Rob Park wrote:> On Tue, 22 Mar 2005 00:59:35 -0500, Todd Yarling <toddyarling-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>wrote:> > heres my view: > > <%= @nasb_pager.basic_html(self,2,false,{"searchwords" => @searchwords}) > > %> > > Here you are referencing the variable "@searchwords", which is an > instance variable. > > > and the relevent controller: > > def searchresults > > searchwords = @params[''searchwords''] > > @nasb_pager = Paginator.new self,Nasb.find_all(["MATCH > > (text) AGAINST(?)",searchwords]).length,30, @params[''page''] > > Here you are setting the variable "searchwords", which is a local > variable, and is completely separate and unrelated to @searchwords. > What I would suggest is to get rid of both of those variables and use > @params[''searchwords''] directly. > > In your view: > > <%= @nasb_pager.basic_html(self,2,false,{"searchwords" => > @params[''searchwords'']}) %> > > In your controller: > > def searchresults > @nasb_pager = Paginator.new( > self, > Nasb.count( [ "MATCH (text) AGAINST(?)", @params[''searchwords''] ] ), > 30, > @params[''page''] > ) > @nasb = Nasb.find_all nil, nil, @person_pages.current.to_sql > end > > Keep in mind this is untested, but this is based on actual paginator > code from my rails app, and stuff I got straight from the docs, so it > should work with minimal modifications.