Hi Paul,

I think in this case you might need to initialise will_paginate
manually. Please try this in your controller:

hobo_index do
  @items = Item.my_item_totals(current_user).paginate :page => params[:page]
end

Warm regards,
Ignacio


El 02/12/13 17:51, Paul Hanson escribió:
> Thank you Ignacio.
> 
> I added you code to my index page as below:
> 
>     page nav here: <%= will_paginate @items, renderer:
>     BootstrapPagination::Rails %> :end here.
> 
> 
> The result displayed like this:
> 
>     page nav here: :end here.
> 
> 
> I changed the default :per_page could to 2 just to test. It does respond
> correctly with the correct number of rows and if I manually specify the
> page, it displays the correct page.
> 
>       def index
>         hobo_index Item.my_item_totals(current_user), per_page: 2
>       end
> 
> 
> my_item_totals as used above returns an ActiveRecord::Relation. It is an
> aggregated total. 
> 
>       def self.my_item_totals(user)
>         if user.winery
>           user.winery.items.totals
>         else
>           totals
>         end
>       end
> 
>       scope :totals, include_parents.select("items.winery_id,
>                             location_id,
>                             category_id, 
>                             tax_status_id,
>                             varietal_id, 
>                             vintage_id, 
>                             max(trx_date) as trx_date,
>                             sum(quantity) as quantity,
>                             sum(items.gallons) as gallons
>                             ").group("items.winery_id, 
>                                       location_id,
>                                       category_id, 
>                                       tax_status_id,
>                                       varietal_id, 
>                                       vintage_id").
>                             having('sum(quantity) <> ?', 0).
>                             by_item_varietal
> 
>     scope :include_parents, includes(:winery, :vintage, :varietal,
>     :category, :tax_status, :location) 
> 
> I hope this sheds some light on the subject. I have been able to verify
> that all works fine with a completely generically hobo generated index.
> So, it seems its something I'm doing with particular implementation of
> this index. My rails gem is: gem 'rails', '3.2.14', and hobo 2.0.1.
> 
> Thanks again for your help.
> 
> Paul
> 
> 
> 
> 
> On Sun, Dec 1, 2013 at 11:23 PM, Ignacio Huerta <[email protected]
> <mailto:[email protected]>> wrote:
> 
>     Hi Paul,
> 
>     By default it should show up when you have more than thirty records.
> 
>     What happens if you manually add this to your index page?
> 
>     <%= will_paginate @collection, renderer: BootstrapPagination::Rails %>
> 
>     (You have to replace @collection with the name of the model, like
>     @events or @projects).
> 
>     Regards,
>     Ignacio
> 
>     El 02/12/13 06:18, Paul escribió:
>     > I'm using Hobo 2.0.1. My index-page(s) all show the table format, but
>     > the page-nav is missing. They are present in the index-page def,
>     but no
>     > nav shows up. I have more rows that the :per_page number. I can
>     manually
>     > put in the ?page parameter in the url and it goes to that page, but
>     > still now page-nav.
>     >
>     > Any idea why?
>     >
>     > Thanks,
>     >  Paul
>     >
>     > --
>     > You received this message because you are subscribed to the Google
>     > Groups "Hobo Users" group.
>     > To unsubscribe from this group and stop receiving emails from it, send
>     > an email to [email protected]
>     <mailto:hobousers%[email protected]>.
>     > To post to this group, send email to [email protected]
>     <mailto:[email protected]>.
>     > Visit this group at http://groups.google.com/group/hobousers.
>     > For more options, visit https://groups.google.com/groups/opt_out.
> 
>     --
>     Ignacio Huerta Arteche
>     http://www.ihuerta.net
>     Teléfono: 0034 645 70 77 35
>     Email realizado con software libre
> 
>     --
>     You received this message because you are subscribed to the Google
>     Groups "Hobo Users" group.
>     To unsubscribe from this group and stop receiving emails from it,
>     send an email to [email protected]
>     <mailto:hobousers%[email protected]>.
>     To post to this group, send email to [email protected]
>     <mailto:[email protected]>.
>     Visit this group at http://groups.google.com/group/hobousers.
>     For more options, visit https://groups.google.com/groups/opt_out.
> 
> 
> 
> 
> -- 
> Paul Hanson
> [email protected] <mailto:[email protected]>
> 
> -- 
> You received this message because you are subscribed to the Google
> Groups "Hobo Users" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/hobousers.
> For more options, visit https://groups.google.com/groups/opt_out.

-- 
Ignacio Huerta Arteche
http://www.ihuerta.net
Teléfono: 0034 645 70 77 35
Email realizado con software libre

-- 
You received this message because you are subscribed to the Google Groups "Hobo 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/hobousers.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to