I’d like to extract the common navigation so it can be used on the articles and tags page without defining them redundantly, but I haven’t found a way to reference the pagination methods in a partial.
Any pointers?
I’d like to extract the common navigation so it can be used on the articles and tags page without defining them redundantly, but I haven’t found a way to reference the pagination methods in a partial.
Any pointers?
For those who read this later in hope of a solution, I got around this by introducing an intermediary helper.
def paging_nav(num_pages, page_number, prev_page, next_page)
partial "paging_nav",
locals: {num_pages: num_pages, prev_page: prev_page, next_page: next_page, page_number: page_number}
end
Goofy, but it works.
- paginate = current_page.metadata[:locals]["paginate"]
- num_pages = current_page.metadata[:locals]["num_pages"]
- page_number = current_page.metadata[:locals]["page_number"]
- prev_page = current_page.metadata[:locals]["prev_page"]
- next_page = current_page.metadata[:locals]["next_page"]
Add this above your pagination code in the partial.