def summary @most_recent_fails = Run.find(:all, :order => ''id DESC'') @fails_pages, @most_recent_fails = paginate :most_recent_fails, :per_page => 2, :conditions => [''run_id=?'', @run.id] end Brings up the following error: Called id for nil, which would mistakenly be 4 -- if you really wanted the id of nil, use object_id Any ideas why? -- 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 -~----------~----~----~----~------~----~------~--~---
Paul Nichols wrote:> def summary > @most_recent_fails = Run.find(:all, :order => ''id DESC'') > @fails_pages, @most_recent_fails = paginate :most_recent_fails, > :per_page => 2, :conditions => [''run_id=?'', @run.id] > end > > Brings up the following error: > > Called id for nil, which would mistakenly be 4 -- if you really wanted > the id of nil, use object_id > > Any ideas why?How and where do you set up @run (for use in @run.id)? Roberto Gattinoni. -- 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 -~----------~----~----~----~------~----~------~--~---
Roberto Gattinoni wrote:> Paul Nichols wrote: >> def summary >> @most_recent_fails = Run.find(:all, :order => ''id DESC'') >> @fails_pages, @most_recent_fails = paginate :most_recent_fails, >> :per_page => 2, :conditions => [''run_id=?'', @run.id] >> end >> >> Brings up the following error: >> >> Called id for nil, which would mistakenly be 4 -- if you really wanted >> the id of nil, use object_id >> >> Any ideas why? > > How and where do you set up @run (for use in @run.id)? > > Roberto Gattinoni.Ahh, i haven''t. I guess it should be changed to @most_recent_fails? -- 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 -~----------~----~----~----~------~----~------~--~---
Paul Nichols wrote:> def summary > @most_recent_fails = Run.find(:all, :order => ''id DESC'') > @fails_pages, @most_recent_fails = paginate :most_recent_fails, > :per_page => 2, :conditions => [''run_id=?'', @run.id] > endNotice there''s a will_paginate plugin which seems to be the preferred way to do pagination these days. -- Cheers, - Jacob Atzen --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Paul Nichols wrote:> Roberto Gattinoni wrote: >> Paul Nichols wrote: >>> def summary >>> @most_recent_fails = Run.find(:all, :order => ''id DESC'') >>> @fails_pages, @most_recent_fails = paginate :most_recent_fails, >>> :per_page => 2, :conditions => [''run_id=?'', @run.id] >>> end >>> >>> Brings up the following error: >>> >>> Called id for nil, which would mistakenly be 4 -- if you really wanted >>> the id of nil, use object_id >>> >>> Any ideas why? >> >> How and where do you set up @run (for use in @run.id)? >> >> Roberto Gattinoni. > > Ahh, i haven''t. > > I guess it should be changed to @most_recent_fails?@most_recent_fails is a collection (result of your Run.find) Why do you put a condition in the paginate plugin and not in the Run.find? After all if I understand correctly you are trying to filter the Run model, so why don''t you do that before paginating? You should explain where does @run.id come from (a previous form, a user selection, ...). Roberto Gattinoni. -- 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 -~----------~----~----~----~------~----~------~--~---
refer to the following post for more information about paginating result sets: http://tinyurl.com/35m7e7 Mike On 7/12/07, Roberto Gattinoni <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > Paul Nichols wrote: > > Roberto Gattinoni wrote: > >> Paul Nichols wrote: > >>> def summary > >>> @most_recent_fails = Run.find(:all, :order => ''id DESC'') > >>> @fails_pages, @most_recent_fails = paginate :most_recent_fails, > >>> :per_page => 2, :conditions => [''run_id=?'', @run.id] > >>> end > >>> > >>> Brings up the following error: > >>> > >>> Called id for nil, which would mistakenly be 4 -- if you really wanted > >>> the id of nil, use object_id > >>> > >>> Any ideas why? > >> > >> How and where do you set up @run (for use in @run.id)? > >> > >> Roberto Gattinoni. > > > > Ahh, i haven''t. > > > > I guess it should be changed to @most_recent_fails? > > @most_recent_fails is a collection (result of your Run.find) > > Why do you put a condition in the paginate plugin and not in the > Run.find? After all if I understand correctly you are trying to filter > the Run model, so why don''t you do that before paginating? You should > explain where does @run.id come from (a previous form, a user selection, > ...). > > > Roberto Gattinoni. > > -- > 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 -~----------~----~----~----~------~----~------~--~---
Paul Nichols wrote:> :per_page => 2, :conditions => [''run_id=?'', @run.id]> Called id for nil, which would mistakenly be 4 -- if you really wanted > the id of nil, use object_idThat''s the standard "whiny" error message you get when you call nil.id. id is a (deprecated) member of Object, and an important member of any ActiveRecord model. So one of your models is nil - probably @run. Tip: better delimiters and linefeeds would have helped you spot the error faster: @fails_pages, @most_recent_fails paginate( :most_recent_fails, :per_page => 2, :conditions => [''run_id=?'', @run.id]) -- Phlip http://www.oreilly.com/catalog/9780596510657/ "Test Driven Ajax (on Rails)" assert_xpath, assert_javascript, & assert_ajax --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---