i am now closer to figuring out my problem. when calling this... myview.rhtml... call action ''view'' controller myClass... def view getView(params[:category]) end controller application.rb... def getView(category) @pages, @users = paginate_collection something.find_my_data(category), :page => @params[:page] render_to displays/mycustomview end the first page of the view is fine, but when i click on page 2, it says that i have a nil object. i traced back and printed out to the screen ''category'' in the application.rb file, and it turns out it goes NIL after selecting the 2nd page!.... so how can this be fixed? for some reason, this problem only ocurs when i need to pass a variable to my paginate query object. thanks for any help! -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
It looks like you''re relying on params[:category] to persist across pages. That won''t happen. You have to store it in the session hash. Then you can write code like: def view # first visit, user supplies category session[:category] = params[:category] if params[:category] # any visit, refer to session hash to get category value getView(session[:category]) end Hope this solves your problem. koloa-2 wrote:> > > i am now closer to figuring out my problem. > > when calling this... > > myview.rhtml... > call action ''view'' > > controller myClass... > def view > getView(params[:category]) > end > > controller application.rb... > def getView(category) > > @pages, @users = paginate_collection something.find_my_data(category), > :page => @params[:page] > > render_to displays/mycustomview > end > > > the first page of the view is fine, but when i click on page 2, it says > that i have a nil object. i traced back and printed out to the screen > ''category'' in the application.rb file, and it turns out it goes NIL > after selecting the 2nd page!.... so how can this be fixed? for some > reason, this problem only ocurs when i need to pass a variable to my > paginate query object. > > > thanks for any help! > > -- > Posted via http://www.ruby-forum.com/. > > > > >-- View this message in context: http://www.nabble.com/-Rails--paginate-not-working-because-arguments-become-nil-%21-tf2709904.html#a7555560 Sent from the RubyOnRails Users mailing list archive at Nabble.com. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
hi steve, thank you for responding. i will try this when i get home. appreciate the help! Steve Ross wrote:> It looks like you''re relying on params[:category] to persist across > pages. > That won''t happen. You have to store it in the session hash. Then you > can > write code like: > > def view > # first visit, user supplies category > session[:category] = params[:category] if params[:category] > > # any visit, refer to session hash to get category value > getView(session[:category]) > end > > Hope this solves your problem. > > > > koloa-2 wrote: >> def view >> end >> thanks for any help! >> >> -- >> Posted via http://www.ruby-forum.com/. >> >> > >> >> > > -- > View this message in context: > http://www.nabble.com/-Rails--paginate-not-working-because-arguments-become-nil-%21-tf2709904.html#a7555560 > Sent from the RubyOnRails Users mailing list archive at Nabble.com.-- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---