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.
to_duration - A ruby gem for converting seconds into human readable format
Did you ever need to convert seconds into human readable format? This gem may help you. Check it out!
Emoji - Jekyll Plugin of the Month - Add Thumbs Up (+1), Smileys, Santas n More
Hello, I’ve posted the latest article in the Planet Jekyll Plugin of the Month series that presents a new addon for your (static) web pages every month. Let’s welcome - Emoji - Add Thumbs Up (+1), Smileys, Santas, Snowflakes n More to Your Pages. Happy Publishing (w/ Jekyll). Cheers.
Replacing Sinatra with Rack in Sidekiq
This article is about how Sidekiq replaced their Sinatra powered Web UI with a pure Rack powered one.
A Beginner's Guide to Exceptions in Ruby
The other day I was searching for an introduction to Ruby exceptions written for beginners - people who know basic Ruby syntax but aren’t really sure what an exception is or why it’s useful. I couldn’t find one, so I decided to have a go at it myself. I hope you find it useful. http://blog.honeybadger.io/a-beginner-s-guide-to-exceptions-in-ruby/
Zero Downtime Migrations with ActiveRecord and PostgreSQL
Catch problematic migrations at development/test time using the zero_downtime_migrations gem!
9 New Features in Ruby 2.4
Ruby 2.4 is almost here! Are you aware of the new features? Read this post to find out. http://www.blackbytes.info/2016/12/new-ruby-features/
A gem to check npm front-end dependencies easier for a back-end developer
If you use a modern, npm-backed build system for your front-end, it may be a hassle to check for dependencies after every pull, especially if you are a back-end guy or gal. [more inside]
New gem 'multiples'!
When you want to step through all numbers that are divisible by either of two digits there is a palindrome pattern in that sequence (much like the patterns in frequencies that overlap). This gem discovers that palindrome and creates a custom enumerator like object that lets you step through each of those numbers. danielpclark/multiples This may help save you some time by not looping over non-multiples when iterating through any range of numbers.
Developing with Vagrant (ebook)
An ebook I wrote about how to use Vagrant to build a portable, efficient and flexible Rails development environment. Visitors of RubyFlow may use the discount code rbflw to get $5 off when buying the book on its website.
Heroku - Bundler version updated but push failed!
If you have ever failed to push the code to heroku due to upgraded bundler version, checkout this blog post for the solution.
Architect Properly, and Know Your Tools
This post addresses some bad habits. I’ve seen a common thread in old apps, both my own and others’, where data which belongs in one model is duplicated and stored in another model, either for performance or convenience reasons. Knowing a few fundamentals of development, architecture and knowledge of the right tools for each job solves that. [more inside]
[Screencast] Getting Started - Ruby on Rails - Architectural Overview
For beginners, learn the basic structure of a Ruby on Rails application and the request lifecycle. Learn how different components of a Rails application interact with each other. https://www.driftingruby.com/episodes/getting-started-ruby-on-rails-architectural-overview
Monitoring Your App's Health with simple Ruby apps
This post will guide you through setting up this simple health monitoring system. With this, you’ll be able to get live alerts whenever your apps (or the services you depend onto) are in a bad shape. [more inside]
Writing a Sidekiq middleware
Sidekiq, the background processing framework we all love, is not only amazing out of the box, but it even has support for middlewares, quite similar to Rack, which let you hook into the job lifecycle easily: https://christoph.luppri.ch/articles/2016/12/04/writing-a-sidekiq-middleware/
Introduction to ActiveRecord and ActiveModel Attributes API
Rails 5.0 is without a doubt a great release with plenty of useful changes and additions. The most notable change was probably ActionCable - the layer responsible for integrating your app with websockets. However, there were also other additions that could bring some substantial improvements to your Rails apps, but were a bit outshined by bigger changes. One of such features is Attributes API. [Read more]
How to Easily Configure and Run Multiple Rails Apps Locally
This post shows how I tackled the issue with running multiple apps that have conflicting services (notably, Sidekiq and Redis). Sometimes while you’re developing Rails apps, especially microservice architectures, you need to be able to run multiple apps on your development machine. Read on to see how I quickly and easily solved that problem using Foreman and a few configuration changes. [more inside]
«80-chars lines» Rails template
If you use linters like rubocop, they usually check for maximum line length. Fresh-baked rails app contains several files with very long lines which trigger linter warnings. This rails template wraps all long lines in the new app at 80 chars.
Find where the method lies : source_location
While checking out some Rails magic happening or even while rollercoasting into a very large codebase, it would be really super duper helpful if there could be something that would help to find where the method was defined. [MORE INSIDE]
flexible_permissions gem is out for flexible Ruby APIs!
For building APIs (and not only) I have been using Pundit gem for years. It’s an awesome gem. However there is a tiny issue: Pundit has a black and white policy whereas in APIs usually you need a grayscale. The user might have access to a specific resource/action, but only in certain attributes of that resource. That’s why flexible_permissions was born: a successful pattern I have been using for a couple years now is wrapped in a gem! Checkout the github page for more info!
How to Detect Things in Images from Ruby with Amazon Rekognition
Yep, Amazon now has an image recognition service - it’s called Rekognition (great name, right?) and I’ve found the official AWS SDK for Ruby already has support and makes it dead simple to detect things in photos from Ruby. Like, in less time than you might take for a toilet break.
Gem Release: Google Analytics Chrome Developer Cookie
Want to add easily configurable google analytics tracking code to your Rails application, but not register you and your development team’s clicks and views? This gem has you covered. [more inside]
jsonapi-rb – Efficiently produce and consume JSON API documents.
jsonapi-rb is a ruby library for producing and consuming JSON API documents. It is not tied to any framework (but comes with Rails and Hanami integrations in separate gems), favors clarity and efficiency.
Ansible Playbook: Ruby on Rails Server
Ansible is a great tool to automate server setups. I wrote an ansible playbook to setup a complete Ruby on Rails server with nginx, puma, let’s encrypt and everything you need to deploy your Rails App: https://github.com/aleks/ansible-rails