4 ms·
Please list the good serialisation gems, as I can't find any ;) What if you have a complex/dynamic query, how do you build it? You said yourself that AR works
by adamzapasnik 4y ago
Please list the good serialisation gems, as I can't find any ;)
What if you have a complex/dynamic query, how do you build it? You said yourself that AR works better than concatenating SQL strings, but AR doesn't even support CTEs atm and building complex queries is not trivial and sometimes even possible without just SQL strings...
- rurabe 4y agoBig fan of raw sql, but practically speaking (as it relates to developing with rails) CTEs can be rewritten as subqueries, the advantage being that they are linear instead of nested in SQL. With AR queries you can do the same and make it linear in ruby (and then the computer doesn't really care if your sql is nested) last_three_posts = Post.limit(3).order(created_at: :desc) @posts = Comment.where(post_id: last_three_posts)
- rurabe 4y agoIt's not perfect or painless but I think jsonapi-serializer is pretty good