There's an issue with the default index-page tag; it automatically includes pagination nav, which breaks if you feed it a plain Array.
For a quick fix, add: <top-page-nav: replace /> <bottom-page-nav: replace /> In your index.dryml page if you're using an array rather than a scope. --Matt Jones On Aug 24, 2009, at 12:19 PM, Brett Nelson wrote: > > If I do an @models = Model.find(:all) in the controller I get: > > undefined method `total_pages' for #<Array:0x8c752ec> > > In the page refresh so I was using the find_or_paginate method > instead. Am doing this with latest git hobo. > > Brett > > > On Aug 24, 8:59 am, Matt Jones <[email protected]> wrote: >> On Aug 24, 2009, at 11:40 AM, MichelV69 wrote: >> >> >> >> >> >>> On Aug 24, 11:31 am, Matt Jones <[email protected]> wrote: >>>> Why are you calling find_instance? You don't appear to use the >>>> result, >>>> and it's not going to work for an index action anyways (it >>>> essentially >>>> calls Cdr.find(params[:id]) in this case, which will clearly fail). >> >>>> The "page not found" is the result of Rails catching the >>>> RecordNotFound exception and displaying a 404 error page. >> >>>> --Matt Jones >> >>> Hi, Matt. I'm doing it, because I inferred from the Agility >>> tutorial that I had to. If I don't do that, I just get a blank >>> page; >>> nothing renders at all. Not even the menus. >> >>> Thank-you for explaining what the error means. Can you point me in >>> the right direction of what I -should- be doing to replace the index >>> page for a given MVC trio? I'm sure I won't be the only new comer >>> trying to do this as part of a project. >> >> The issue you had with the blank pages comes from the polymorphic >> default page tags - if there's no object(s) in 'this', Hobo renders >> the default (which is empty). >> >> I'd recommend you do this in the controller: >> >> def index >> @first_day_billing = Time.now.at_beginning_of_month >> @last_day_billing = Time.now >> @cdrs = Cdr.find(:all, :conditions => ['date >= ? AND date <= ?', >> @first_day_billing, @last_day_billing], :order => 'unique_stamp') >> end >> >> (pulling the find call into the model - say a method >> this_month_so_far >> - is up to you. If 'date' had a more descriptive name like billed_on, >> you could also use Hobo's automatic scopes to say things like >> Cdr.billed_before(Time.now), etc) >> >> Note that the DRYML view code will automatically pick up the instance >> variable with the pluralized model name and put it into 'this', so >> the >> view can be the same. I'd also suggest that, unless the code in >> invoice-page is going to be reused, it's probably better to just do >> it >> inline. It avoids the problem that plain Rails sometimes gets into, >> where a page is shattered into a million little partials. >> >> --Matt Jones > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Hobo Users" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/hobousers?hl=en -~----------~----~----~----~------~----~------~--~---
