edendevelopment / paginate_alphabetically Goto Github PK
View Code? Open in Web Editor NEWAn easy way to paginate a list of ActiveRecord objects alphabetically by any given attribute.
License: MIT License
An easy way to paginate a list of ActiveRecord objects alphabetically by any given attribute.
License: MIT License
Hi, Im trying to get this running with rails3. i added this to my gem file and ran bundle install.
I then followed the instructions to add the line in the model and the controller as well as the view. But i am coming up with this error.
undefined method `paginate_alphabetically' for #Class:0x00000105a49b78
category.rb
paginate_alphabetically :by => :name
categories_controller.rb
@categories = Category.alphabetical_group(params[:letter])
and in the view i placed just before my table
= alphabetically_paginate(@categories)
Doesn't appear that I've ever pushed this gem before ... @tooky or @sermoa do you have access? Can you add me to the list?
I'm trying to display the pagination still when nothing is found (let's say there are no records with the letter A, I believe it's a bug that the pagination is missing... there is no way to access the ones that do exist)
Example
User 1: Zeus
User 2: jupiter
The list of letters would show up as
Z | J
By changing
def pagination_letters
all.sort_by{|obj| obj.send(@Attribute)}.group_by {|group| group.send(@Attribute)[0].chr.upcase}.keys
end
To
def pagination_letters
all.sort_by{|obj| obj.send(@Attribute).upcase}.group_by {|group| group.send(@Attribute)[0].chr.upcase}.keys
end
It all works
J | Z
Thanks for this tool, by the way!
I put the gem in Gemfile, execute bundle install, but I am still getting this error.
Rubygems.org has 0.2.3 http://rubygems.org/gems/paginate_alphabetically
but 0.3.3 has useful fixes (notably Rails 3 support).
Could you please release it?
When I have a paginated page, I want to have all the letters, not just some of them, but only be able to click on the letters that have items underneath them.
How about a pagination helper? :)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.