Active Pagination and Active Search

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:

1 Like

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.

ransack is more advanced than kaminari…

Maybe add Pagy gem?

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)

1 Like

I remember that too! The reason it was removed was because it loaded all of the records in memory and did the paging in memory.

I’m not sure why it wasn’t changed to use SQL instead of being totally removed though :man_shrugging:

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”:

1 Like