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.
String#concat, Array#concat and String#prepend take multiple arguments in Ruby 2.4
Ruby 2.4 now allows concat and prepend methods to take multiple arguments. [more inside]
Using LetsEncrypt SSL with Sinatra on Heroku
This is a short and straightforward tutorial showing how to use Sinatra on Heroku with an auto-renewing SSL certificate from LetsEncrypt. [more inside]
Sandi Metz is on this week's episode of The Changelog
I think you’ll enjoy listening to this.
[Screencast] Rails API - Throttling with Rack::Attack
Save expensive calculation time using Rack::Attack, we will learn how to limit requests coming into our application. This gem not only limits requests, but can be used to blacklist or whitelist users as well. https://www.driftingruby.com/episodes/rails-api-throttling-with-rack-attack
Stubbing External APIs with WebMock
I’ve been testing code that uses third-party APIs for almost as long as I’ve been writing Ruby, but it wasn’t until recently that some particularly heavy integration requirements got me thinking about the right way to go about it. In this post, I describe the approach that I’ve been using to write fast, manageable tests for distributed systems using WebMock.
Better File Uploads with Shrine: Processing
This is the 4th article in the series of posts about the Shrine file attachment library. In this post I talk about various ways in which you can do file processing with Shrine, including manual processing, external processing, and processing on-the-fly. Read all about it here.
Version Compatibility Test
How many times have you run into version compatibility issues that takes up a majority of your troubleshooting time? Wouldn’t it be nice if we could come up with a specification? Who reads the details buried in the readme files? Even if you diligently did read it, is it possible to juggle all those compatible version numbers for different version of the library/framework in your head while troubleshooting? Wouldn’t it be nice to make it a executable script? Read Version Compatibility Test to find out how you can cut down time spent in troubleshooting.
Decorator Pattern in Ruby
Decorators allow us to add behavior to objects without affecting other objects of the same class. The decor… Read More
Continuous Integration and Deployment for Ruby projects with Bitbucket Pipelines
Bitbucket Pipelines has been released recently and i will show how you can use it for a Rails project in this blog post.
Row Fragmentation for Better Locking Performance
This blog post discusses a strategy for distributing a single resource’s lock among many rows to improve locking performance in a database like Postgres (with a few code examples in Ruby).
ActiveJob Basics in Rails 5
Checkout the latest episode covering ActiveJob basics in Rails 5
Using the Push API with VAPID in Ruby
You can now use the Push API in Chrome and Firefox with “voluntary application server identification” (VAPID); in other words, you don’t need to register any app credentials with individual push servers to use this new browser protocol. This post demonstrates the “how to” with the webpush Ruby gem:
Natural Language Generation in Ruby (with JRuby + SimpleNLG)
I wanted to write full English sentences from data structures without doing the naive string manipulation routing. So I ended up creating 2 open source projects to help out anyone who may need Natural Language Generation (NLG). Check my blog post about this endeavor.
Five ways to write a flaky test
I’ve spent many hours identifying and fixing flaky tests in a 50k tests suite. [more inside]
State Change through Forms and Cleaning up Layouts
In the first free episode we show you how to trigger a state change (state machine) via your form. The second free episode shows you how to keep your layouts clean using content_for and yield. [more inside]
Building a Photo Gallery that automatically tags images
As a follow-up to our comparison of different image-tagging APIs, in this tutorial we’re building a simple application that automatically tags uploaded images using Clarifai, one of the compared API providers.
Debugging With Byebug
Every now and then, we face a nasty, complicated bug. When simple debugging isn’t enough, it’s time to bring out the big guns: a debugger.
Enforcing unique jobs in Karafka and Sidekiq for single resources
When working with multi threaded and multi process systems that consume messages in parallel, you need to be able to enforce some limitations on the processing order. This is especially important, when you process data related to same elements. In this article, I describe some of the solutions suitable for both Karafka and Sidekiq.
Know Ruby: private_constant
Constants are a part of your public interface. They can be an efficient way to share static values. But what if you don’t want to share? Some constants, like some methods, are intended for internal use only. Read More
Validation outside ActiveModel
You can validate data saved in hash directly, read more about it: Validation outside ActiveModel
Profile picture (or any file) uploading with Grape + Trailblazer + CarrierWare
This article is about how to implement pictures (or any other file) upload with the Grape + Trailblazer + CarrierWave stack. The first value of the stack (Grape) can be changed for anything else (Hanami, Sinatra, Rails API, etc) — it doesn’t matter. From the endpoint to the specs.
Monitoring Sidekiq Using AWS Lambda and Slack
I wrote a new article on Monitoring Sidekiq Using AWS Lambda and Slack. Hope you enjoy!
Simple Timezone Offset abstraction
New small no-dependencies gem tz_offset incapsulates “timezone offset value”. Now you can do things TZOffset.parse('+5:45').now or TZOffset.parse('CEST').parse('12:30').localtime.
HexaPDF Code and First Version Released
As of today the HexaPDF source code is available on Github and the first version has been released. See the blog post for more information.
HerokuOps Gem
I’ve moved many of my standard Heroku application, pipeline and deploy tasks into a gem. Consider this an MVP; it’s rough around the edges, but gets the job done like a champ. [more inside]