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.
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:
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:
Study notes for the Value Object pattern
Lately I’ve been doing some reasearch on the value object pattern. Here’s a blog post with my findings, some reading material by other authors, and an example:
Auto-Complete Association in Rails 5
Checkout the Rails screencast latest episode Auto-Complete Association in Rails 5
Better default alert boxes for your Rails applications
In a few seconds using sweet-alert2-rails, you can replace the boring standard JavaScript alert boxes with nice looking and animated ones.
EmailHunter Ruby Wrapper
A tiny ruby wrapper around Email Hunter API. Email Hunter helps sales people reach their targets and increase their sales. [more inside]
All about improving performance by eager loading associations
Please checkout my latest article where I talk about how to improve performance by eliminating N + 1 query problem, and when it can be overkill! [more inside]
Webinspector
Ruby gem to inspect completely a web page. It scrapes a given URL, and returns you its meta, links, images more. [more inside]
A Step-by-Step Guide to Debugging SJR Templates
SJR is a double edged sword in that it’s awesome when it works, but can be a nightmare to debug if it doesn’t. Over time I’ve developed a sort of systematic approach to debugging SJR templates that I use to track down mistakes in the template and stay on SJR’s good side. I shared my technique (along with a cheat sheet PDF) in my latest blog post… http://www.carlosramireziii.com/a-step-by-step-guide-to-debugging-sjr-templates.html
Improving RubyFlow: What Features Do You Want?
Hi folks, we’re going to spend some time soon to improve RubyFlow and have noticed a few common feature requests. The most popular is probably adding a “report” or flagging button so we can take down spam/junk links - so we’ll be getting that rolled out. But what else would you be keen to see? [more inside]
Go Full Stack Rails - The Frontend part 2
This is the follow-up to a series covering the development of a clean, maintainable and well-tested full-stack application with Rails and ES6. In this post, we cover “Promises” in the context of the provided example application. There’s also some discussion around how to improve promise-based tests and tips for running JavaScript specs with code42template. We also have three other posts available: The Backend: part 1, The Backend: part 2, and The Frontend: part 1.
Introduction to data structures and time complexity
I wrote an introductory article about data structures, time complexity and basic algorithms.
How To Create Search Friendly Urls in Rails
How you can utilize slugs to make your URLs more relevant to the page content. Read More From Here->How To Create Search Friendly Urls in Rails
RubyPlus Podcast Number 19
Listen to the latest episode here
Developing a wizard or multi-steps forms in Rails
This article covers one way of developing a wizard or multi-steps forms linked to session data…