0.0
No commit activity in last 3 years
No release in over 3 years
Adds each_with_ordinal_number iterator to collections.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

 Project Readme

Ordinalizatron

Simple way to get ordinal numbers for your collections.

Example

Without ordinalizatron:

<% User.paginate(page: 5).each_with_index do |user,index| %>
    <% ordinal = get_the_offset_part_helper + 1 + index %>
    <%= "#{ordinal}. #{user.name} %>
<% end %>

With ordinalizatron:

<% User.paginate(page: 5).each_with_ordinal_number do |user,ordinal_number| %>
    <%= "#{ordinal_number}. #{user.name} %>
<% end %>

Custom offset (still better than adding 1 to index and then offset):

<% User.page(5).each_with_ordinal_number(offset: get_the_offset_part_helper) do |user,ordinal_number| %>
    <%= "#{ordinal_number}. #{user.name} %>
<% end %>

Features

Gives you easy ordinal numbers

Integrates with will_paginate

Doesn't integrate with Kaminari, but you can still use the custom offset method