The Ruby and Rails community linklog
Made a library? Written a blog post? Found a useful tutorial? Share it with the Ruby community here or just enjoy what everyone else has found!
Submit a post
Post Preview
Note: Only the first pargraph is shown on the front page and overly long paragraphs may be broken up.
Stub active record relations in tests
If you fight with your slow specs this article can be helpful: https://railsguides.net/stub-active-record-associations/
Better Ruby Gem caching on CircleCI
I’m saving a whopping 2 minutes for every build on CircleCI by using more robust Gem caching. Read Better Ruby Gem caching on CircleCI and so can you.
Advanced Ruby exception handling
How many times have you, while investigating an (admittedly rare ;)) production bug, stumbled upon an exception backtrace that just doesn’t have enough information? For example, an exception gets reraised, destroying the original backtrace with it. So now your logs say that your AI failed to take over the world with AIEpicFailError (great, you already know that), but not why (Timeout::Error while connecting to stackoverflow.com). [more inside]
ApiStruct - API wrapper builder with response serialization
Build on top of dry-monads and http Provides ORM-like behavior of API responses https://github.com/rubygarage/api_struct
How to recycle ideas
Just a couple of ideas about learning new things and using it in existing rails applications to develop more maintainable code.
Four Things About Pry
Last month I wrote a little blogpost about Pry. In it I talk about a few features which I think to be very useful for everyone, mostly newcomers.
RubyMine 2018.3 Released
The new version adds full support for Struct and rails scopes, improves i18n and refactoring features, allows you to work with pull requests right inside the IDE, and adds many other things. [more inside]
Why on earth do Fibers exist?
For a long time, I couldn’t understand what is the purpose of fibers in ruby. I could understand how to use then, but I didn’t understand when or why should I. This blogpost is a result of small research, I’ve do to find my answers.
Database based uniqueness validations for ActiveRecord
Remember the problem with uniqueness validation in ActiveRecord? Yes, it doesn’t guarantee the uniqueness! Check out database_validations gem. You can also read the article on reddit about it. Feel free to contribute!
Consistency between database constraints and ActiveRecord validations
Check out my new gem database_consistency`. You can read my article on reddit for details. Any feedback is very appriciated!
All things Rack
Wetransfer’s Wander, and Red Hat’s Dávid Halász on serving more than 10k connections from a single Ruby process, and smuggling TCP traffic through an HTTP connection, at the Amsterdam Ruby meetup: https://blog.phusion.nl/2018/11/23/all-things-rack-in-amsterdam/
Introducing Modulation - explicit dependency management for Ruby
I’d like to introduce a project I’ve been working on in the last few month, Modulation, a small gem providing an alternative way to manage dependencies in your Ruby applications. For more information, visit the Modulation repository.
AnyCable v0.6.0 released!
Check out the brand new docs website for more: https://docs.anycable.io [more inside]
Mastering data structures in Ruby — AVL Trees.
I just published a new post on the Mastering data structures in Ruby. This time, I show you how to implement AVL trees in Ruby. AVL trees a special kind of self-balancing binary search trees that are great for lookups on large datasets. I hope you enjoy it.
Have you tried Dependabot yet?
I’ve been using Dependabot for a while — it’s like adding a developer to your team. I’m really impressed so I wrote about why.
Building SQL Expressions with Sequel
It’s great to build SQL queries in Ruby. However, it’s not great when you have to drop to raw SQL as soon as you need to write a more complex SQL expression. At Citrusbyte we use Sequel, which has an extensive SQL expression API that allows us to build even the most advanced SQL expressions in Ruby. In this article I talk more about it and compare it with Active Record.
pry-auto_benching.rb
pry-auto_benching.rb is a Pry plugin that automatically benchmarks input entered into Pry, it is also available on RubyGems. Please check it out and let me know what you think.
Include extra information in API responses - Fast JsonAPI Gem part 2.
How to include extra elements, like related links and pagination meta in the server response? [more inside]
What Is MJIT in Ruby 2.6 & How Does It Work?
Did you know that Ruby 2.6 will have a JIT (Just-in-Time Compiler)? In this new article you’ll discover the technical details, how Ruby’s implementation works & how good it’s at getting the job done! https://www.rubyguides.com/2018/11/ruby-mjit/
Outdated browser detection with Browserslist
Detecting outdated browser in one way on both Ruby-backend and Node.js-frontend https://dev.to/amplifr/outdated-browser-detection-with-browserslist-10co
Good News! You No Longer Need to Generate Documentation Manually
We just released a solution we use in our projects regarding automating documentation generation from tests [more inside]
Purify code with data integrity: defaults and not-nulls
How not-null constraint and default values help to write better code https://dev.to/amplifr/purify-code-with-data-integrity-part-1-defaults-and-not-nulls-492p