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.
Linting Ruby Code
Let’s take a look at what linting is and a few problems that come with it. https://blog.appsignal.com/2021/04/28/ruby-linting.html
Decorate your runner session like a pro
In this post I describe how to execute some custom code when your script is run by Rails runner. You can use that to notify external services when your script finishes or to prepare some initial data before your script starts. [more inside]
How to balance the public APIs of an open-source library — practical examples from Ra
On twitter, Krzysztof asked an interesting question: what are our thoughts on carving a well-balanced API for an open-source library that RailsEventStore is. [more inside]
Introducing attributes_sanitizer Rails Gem
Have you ever needed to sanitize data before sending it to the database? Do you need to ensure that a string should be always saved in lowercase without extra spaces? The attributes_sanitizer gem can help you with that. Extracted from a real project, it makes it possible to easily set up attributes sanitization for Rails 5+ projects. [more inside]
Understanding Insertion Sort in Ruby
There are lots of ways to sort data. Insertion sort is particularly interesting because it sorts the data in place and is pretty easy to understand. Of course, most of us just use the #sort method. But interviewers still love to ask questions about sorting algorithms and related topics like Big-O notation. In this post, you’ll learn not only how insertion sort works but also how to implement it yourself in ruby. https://www.honeybadger.io/blog/ruby-insertion-sort/
Importing posts from external source into Nanoc
A tutorial on adding external source of content into Nanoc static-site generator: https://mostlyobvio.us/2021/04/importing-external-posts-into-nanoc/
Audiobook streaming platform with Ruby on Rails and AWS stack
I recently was faced with the problem of setting up an audiobook streaming platform on AWS using Ruby on Rails and VideoJS. I described the challenges I encountered in the series of blog posts: https://rubywizards.com/series/audiobook-streaming
Growing Rails - Utilizing Form Models for complex validations or side effects
I explain advantages of introducing Form Models as a First Class Citizen under app/forms, and show you our ApplicationForm base class, including parameter coercing, validations and Strong Params “auto permitting” without any dependencies besides Rails. [more inside]
huge update to Rails Performance gem (free alternative of NewRelilic)
https://github.com/igorkasyanchuk/rails_performance got a major update (added support for grape, rake tasks, delayed_jobs, custom event tracking, and several bug fixes). [more inside]
Access control gem for your Rails application
A way to do authentication checks and authorization in your Rails application. [more inside]
Must have ruby gems in the development environment to increase productivity.
Must have ruby gems in the development environment to increase productivity. [more inside]
[Fix] Build Failed while Installing Ruby with Rbenv on M1 Mac
Tutorial to fix errors: 1. BUILD FAILED (macOS 11.2.3 using ruby-build 20210309) 2. Inspect or clean up the working tree at /var/folders/….. [more inside]
Code Quality, or Cheat Code?
I finally got around to looking at the flay documentation a few days ago, and then I added a .flayignore file to ShinyCMS to skip checking Rails controllers and Pundit policies for duplication. This had a quite noticeable effect on the lower-scoring files in my Ruby Critic summary - the D and F grades - in fact it got rid of every single one of them…
Using Hotwire Turbo in Rails with legacy JavaScript
Thankfully, Hotwire Turbo is perfectly usable even in an old project full of JavaScript, i.e. with Turbo Drive (Turbolinks) disabled. [more inside]
check your logs directly in browser (for staging, production) + have simple console
https://github.com/igorkasyanchuk/sweet_staging with minor fixes and improvements. You can run Ruby code in a browser on your staging server, or “tail” staging.log in real time.
Alba 1.1.0 now deals with circular associations
I just released Alba version 1.1.0. This release supports circular associations control, letting you customize how it serializes nested associations with declarative hash.
Fast text search with PostgreSQL in a Rails project
I explain how I optimized text search from a naive implementation to full speed : http://alexis.bernard.io/blog/2021-04-22/fast-text-search-with-postgresql-in-a-rails-project.html
Rack apps mounted in Rails — how to protect access to them?
Sidekiq, Flipper, RailsEventStore — what do these Rails gems have in common? They all ship web apps with UI to enhance their usefulness in the application. In production application you’ll want to protect access to them. [more inside]
Rails Wizards (9-part-series)
https://jonsully.net/blog/rails-wizards-part-one/ — I spent the last few weeks investigating the storied history of building a multi-step form / wizard in Rails. Seems like there’ve been a lot of proposed ways to make the cookie crumble in Rails’ long history. I hoped to add clarity to a few means of doing that while investigating my own needs for my specific project. Hopefully it’s a net-positive 😊
What's Cooking in Rails 7?
A new version of Rails always brings new and exciting features. This writeup takes a look at some of the things Rails 7 has in store for us. [more inside]