num_pages not available in render block #284

Closed
niedfelj opened this Issue Sep 12, 2012 · 5 comments

Comments

Projects
None yet
3 participants
@niedfelj

It seems like there are some backwards compatibility changes with the num_pages alias in 0.14, where I'm getting an error in the paginator.render do block:

17:58:42 web.1  | ActionView::Template::Error (undefined local variable or method `num_pages' for #<Kaminari::Helpers::Paginator:0x007f86fdfefc78>):
17:58:42 web.1  |     7:     paginator:     the paginator that renders the pagination tags inside
17:58:42 web.1  |     8: -%>
17:58:42 web.1  |     9: <%= paginator.render do -%>
17:58:42 web.1  |     10:   <nav class="pagination">
17:58:42 web.1  |     11:   <% if num_pages > 0 -%>
17:58:42 web.1  |     12:     <ul>
17:58:42 web.1  |     13:       <%= first_page_tag unless current_page.first? %>
@yuki24

This comment has been minimized.

Show comment Hide comment
@yuki24

yuki24 Sep 13, 2012

Owner

num_pages has been renamed to total_pages so just change it to total_pages.

Owner

yuki24 commented Sep 13, 2012

num_pages has been renamed to total_pages so just change it to total_pages.

@yuki24 yuki24 closed this Sep 13, 2012

@niedfelj

This comment has been minimized.

Show comment Hide comment
@niedfelj

niedfelj Sep 13, 2012

it's supposed to be "deprecated" not removed. a lot of 3rd party views require this.

it's supposed to be "deprecated" not removed. a lot of 3rd party views require this.

@yuki24

This comment has been minimized.

Show comment Hide comment
@yuki24

yuki24 Sep 14, 2012

Owner

You are right, but we also denine(more specifically, alias) num_pages for backwards compatibility.
However, in render.do block, @options including :total_pages => ... will be passed to render :partial as locals in here and basically @options doesn't include :num_pages key. this is why num_pages raises such an error. I'll re-open this issue and send a fix for this soon.

Owner

yuki24 commented Sep 14, 2012

You are right, but we also denine(more specifically, alias) num_pages for backwards compatibility.
However, in render.do block, @options including :total_pages => ... will be passed to render :partial as locals in here and basically @options doesn't include :num_pages key. this is why num_pages raises such an error. I'll re-open this issue and send a fix for this soon.

@yuki24 yuki24 reopened this Sep 14, 2012

This was referenced Sep 15, 2012

@eitoball

This comment has been minimized.

Show comment Hide comment
@eitoball

eitoball Sep 15, 2012

Contributor

@yuki24, I am sorry for stealing this issue from you...

Contributor

eitoball commented Sep 15, 2012

@yuki24, I am sorry for stealing this issue from you...

@yuki24

This comment has been minimized.

Show comment Hide comment
@yuki24

yuki24 Sep 15, 2012

Owner

@eitoball thanks!

Owner

yuki24 commented Sep 15, 2012

@eitoball thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment