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.
[Video] Using Ruby's Reduce method to create a Hash of "Banana Bunch" Arrays
Watch how to sort banana bunches into fruit Baskets (Boxes) and take advantage of Ruby’s reduce method to create a hash of sorted data.
Football Data Wrangling w/ Ruby - Match 1500+ Football Club Names from 100+ Leagues
Hello, I’ve put together a short football data wrangling w/ ruby sample that lets you match 1500+ football club names from around the world using the sportdb gem / library and open football.db (public domain) datasets. Enjoy the beautiful game. Cheers. Prost.
Context Binding in Ruby (2mn)
In this article we’re going to explore the following topics:
7 Ways to Selectively Run RSpec Tests
By explicitly picking out tests at will to run, we can develop faster! https://emmanuelhayford.com/7-ways-to-selectively-run-rspec-tests/
New validation added: aspect ratio for your ActiveStorage files + support for Rails 6
If you need to add aspect ratio validation like validates :photo, aspect_ratio: :landspace (or :is_16_9, :square, etc) for your ActiveStorage files: [more inside]
Slack Smart Bot. Run Ruby on Slack, create bots on demand and much more
https://github.com/MarioRuiz/slack-smart-bot Create a Slack bot that is smart and so easy to expand, create new bots on demand, run ruby code on chat, create shortcuts… The main scope of this gem is to be used internally in the company so teams can create team channels with their own bot to help them on their daily work, almost everything is suitable to be automated!! slack-smart-bot can create bots on demand, create shortcuts, run ruby code… just on a chat channel. You can access it just from your mobile phone if you want and run those tests you forgot to run, get the results, restart a server… no limits.
easy change user in your RoR App
https://github.com/igorkasyanchuk/any_login just got support for Rails 6 apps. Thanks for @saiqulhaq
Keep It Simple: How to deal with Code Complexity
How to deal with code complexity and the KISS principle, with a real world Ruby example https://withatwist.dev/keep-it-simple-kiss.html
Removing conditionals with Array() and Array.wrap
Ruby and ActiveSupport have two handy options for casting objects into arrays which helps guarantee your code is working with arrays and helps remove conditionals and simplify code. Learn how to use the Array() and Array.wrap methods in Ruby and ActiveSupport
How to build a Null Object library like Mimic
I saw the recent release of Mimic and decided to dive into the code to see how it was built. Learn how to build a tool to help with your projects
Lefthook: Fast, flexible, polyglot Git hooks manager
Read more about Lefthook, just out of Evil Martians’ foundries. The tool to manage all the Git hooks for your team in an environment-agnostic manner allows you to half your local and CI times linting/testing times, also comes as a Ruby gem, and works naturally with Bundler.
Sidekiq Batches: Tips & Tricks
In this Article Thaynã presents some tips and tricks when working with Sidekiq Batches: [more inside]
Introducing Affect - a new gem implementing algebraic effects in Ruby
Affect is a tiny Ruby gem providing a way to isolate and handle side-effects in your Ruby programs. It can make it easier to test your code, and provide a cleaner separation between your program logic and external entities such as I/O, databases, files etc. Affect is also useful for implementing dependency injection. Go read the docs.
Using logs to power up your Rails development workflow
A handy checklist to keep in mind when looking through your logs while developing a web application https://withatwist.dev/using-logs-to-power-up-your-rails-development-workflow.html
nice_hash creates hashes following patterns
NiceHash creates hashes following certain patterns so your testing will be much easier. Parse and filter JSON. You can easily generate all the hashes you want following the criteria you specify. Many other features coming to Hash class like the methods ‘bury’ or select_key, access the keys like methods: my_hash.my_key.other_key. You will be able to generate thousands of different hashes just declaring one and test easily APIs based on JSON for example. Perfect to be used in test data factories https://github.com/MarioRuiz/nice_hash
Callee, a Ruby gem to make classes callable
A little mixin that will help to define callable service classes with strict params specification based on dry-initializer DSL. I’ve been using it in several projects and decided to make a gem of it: https://github.com/dreikanter/callee
Ruby on Rails Podcast #280: Past Rubies, Google Pay and Turbolinks!
Nick and Brittany join forces again for a catchup about Past Rubies, Brittany’s Google Pay implementation, and even get into Turbolinks! [more inside]
screen-recorder gem now supports JRuby.
Just released v1.3.0 with support for JRuby. Use this gem to record your desktop, a specific window, or your automated UI (Selenium) tests. https://github.com/kapoorlakshya/screen-recorder
Breaking apart inheritable mattr_accessors in HTTParty
I was debugging HTTParty recently and found a little class. Took me some time to actually understand it. So I thought: “Why not share what I’ve found?” [more inside]
Ruby Refactoring series of videos
Over the last month, I’ve been experimenting with a code taken from a Ruby Refactoring kata called Tennis Game. I’m applying many different techniques to learn from the existing code and to shape a better code. Some of those refactorings are simple, like extracting paramater objects, some are bigger like turning code into data. [more inside]
Reading Ruby Metaprogramming inside Devise
If you’re new to metaprogramming or find it confusing, dive into a popular project to see how it makes things work: Reading Ruby Metaprogramming inside Devise