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.
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
Ruby Facets #4
In this new episode of Ruby Facets, we talk about Ruby Together and RubyGems.org, Concerning Concerns, Procodile, and Swift. All in six lovely little minutes.
[Screencast] Rails API - Authentication with JWT
Using the knock gem, we will add JWT Authentication to our Rails API Application. https://www.driftingruby.com/episodes/rails-api-authentication-with-jwt
How to add database constraint validation for table
It is not a secret, that even having validations in Ruby on Rails application models through checking the uniqueness, two separate, but identical objects, can be saved to the database. This happens in services within subsequently full of users, which can simultaneously connect to the common database and write two similar records at the same time. To avoid such coincidences and to provide yourself with this kind of errors, I decided to look for methods at ruby gems communities. http://blog.active-bridge.com/how-to-add-database-constraint-validation-for-table
How to create a Ruby Gem
RubyGems or “gem” is a package manager for the Ruby programming language that provides a standard format for distributing Ruby programs and libraries. It is easy to manage and install to your system and it can be used by various rails applications. Just Checkout how to create a new gem and how to publish it.
Some Ruby Tricks to Make Your Life Easier
I give a brief rundown on where and how I run into problems that need solving as well as a few tricks and cool things you can do with Ruby to figure out what’s going on. [more inside]
Git basic tutorial and Github printable cheatsheet, workflow and markdown cheats
Git basic tutorial and Github printable cheatsheet, workflow and markdown cheats. http://www.techoalien.com/2015/07/git-basic-tutorial-and-github-printable.html