It’s simple but it’s useful!
To create an alphabet range array in PHP use this code:
1$range_array = range(’A',’Z');
Can anyone post the Ruby equivalent? Specifically alphabet chars.
This might be handy for anyone that’s using the Ruby on Rails will_paginate plugin/gem. It’s a helper that displays the result totals, current viewing range and page range based on an input Will Paginate collection array.
1234567891011def render_pagination_totals(will_paginate_collection=false)
if will_paginate_collection and !will_paginate_collection.total_entries.zero?
if will_paginate_collection.total_entries < (will_paginate_collection.current_page * will_paginate_collection.per_page)
end_of_range = will_paginate_collection.total_entries
else
end_of_range [...]