-
Notifications
You must be signed in to change notification settings - Fork 5
Added pagination. #79
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
|
That's awesome, but let's use the kaminari gem instead of will paginate because it's actively maintained. Also please add a some tests (in |
|
Hi, Cezar, I changed the pagination gem to Kaminari, and wrote a Controller test in RSpec, but it's still not passing. Jake |
Gemfile
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this one should probably go in the test group
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed, I added kaminari-rspec to the test group.
I added a paginate_posts_index_spec.rb feature test to the spec/features folder, which seems to be passing, but Kaminari's paginate method seems to be throwing errors across other tests.
I made changes to the Views, and ALL of the Features tests are passing (!!!)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we really need to call .all here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should probably have more than 5 posts on a page (.per(5)). Also you should put the number in a constant.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed. No need to call .all, and I set the number of posts per page to 10, in the config/initializers/kaminari_config.rb file
I made suggested changes, but still need to revise the paginate posts spec file. The tests are all passing, however.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@blog_posts is already set in the controller. You don't need to set it again in the view.
config/routes.rb
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's try to use the new hash syntax key: :value instead of :key => :value
|
Hi, Cezar, |
Hi @chalmagean,
I added pagination via the will_paginate rubygem. Not sure if this is the route you wanted to go, but I guess it does the job.
Jake