I know it’s simple but why does the rails scaffold not include pagination and some basic sql search like ransack? Ransack and Kaminari are usually the first thing I have to add to every view unless I plan to go fancy.
Even deeper, why don’t we have active_pagination and active_search (excluding non sql search here) yet? I mean, we even have actiontext! This would also provide a clear standard for our JS Frameworks to interact with rails api’s (looking at jbuilder with JSON:API).
Looking at the ruby toolbox, the differences in downloads are not that massive:
I remember when I started using rails (1.x), it used to have pagination builtin. I don’t remember why it was removed, but I think it was mostly because it was really slow. I guess we’re going full circle now.
But rails new can always provide some default gems…
Advanced devs can cleanup and adjust generators to their own set of gems
Maybe idea of interactive generator would be great fit for that (from different thread in mat wtfs)
Ransack is a very powerful gem, but its form API has always felt a little odd to me. It’s essentially its own query language, but you write it inside the view. In its current form, I’m not sure that it would fit as a default gem. I do agree it would be nice to have some additional out-of-the-box help, though.
I have experimented with creating an alternative that uses Rails’ stock form builder and Active Record directly. I welcome feedback on its design and how it could be more “Railsy”:
@jonathanhefner thank you for the great open-source contribution. I think you have a lot of great ideas in your project. I’d love to find a way to combine forces and tackle the problem together. I agree with you about ransack API being weird.
I’ve built an implementation for my work on top of ransack, but try to abstract it away so it can later be replaced by another API. The brilliance of ransack is the predicates and how easy it is to add them. The downfall is a flat key structure and weird custom ransacker API I always have to lookup to figure out how to use.
My first step on the latest iteration was infact to define a clear data-structure that can support all these configurations. I wanted it to be simple enough to be transformed into JSON and serve as a starting point for offline/client-side search as well.