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.
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: https://rossta.net/blog/using-the-web-push-api-with-vapid.html
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]
How to Build a Gem to Share your Rake Tasks
The ultimate in DRYing your projects. Move all shared rake tasks into a gem. It’s simple and keeps rake tasks you use across multiple projects up to date with your latest and most preferred settings. [more inside]
I'm not testing those stupid views!
Rails views can evolve into a complex mix of HTML and Ruby conditionals. Avoid writing complex tests by keeping views stupid: http://craftingruby.com/posts/2016/10/25/im-not-testing-those-stupid-views.html
How To Make Devise Use Custom Scopes Or Conditions When Querying Users
This article describes setting up a custom scope for Devise login. https://solidfoundationwebdev.com/blog/posts/how-to-make-devise-use-custom-scopes-or-conditions-when-querying-users
Routes & Controllers, the Rails Way
A little bit of discipline goes a long way to keep your routes and controllers simple. Here’s a round up of simple techniques that can have huge impact on keeping things lean: https://medium.com/@jaryl/disciplined-rails-models-controllers-the-rails-way-bbc940822136#.l0ptywqsk
Helpy 1.0 is out today!
Super excited to announce the 1.0 version of Helpy, the new open source Rails based helpdesk and customer support app. Big thanks to everyone who has contributed code and 19 foreign languages. Full list of new stuff at https://helpy.io/blog