DEV Community

Discussion on: Dynamically filter data via URL params with Rack::Reducer

Collapse
 
chrisfrank profile image
chrisfrank

I've been working mostly in Roda and Sinatra this year and less in Rails. One of the things I've missed from Rails is Platformatec's HasScope gem, which solves this filtering problem well. So I set out to write a library that would work in any Rack app.

Turns out I like Rack::Reducer's API better than HasScope's, even in Rails. That's not meant as a dig at HasScope—Reducer relies on features of ruby 2.1+, which didn't exist when HasScope was written.

Collapse
 
dmerand profile image
Donald Merand

Interesting - I hadn't seen Roda before, but I'm guessing that you're trending away from "batteries included" frameworks :-)

Do you find yourself using Sinatra and/or Roda on bigger projects? Are you doing a lot of ORM in those environments?

Thread Thread
 
chrisfrank profile image
chrisfrank

I like Sinatra for tiny projects, and I really love Roda (with Sequel as an ORM) for large ones.

Roda’s concept of a “routing tree” is very similar, structurally, to the way react-router manages client-side routing. So when I build an API in Roda and a UI in React, I can reason about them the same way, despite their being in different languages. In general, I think I value structural similarity more than syntactical similarity — which is part of why I still build APIs in ruby/roda, instead of js/express.

Thread Thread
 
dmerand profile image
Donald Merand

This is all very cool! I might try a project using Roda+Sequel, just to get a feel for some Rails ORM alternatives. I use Sinatra quite a bit, but tend to kick over to Rails if I need heavy DB work.

I like your point about structural similarity - I think this same logic is why folks are loving the Elixir/Phoenix + Elm backend/frontend combination. I'm headed in that direction for my larger projects (though I still love Ruby).