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.
sportdb gem - New Datasets for the World Cup 2022 in Qatar in Football.TXT
Hello, the World Cup 2022 kicks off today (in Qatar). Any open data or web service json api out there for the football match schedule? To get you started w/ ruby and the sportdb gem(s) I started adding new datasets for the World Cup 2022 in the (structured) Football.TXT format (e.g. /2022–qatar/cup.txt, etc.) that you can read into any SQL database (and than export to JSON, for example). Anyways, it’s the early days. If you know any ruby scripts or open data or json apis for the world cup, please tell / share.
Generate Password Protected PDFs in Ruby on Rails
Setting up Rails & Docker for a consistent developer experience
My approach for setting up Docker & Rails, so it’s easy for any developers to join in on the project: https://codewithrails.com/rails-docker
How to create a gem in Ruby on Rails?
Developers can create some incredible applications using Ruby on Rails best gems. Using Ruby gems is a standard practice in developing web applications in Ruby on Rails. Using the gems listed here, along with other Ruby gems, it is possible to create a customized Rails app that fits the needs of any company, and allows for fast software development, to get fast time-to-market, and stay competitive. A Gem in the Ruby programming language is a software package where Ruby applications or libraries can be deployed in a uniform format. For Ruby on Rails gems, an interface is a command-line tool called a gem that can install and manage a library. A gem embeds the Ruby programming languages runtime loader, which helps to find and load installed gems from unified libraries folders. RubyGems is a package manager for Rails which includes a standard format for distributing Ruby programs and libraries (in the form of a self-contained framework known as gem), a tool to manage the installation of the gems, and a server for shipping them. Read: How to create a gem in Ruby on Rails?
Ruby on Rails vs Django - The Back-end battle!
When it comes to developing Web applications, there are literally dozens of frameworks available for almost any programming language, but two of the best known and trusted are Django in Python and Rails in Ruby. Ruby on Rails has the best examples for building web applications, showing its dominance over a vibrant web community, while the Ruby programming language is similar to a complete solution, where applications are found across the backend, the M.L., and the web. Python-based is ranked among the best programming languages, and is known to emphasise the clarity and readability of code, while Ruby on Rails is known for attributes like flexibility and freedom, as well as for its easy-to-understand syntax. Django is among the most popular Python-based frameworks among experts in the language. Read More on RoR vs Django
refine and using Methods in Ruby
The Module#refine method allows you to register a monkey-patch for a specific class that can be applied whenever we want by calling the Module#using method… SEE MORE
rlp (Recursive Length Prefix) gem for data encoding reborn as rlp-lite (redux)
Hello, if anyone tries to request data from the ethereum (open) blockchain (service / database) with ruby sooner or later you might want to understand the magic and put together a to-the-metal “raw” json-rpc request with a recursive length prefix (RLP) encoded-data package. Good news - there’s a rlp gem with 1+ millions downloads; bad news - last update in 2016 and the (ruby) source code is officially archived / read-only). Anyways, using the “best of the both worlds”, that is, the “inline” rlp encoder/decoder from the eth gem and the rlp gem itself I put together a new rlp-lite gem. It’s the early days ;-). You are welcome to join in and try the new kid on the block. What are your (eth) options (in ruby) that you use? Please tell / share / discuss.
What'S New With Ruby On Rails 7
With 7.0s release, many new, game-changing features are coming to the table, making Rails as powerful as it is ever been. If your application is running Rails 6.1 or earlier versions, upgrading to the latest features in Ruby on Rails 7.0 will provide increased security, cost-effective maintenance and development, as well as improved application performance and UX. Read in detail
How we got struck by 5–year–old implementation
Recently we discovered that we were wrong on computing lock key for acquiring advisory locks. It was already covered as an update to article about building read models, but we thought that telling the whole story behind the issue could be interesting for you. [more inside]
Yes, You Can - Write Your Own Crypto Hash Functions / Digests In Ruby - SHA3, Keccak
Hello, if anyone is crypto (blockchain) programming in ruby - sooner or later you will need a Keccak and/or SHA3 (crypto) hash function / digest class - some popular options are gems with c-extensions - so with great surprise I found this week “less popular” hidden (crypto) gems in “plain-old” ruby and zero-dependencies on c-extensions. The two options are Keccak256 by Evan Taylor and SHA3 (“Pure Ruby”) originally by Christian Neukirchen et al and “gemified” by Shannon Skipper. Thanks! Anyways, I have started to use the “hidden (crypto) gems” in the ethlite gem that lets you call (blockchain) contract (services) via JSON-RPC and all works out great so far. What are your (crypto hash or eth) options (in ruby)? Please tell / share / discuss.
Calling Sonic Pi From Ruby
Are you looking for an elegant solution to pipe output from your Ruby code to Sonic Pi? This isn’t it. But it does work. [more inside]
Deep dive into Semantic Versioning | Hanami Mastery #33
Semantic versioning is a useful approach to version your projects or gems - let’s deep dive into it together! [more inside]
Rubber Duck Dev Show Episode 65 | Callbacks: Good or Evil?
Rubber Duck Dev Show Episode 65 is released! In this episode, we discuss whether Ruby on Rails Active Record callbacks are good or evil: https://www.rubberduckdevshow.com/episodes/65-callbacks-good-or-evil/
Deploying Rails and Sidekiq to Fly.io
Learn how to deploy a typical Rails application to Fly.io including PostgreSQL and Redis.
NSA recommends Ruby as one of 5 languages
“ C#, Go, Java, Ruby, Rust, and Swift” The NSA recommends to use one of these languages to prevent memory based attacks. Memory violations cause up to 70% of all security violations regarding to Microsoft and Google researchers. A great day for Ruby! If someone asks you why you use Ruby for your project you can simply point them to this article https://media.defense.gov/2022/Nov/10/2003112742/-1/-1/0/CSI_SOFTWARE_MEMORY_SAFETY.PDF
The inherent unreliability of after_commit callbacks and most service objects
Service objects and/or after_commit callbacks are ubiquitous in most real-world Rails applications. Whether it’s a good idea or not (ActiveRecord callbacks - I’m looking at you) is a different story, but one thing that is notoriously overlooked in the application design is reliability. And yes, the service objects are equally bad as after_commit callbacks in that regard. [more inside]
Released ActiveWorkflow 0.9.16
ActiveWorkflow 0.9.16 has been released. This is a minor release that adds the ability to wipe out workflow state (useful during workflow development) by removing all messages, log records and agent memory with a single button (with confirmation, just in case). Heroku “demo” mode was removed since a free tier seems to be no longer available (you can still deploy to Heroku with your own configuration). Multiple dependencies were updated.
Released command_kit 0.4.0
Released command_kit 0.4.0. Adds modules for invoking the default text editor (aka $EDITOR), also printing key/value fields, bulleted lists, and tables in a variety of formats (see examples/printing/tables.rb)!
Released ruby-nmap 1.0.0!
Released ruby-nmap 1.0.0! This major release switches to the brand new command_mapper library (which handles mapping in nmap options to class attributes), adds support for more nmap options, and improves parsing of structured NSE script output data from nmap XML output. See the UPGRADING guide on how to upgrade from 0.10.0 to 1.0.0.
Sorting ActiveRecord results by enum values (in SQL)
in_order_of is a new method in Rails 7 that allows you to sort by enum values directly in SQL [more inside]
artfactory gem in Action - Generate Pixel Art Via Text-To-Image Prompts
Hello, In the ongoing learn pixel art programming with ruby series I put together a new artfactory gem that let’s you generate pixel art via text-to-image prompts - no A.I. training or models needed / required ;-). The “magic” works via all-in-one image spritesheets (and meta datasets in .csv). To get you started I “right-clicked & saved” about a dozen “on-blockchain” artwork layers for easy “off-blockchain” (re)use. Happy pixel pushing and profile pict(ure) pixel art generation with ruby.
How to Send Tailwindcss-Styled Emails With Ruby on Rails 7
Have you ever tried to create a good-looking email design from scratch? Or how about using TailwindCSS to write your email layouts? [more inside]