Rubyland

news, opinion, tutorials, about ruby, aggregated
Sources About
AkitaOnRails.com 

[Akitando] #103 - Todos os Sistemas de Arquivos: de FAT a ZFS

DESCRIÇÃO

Quais são todos os filesystems de todos os sistemas operacionais? Por que todos falam que ZFS é o melhor? E quais as alternativas mais modernas? Vamos ver tudo isso hoje!

Conteúdo

  • 00:00 - Intro
  • 00:32 - INode, DEntry
  • 02:35 - VFS
  • 03:18 - Journaling
  • 05:54 - Filesystems com Journal
  • 06:23 - Filesystems da Apple
  • 07:59 - Filesystems de Linux
  • 11:21 - Resumo
  • 13:26 - ZFS
  • 14:36 - checksums
  • 16:28 - OpenZFS
  • 18:11 - snapshots - Copy on Write
  • 22:25 - de-duplication
  • 23:46 - CoW vs Journal
  • 24:49 - APFS
  • 26:01 - compressão
  • 26:32 - encriptação
  • 29:04 - BTRFS
  • 32:12 - o filesystem universal?
  • 32:57 - NFS/CIFS/SMB
  • 34:04 - SD Cards
  • 35:36 - exFAT

Links

  • The Inode Object…
Saeloun Blog 

Ruby 3.1 adds try_convert method to Integer class for implicit conversions

Implicit and Explicit Conversion

Ruby objects are usually converted to other classes/types using to_* functions. For example, converting the string “42” to an integer is done with to_i.

The following table shows the defined conversion methods of Ruby’s important core classes:

Class Explicit Conversion Implicit Conversion Array to_a to_ary Hash to_h to_hash String to_s to_str Integer to_i to_int Float to_f - Complex to_c - Rational to_r - Regexp …
Rails with Jason 

106 - The Benefits of Working on One Thing at a Time with Josh Thompson

In this episode, Josh Thompson and I discuss iterative teaching and the curse of knowledge, managing frustration by managing your expectations, metrics for evaluating a dev team, and lessons learned from attempting to maximize income as a freelancer.

Martian Chronicles, Evil Martians’ team blog 

Smart generation: Website generator for Yandex.Business

Authors: Alexey Ivanov, Frontend Developer at Evil Martians and Olga Rusakova, Writer at Evil Martians

Why do tech giants with highly recognized engineering teams choose to entrust their product development to Evil Martians? Let’s lift the curtain on the case with Yandex, the largest technology company in Russia. We enabled them to avoid lingering on the engineering resources waitlist and delivered a ready-to-market automatic website generation engine for thousands of their customers in only two and a half months.

Rapid reaction forces for a giant corporation

Yandex.Business is a service that helps small and medium business (SMB) advertisers launch their online campaigns automatically…

Ruby News 

2022 Fukuoka Ruby Award Competition - Entries to be judged by Matz

Dear Ruby Enthusiasts,

The Government of Fukuoka, Japan together with “Matz” Matsumoto would like to invite you to enter the following Ruby competition. If you have developed an interesting Ruby program, please be encouraged to apply.

2022 Fukuoka Ruby Award Competition - Grand Prize - 1 Million Yen!

Entry Deadline: December 3, 2021

Fukuoka Ruby Award

Matz and a group of panelists will select the winners of the Fukuoka Competition. The grand prize for the Fukuoka Competition is 1 million yen. Past grand prize winners include Rhomobile (USA) and APEC Climate Center (Korea).

Programs entered in the competition do not have to be written entirely in Ruby but should take advantage of the unique…

Alfredo Motta 

Not So Random Software #48 – The Stop Experiment

Hello everyone and welcome back to Not So Random Software! The last few months I have learned the hard way that if you want to …
The Bike Shed 

303: Dear Mr. Grumpy Goose

Chris gives a DB sessions update and talks bifunctors & command objects. Steph shares the coolness of a gem she's been using called after_party, and excitedly gushes about her new laptop. (Chris is hoping to hold off on replacing his until the end of the year and then they can compare!)

The two then answer a listener question on retrospectives and how they've seen productive ones run, while giving some of their own helpful opinions on dos and don'ts. They're talking to you, Grumpy Goose!

Tr…

Jemma Issroff 

Esoteric Ruby in MemoWise

This post was co-written by Jacob Evelyn.

We recently released a memoization gem, MemoWise! We’ve written about its origin story and performance. In this post, we’ll discuss some esoteric corners of Ruby we encountered while writing MemoWise.

Memoizing frozen objects with prepend

One of the features we needed to support when creating this gem was memoization of frozen, or immutable, objects. Specifically, we use the Values gem which creates immutable instances. Once an object is frozen, we can’t assign any of its instance variables:

class Example
 attr_writer :value
end
Example.new.freeze.value = true # FrozenError (can't modify frozen Example)

How is this relevant to memoization?…

GoRails Screencasts 

Dynamic Select Fields in Rails with Hotwire

Need to dynamically update fields when a user changes a select box? We can do that easily in Rails using Hotwire's Turbo Stream actions.
Drifting Ruby Screencasts 

Hotwire Turbo Replacing Rails UJS

In this episode, we look at some common functionality that we got with Rails UJS and what it looks like to reimplement these with Hotwire's Turbo and StimulusJS.
Scott Watermasysk 

ThocStock

Back in February, I built and released a new site, ThocStock.

ThocStock.com

The primary goal of ThocStock is to list custom mechanical keyboard products that are not only of high quality but also in stock.

For those not familiar with the custom mechanical keyboard space, products are scattered across many sites worldwide; availability is often very scarce.

In the first six months, the site has far exceeded my expectations. Like most side projects, it is often not easy to find time to keep them going, but the community's enthusiasm has made it easy to keep updating and enhancing the experience.

Honeybadger Developer Blog 

Using ActiveRecord's #update_counters to Prevent Race Conditions

Rails is a large framework with a lot of handy tools built-in for specific situations. In this series, we're taking a look at some of the lesser-known tools hidden in Rails' large codebase.

In this article in the series, we're going to take a look at ActiveRecord's update_counters method. In the process, we'll look at the common trap of "race conditions" in multithreaded programs and how this method can prevent them.

Threads

When programming, we have several ways to run code in parallel, including processes, threads, and, more recently (in Ruby), fibers and reactors. In this article, we're only going to worry about threads, as it is the most common form that Rails developers will…

Brandon Weaver 

Functional Programming in Ruby – State

Ruby is, by nature, an Object Oriented language. It also takes a lot of hints from Functional languages like Lisp.

Contrary to popular opinion, Functional Programming is not an opposite pole on the spectrum. It’s another way of thinking about the same problems that can be very beneficial to Ruby programmers.

Truth be told, you’re probably already using a lot of Functional concepts. You don’t have to get all the way to Haskell, Scala, or other languages to get the benefits either.

The purpose of this series is to cover Functional Programming in a more pragmatic light as it pertains to Ruby programmers. That means that some concepts will not be rigorous proofs or truly pure ivory FP, and…

Everyday Rails 

Deprecating code in a Rails application

Here's how to add good deprecation warnings to your Rails applications, and why it might be a good idea.
Riding Rails 

Favicons, InvalidAuthenticityToken message gains, Journey optimizations and more!

Hello, zzak here! Congrats on making it through another month and another week of Rails development.

Add favicon to internal routes “/favicon.ico”

They finally fixed that pesky No route matches [GET] "/favicon.ico" error on the default Rails welcome page.

Introduce Journey::Ast to avoid extra ast walks

This PR started its journey almost exactly a year ago…!

Improve help for Rake tasks

Rails help command now includes the Rake task description which is much more helpful. Give it a try: bin/rails db:migrate -h!

Help identifying why we have an InvalidAuthenticityToken exception

Unverified CSRF requests now display a helpful error message in the ActionController::InvalidAuthenticityToken

“Middleware#remove” is…

Brandon Weaver 

Understanding Ruby - For vs Each

Introduction

For those coming from other languages with for loops the concept of each, anonymous functions, blocks, and all of those new terms feels very foreign.

Why is it that Ruby doesn't use for loops? Well we're going to cover that one today.

Difficulty

Foundational

Some knowledge required of functions in Ruby. This post focuses on foundational and fundamental knowledge for Ruby programmers.

Prerequisite Reading:

None

Suggested to read Understanding Ruby - Blocks, Procs, and Lambdas after this article if you haven't already.

For vs Each – High Level Overview

Ruby does have a for loop

Let's start with an acknowledgement: Ruby

RubyGems Blog 

3.2.25 Released

RubyGems 3.2.25 includes enhancements and bug fixes.

To update to the latest RubyGems you can run:

gem update --system

To install RubyGems by hand see the Download RubyGems page.

## Enhancements:

  • Don’t load the base64 library since it’s not used. Pull request #4785 by deivid-rodriguez
  • Don’t load the resolv library since it’s not used. Pull request #4784 by deivid-rodriguez
  • Lazily load shellwords library. Pull request #4783 by deivid-rodriguez
  • Check requirements class before loading marshalled requirements. Pull request #4651 by nobu

## Bug fixes:

  • Add missing require 'fileutils' in Gem::ConfigFile. Pull request #4768 by ybiquitous

SHA256 Checksums:

  • rubygems-3.2.25.…
Remote Ruby 

Learning in Public | Alpine & Inertia

[00:00:42] Andrew gives us an update if he finished his JavaScript framework he was working on, and he tells us why he chooses to use Alpine over Stimulus. 

 

[00:03:45] Find out about a method that Bridgetown has called jsonify and what it does. 


[00:04:55] Jason tells us since he’s been low key back in action this week and he’s been trying out Inertia.js. The creator of Inertia, Jonathan Reinink was on a previous episode that you should listen to. Also, Jason talks about how he likes using Tailwind.


[00:06:06] Learn more about a JavaScript package called Headless UI that Tailwind has and what Inertia does. Andrew brings up an episode of The Bike Shed podcast called “All Things…

Test Double Blog 

Double Agent Profile: Ali Ibrahim

Name: Ali Ibrahim Designation: Agent 0022 Double Agent Role: Senior Software Consultant Special Skills: Finding ways into and out of rabbit holes Aliases: alimeye Location: Baltimore, MD Favorite Emoji: 🕺🏾
Hint Blog Feed 

Test Like You Fly - The World Revolves Around You

In Test Like You Fly - Part 2 - Basics, we discussed the fundamentals of how you practice a TLYF strategy. No systems operate in such isolation that they are not reliant on some other code foundations. And those foundations rely on other foundations.

Environments and Configurations - Oh My!

Our applications don't live in a vacuum. They take advantage of the operating systems, databases, caches, networks, and other external services available today in the cloud deployment environment. Let's see what we should think about in regard to Testing Like We Fly.

Predefine and Test

  • Provisioning – Ensure existence/creation of directories
  • Validate that dependencies (gems, npm packages, etc.) state…
Awesome Ruby Newsletter 

💎 Issue 271 - An Introduction to Pattern Matching in Ruby

Ruby Weekly 

Building HTTP servers from scratch in Ruby 3

#​563 — July 29, 2021

Read on the Web

Ruby Weekly

Rails Mini Profiler: Performance Profiling for Rails, Made Simple — Rails Mini Profiler provides detailed information about your requests to help you figure out why certain requests perform poorly. Inspired by rack-mini-profiler which you can use more generically on Ruby web apps and APIs.

Hans-Jörg Schnedlitz

Building an HTTP Server in Ruby 3 with Fibers and Ractors — This is part of a broader series about building an HTTP server in Ruby ‘from the ground up.’ Here, Dmitry shows the difference between approaches involving single and multi threads, fibers,…

Dmitry Ishkov

The Ruby on Rails Podcast 

Episode 377: The Ruby Super Team (Brittany and Nick)

Nick's debut as a co-host on The Ruby on Rails Podcast! Nick tells Brittany about the ambitious project he and his Hack Day team took on at Shopify. Brittany updates Nick on her trip to Denver to meet the team at TextUs and how her junior team members are doing a month in. They wrap up by reflecting on how much hiring has changed since they discussed it in depth last spring.

Show Notes & Links:

Sponsored By:

Scout APM

Try their error monitoring and APM free for 14-days, no credit card needed! And as an added bonus for Ruby on Rails listeners: Scout will donate $5 to the open-source project of your…

Saeloun Blog 

React 18 improves the existing behavior of Suspense

The release of React 18 Alpha has brought a lot of excitement amongst the React community. It is more focused on user experience, architecture changes, and adaptation of concurrent features.

One of the features in React 18 everyone is talking about is Suspense. It is a vast topic to discuss as many changes have been introduced related to Suspense. In this blog, we will look into the improvements coming up in React 18 related to Suspense.

What is Suspense?

As the name implies, it suspends something until it is ready.

React 16.6 added a <Suspense> component that lets us ‘wait’ for some code to load and specify a loader while we are waiting for the code to finish loading.

The React team…

Josh Software 

TypeScript — A JavaScript BodyGuard to your rescue!

BUGS! BUGS! BUGS! Every developer out there must have faced these words in their lives. Bugs are a part of a developer’s life. Whatever amount of code we write everyday has probability to have some bugs. As the number of bugs goes on increasing, our overall code quality decreases and no-one wishes of having such … Continue reading TypeScript — A JavaScript BodyGuard to your rescue!
OmbuLabs Blog 

Webpack ALL The Assets!!

With the release of Rails 6, Webpack was introduced as the default JavaScript bundler by using the Webpacker gem. We tend to think about Webpack only as a tool to handle JavaScript files, but it can be used to handle all kinds of asset files. This article shows how to create a Rails app that uses only Webpack to handle all the assets, including images, fonts, styles and videos.

Init the Rails App

rails new NoSprocketsRails --skip-sprockets

You can use -S instead of --skip-sprockets, both are aliases. Use rails new -h to see the available options.

Cleaning the New App

Interestingly, there's some Sprockets-related files and code that are still getting created so we need to remove…

Martian Chronicles, Evil Martians’ team blog 

Introducing JavaScript and TypeScript client for AnyCable

Author: Vladimir Dementyev, Principal Backend Engineer at Evil Martians

AnyCable has been focusing on server-side performance for the last five years (yeah, we’ve just hit 🖐). However, all real-time cable applications consist of two parts: servers and clients. And today, we will concentrate on the the frontend: let me introduce the AnyCable JavaScript SDK.

How did we survive without writing a line of JavaScript code in our libraries? From day one, we bet on the compatibility with Action Cable, including the official @rails/actioncable npm package. That was one of our selling points: no client-side changes were required to switch from Action Cable to AnyCable.

Unlike AnyCable, its…

Ruby Magic by AppSignal 

An Introduction to Pattern Matching in Ruby

Let’s start with a brief discussion about pattern matching in Ruby, what it does, and how it can help improve code readability.

If you are anything like me a few years ago, you might confuse it with pattern matching in Regex. Even a quick Google search of ‘pattern matching’ with no other context brings you content that’s pretty close to that definition.

Formally, pattern matching is the process of checking any data (be it a sequence of characters, a series of tokens, a tuple, or anything else) against other data.

In terms of programming, depending on the capabilities of the language, this could mean any of the following:

  1. Matching against an expected data type
  2. Matching against an expected…
Saeloun Blog 

Rails 7 allows setting cache expiry, as an absolute timestamp

Rails caching has always had an expires_in method, which allows us to set cache expiry in relative time.

Before : Caching Expiry with expires_in

Let’s say in our e-commerce Rails application we are running a sale that ends in 2 days. We store the product ids which are part of sale in cache as below:

product_ids = ["4c383b29-c2d4-4579-be56-bb5fa51b43b5", "8ed1274b-e0ca-44f8-9ef2-9892c1816ba1", ...]

Rails.cache.write("new_year_sale_products", product_ids, expires_in: 2.days)
# Time passed to expires_in will be converted to epochs
# 2.days is stored as 172800 seconds

Rails.cache.send(:read_entry, "new_year_sale_products").instance_variable_get(:@expires_in)
# => 172800.0

Rails.cache.read(

The expires_in is not an absolute timestamp.

After : Caching Expiry with expires_at

With this merge, it is now possible to store cache expiration in absolute time.

As mentioned in the PR itself, there are several use…

All Ruby Podcasts by Devchat.tv 

Debugging Ruby ft. Fabio Perrella - RUBY 508

Fabio Perrella joins the Rogues to discuss debugging Ruby programs and how to find problems across your code and your dependencies.

The panel shares their stories and experience to dive into debugging tools and techniques they've used that have worked out well in the apps they maintain.

Panel

  • Darren Broemmer
  • John Epperson
  • Luke Stutters
  • Valentino Stoll

Guest

  • Fabio Perrella

Sponsors

Links

Picks

Greater Than Code 

243: Equitable Design: We Don’t Know What We Don’t Know with Jennifer Strickland

02:51 - Jennifer’s Superpower: Kindness & Empathy

07:37 - Equitable Design and Inclusive Design

15:43 - Biases and Prejudices

22:57 - So...What do we do? How do we get people to care?

33:22 - How Ego Plays Into These Things

  • Actions Impact Others
  • For, With, and By
  • Indi Young

44:05 - Empathy and Accessibility

  • Testabi…
The RubyMine Blog : The Ruby on Rails IDE | JetBrains Blog 

RubyMine 2021.2 Released

RubyMine 2021.2

RubyMine 2021.2 is now available! Check out the highlights of this release below, or visit our What’s New page to learn about all of the latest features.

DOWNLOAD RUBYMINE 2021.2

Smarter search and refactoring

For projects using RBS, Go to declaration, Find usages, and Rename refactoring now work more precisely. RubyMine relies on RBS declarations to define how project entities relate to each other instead of showing all potential usages.

Improved search and refactoring

Improved Ruby code assistance

RubyMine uses RBS signatures to determine the types of Ruby elements and to provide more relevant code completion.

Version 2021.2 supports most of the existing RBS entities, including type variables, block parameters, tuple…

Kir Shatrov 

Vitess: Scaling VReplication

One of my projects at work has been involving Vitess and VReplication. I recently did a deep dive to figure out how VReplication works and where are its scalability bottlenecks. Below are my notes that I thought are worth sharing with the community.

What is VReplication? To sum its docs, it’s a tool that lets you copy and maintain a live subset of data from one database to another – similar to Shopify’s Ghostferry, but tailored for the Vitess’s world and with an orchestration layer on top of it.

VReplication is a core component of Vitess that backs many of its features, but where does its code actually run?

  • Whenever you create a VReplication stream by executing a SQL statement…

Rails with Jason 

105 - The Benefits of a Test-Oriented Development Workflow with Chris LaBarge

On this episode I'm joined by Chris LaBarge who works with me at Meadows Healthcare. Chris and I discuss testing in general as well as using TDD to lower the cognitive burden of coding.

Saeloun Blog 

Rails 7 adds change tracking methods for belongs_to associations

Sometimes minor updates add the most joy to users! A recent Rails update introduced the ability to monitor for changes in belongs_to associations. This brings in a welcome change for developers who like to conform to “the Rails way”.

Change tracking is one of the convenient methods that Rails supports out of the box. When using ActiveRecord, we can query for database changes. This is useful when building triggers and events. Let’s look at an example!

Imagine a database structure that has posts and categories.

class Post
  belongs_to :category
end

class Category
  has_many :posts
end

Now let’s say that we want to record activity when the posts’ title gets changed. We could write…

The Bike Shed 

302: Observability with Charity Majors

Tune in as Co-founder and CTO of Honeycomb, an observability platform, Charity Majors joins Chris to drop some knowlege bombs such as:

  • Thinking of observability as being about the unknown unknowns: Allowing for high cardinality, high dimensionality, ad hoc queries at any point in time.
  • Comparing instrumentation to a muscle: It's a habit that needs to be developed and fostered.
  • Sincere continuous deployment: 15 minutes or bust.

And bunches more, since y'all know you hear her name come up at least once during every other episode!

Transcript:

CHRIS: Hello, and welcome to another episode of The Bike Shed, a weekly podcast…

Hanami Mastery newest episodes! 

I've made a dependency graph for DRY-RB Ruby gems family

Have you ever wondered which DRY-RB library learn first? I did when I started with DRY-RB. I hope this will help!
Martian Chronicles, Evil Martians’ team blog 

Accessible design from the get-go

Author: Roman Shamin, Art Director at Evil Martians

Accessibility when designing for a screen is not an exception to the Pareto principle. We believe that just about 20% of designer effort can solve up to 80% of accessibility challenges for digital interfaces. Read on for an extensive collection of practical tips that can help you build a great foundation for a11y—right at the mockup stage.

Getting a perfect accessibility score for on-screen interfaces is a difficult task that requires a separate coordinated effort from the whole product team, a responsible approach from the product’s owner, and, ideally, a dedicated professional well-versed in a11y. However, a solid foundation for…

Truemark Technology 

Search Engine with Rails and Elastic Search

I had always wondered "How do I search through the relational database, in any table, in any column and get the related result?". After searching for a bit, I reached to the conclusion YOU DON'T.

Searching through more than one table and add to that, more than one column is very complex with relational database. That's where Elasticsearch comes into play. Elasticsearch stores all records in documents and provides search functionality that is very fast.

DISCLAIMER

Before we move into the implementation part of the tutorial, I want to make this clear:

This is not the tutorial for building the web search engine like Google. What you will be building is a search engine for the Rails App…

Honeybadger Developer Blog 

Deploying Rails to AWS Lambda

Serverless computing helps offload the work of managing and provisioning servers to a cloud provider and is rapidly becoming a thing for most technology teams. AWS Lambda is a type of serverless technology used by many technology teams. AWS Lambda supports most of the core programming languages, including NodeJS, Java, Python, and Ruby. Although core programming languages are supported, there may be times when you want to run serverless functions dependent on features that are part of the frameworks built with these languages. In this post, we will explore how to run a Rails application in AWS Lambda. This post assumes that you are conversant with serverless computing and AWS Lambda and…

Peter Zhu 

A Rubyist’s Walk Along the C-side (Part 6): Classes & Object Oriented Programming

Defining classes and modules and creating instances of classes.
Sandip Mane 

React state validation hook using Yup

In this blog, we will create a state validation hook in react using Yup. I am also going to use ramda a functional library (if you are not using it already, do give it a try).

Yup

Yup is a JavaScript schema builder for value parsing and validation. Define a schema, transform a value to match, validate the shape of an existing value, or both. Yup schema are extremely expressive and allow modeling complex, interdependent validations, or value transformations.

Yup schema

Let’s take a simple example of a login form, check this playground for more complex use cases.

const schema = yup.object().shape({
  email: yup
    .string()
    .trim()
    .required("Email is required")
    .email("

This…

Dmitry Ishkov 

HTTP server in Ruby 3 - Fibers & Ractors

Article Logo

This is part #2. Head over to part #1 to learn about HTTP in Ruby.

Motivation

Historically Ruby's been lacking in the concurrency department. Ruby has "native" threads (prior to 1.9 there were only "green"), which means there can be multiple threads controlled by an OS, but only 1 thread can be executed at a time, this is managed via Global Interpreter Lock (GIL). However, native calls and I/O calls can be executed in parallel. During an I/O call, a thread gives up control and waits for a signal that the I/O has finished. This means I/O heavy applications can benefit from multiple threads.

In this article we are going to explore different concurrency modes for our HTTP server:

Riding Rails 

Active record improvements and much more

Hi, Wojtek here presenting quite a lot of changes from the past week.

Disable schema dump per database

Dumping the schema is on by default for all databases in an application. To turn it off for a specific database one can now set schema_dump: false in the database config file.

Add change tracking methods for belongs_to associations

Two new methods were added: association_changed? and association_previously_changed? (assuming an association named :association) to Active Record.

Raise error on unpermitted open redirects

Add allow_other_host options to redirect_to. One can opt in to this behaviour with ActionController::Base.raise_on_open_redirects = true.

Update Capybara drivers

Depr…

The RubyMine Blog : The Ruby on Rails IDE | JetBrains Blog 

RubyMine 2021.2 Release Candidate

RubyMine 2021.2 Release Candidate is available! Here’s a quick roundup of the most notable new features being introduced in the upcoming 2021.2 release:

Ruby and RBS

  • RubyMine now supports most of the existing RBS entities, including type variables, block parameters, tuple types, proc types, and more.
  • For projects using RBS, Go to declaration, Find usages, and the Rename refactoring now work more precisely.
  • You can now navigate between the corresponding .rb and .rbs files using ⌃⌘↑ (Ctrl+Alt+Home).
  • Access to information stored in .rbs files enables RubyMine to check Ruby code for more potential errors.
  • This version comes with essential features that make RBS code easier to read, including…

Code editor

  • We have clarified descriptions for all of the inspections that RubyMine can perform.
  • RubyMine now supports performing various actions on save.
  • You can now create scratch files right from the selected code.

User experience

Remote Ruby 

Collin Jilbert: Bootcamps, Ruby Radar, and finding a job as a Junior Rails Developer

[00:01:46] Collin gives us his background and getting into the programming world. 

 

[00:03:24] Collin fills us in on why he decided to do a part-time Bootcamp instead of a full-time one, and Chris wonders if the slower pace helped him retain knowledge.


[00:06:28] Find out about the kind of projects Collin did at the Bootcamp.


[00:08:21] Andrew ask Collin for his opinion on why they hit Sinatra before Rails.


[00:11:06] Chris wonders how the support was set up when Collin walked into some problem that he couldn’t solve and who helped him out.


[00:15:27] Collin gives us his thoughts on going full-time versus part-time, and if either one is harder. 


[00:23:54] Andrew and Collin discuss…

Kir Shatrov 

Quick way to run a Ruby script in Kubernetes

Sometimes I find myself in need of running a Ruby script on a live Kubernetes cluster. In today’s example, it had to do with generating load on MySQL, which was tricker to do from my laptop. The script had to run close to the workload in the cluster.

I’m lazy and having to build and push a Docker container with my script would be a lot of extra work.

Luckily, thanks to K8S config maps and to Bundler inline mode, this can be achieved without having to build a custom container.

First, let’s create a config map with our code:

apiVersion: v1
kind: ConfigMap
metadata:
  name: load-generator
data:
  writer.rb: |
    require 'bundler/inline'
    gemfile do
      source 'https://rubygems.org'
Hint Blog Feed 

Test Like You Fly - Basics

In Test Like You Fly - Part 1 - Introduction we discussed the characteristics of TLYF as a practice. Let's dive right into the basics.

The examples will use Ruby as the language, but should be generic enough to apply to any systems in most any modern language. Unlike Ruby with its duck-typing approach, some technical issues are off the table for statically-typed or type-enforced languages. YMMV, but the concepts are the same.

Principles

All strategies are founded on principles. TLYF is no different.

  • Ensure the developer is not the only tester/reviewer
  • Measure code coverage - what is measured improves
    • Skip spec/factory directories when measuring coverage - they are either 100% covered or will bias…
Awesome Ruby Newsletter 

💎 Issue 270 - Using VCR to Mock Your Requests by Ana Schwendler

Honeybadger Developer Blog 

Backend JavaScript News Brief (Q2 2021)

Honeybadger's quarterly briefings keep you up to date on the most important developments in your programming communities. We curate the news so you can spend more time focusing on what's really important.

  • Events: Conferences and meetups. Upcoming and recently completed.
  • Security: Recent vulnerability reports
  • Projects: News about major community projects
  • Trending Topics: Summaries of the big topics everyone's talking about
  • Standout Content: Content that didn't fit in other sections, but that was too cool to leave out.

Events

iJS NEW YORK HYBRID 2021 on Sep 27-30

The International JavaScript Hybrid Conference takes place in New York this year, with topics varying on JavaScript practices…

Honeybadger Developer Blog 

Ruby News Brief (Q2 2021)

Honeybadger's quarterly briefings keep you up to date on the most important developments in your programming communities. We curate the news so you can spend more time focusing on what's really important.

  • Events: Conferences and meetups. Upcoming and recently completed.
  • Security: Recent vulnerability reports
  • Projects: News about major community projects
  • Trending Topics: Summaries of the big topics everyone's talking about
  • Standout Content: Content that didn't fit in other sections, but that was too cool to leave out.

Events

RailsConf 2021 on Apr 12 - 15

RailsConf is the world’s largest and longest-running gathering of Ruby on Rails enthusiasts, practitioners, and companies. For Rails…

Honeybadger Developer Blog 

Frontend JavaScript News Brief (Q2 2021)

Honeybadger's quarterly briefings keep you up to date on the most important developments in your programming communities. We curate the news so you can spend more time focusing on what's really important.

  • Events: Conferences and meetups. Upcoming and recently completed.
  • Security: Recent vulnerability reports
  • Projects: News about major community projects
  • Trending Topics: Summaries of the big topics everyone's talking about
  • Standout Content: Content that didn't fit in other sections, but that was too cool to leave out.

Events

JSCAMP Virtual on 15-16 July 2021

An International two-day conference all about JavaScript topics including WebAssembly, React, TypeScript, debugging, 2021…

Honeybadger Developer Blog 

PHP News Brief (Q2 2021)

Honeybadger's quarterly briefings keep you up to date on the most important developments in your programming communities. We curate the news so you can spend more time focusing on what's really important.

  • Events: Conferences and meetups. Upcoming and recently completed.
  • Security: Recent vulnerability reports
  • Projects: News about major community projects
  • Trending Topics: Summaries of the big topics everyone's talking about
  • Standout Content: Content that didn't fit in other sections, but that was too cool to leave out.

Events

phpday 2021 on Jun 8-9

phpday is the yearly gathering for the European PHP community, since 2003. The event is international and all sessions will be in English.…

Honeybadger Developer Blog 

Go News Brief (Q2 2021)

Honeybadger's quarterly briefings keep you up to date on the most important developments in your programming communities. We curate the news so you can spend more time focusing on what's really important.

  • Events: Conferences and meetups. Upcoming and recently completed.
  • Security: Recent vulnerability reports
  • Projects: News about major community projects
  • Trending Topics: Summaries of the big topics everyone's talking about
  • Standout Content: Content that didn't fit in other sections, but that was too cool to leave out.

Events

Gophercon 2021 12/5/2021 - 12/8/2021

GC21 will be in-person at the Marriott Marquis San Diego Marina. With rooming and programming under one roof; we're excited to…

Honeybadger Developer Blog 

Python News Brief (Q2 2021)

Honeybadger's quarterly briefings keep you up to date on the most important developments in your programming communities. We curate the news so you can spend more time focusing on what's really important.

  • Events: Conferences and meetups. Upcoming and recently completed.
  • Security: Recent vulnerability reports
  • Projects: News about major community projects
  • Trending Topics: Summaries of the big topics everyone's talking about
  • Standout Content: Content that didn't fit in other sections, but that was too cool to leave out.

Events

EuroPython 2021 on Jul 26 - Aug 1 (online)

The largest Python Conference in Europe.

  • Jun 29: special discounts on business tickets for company teams.
  • Jun 25:…
Ruby Weekly 

Benchmarking your Ruby code

#​562 — July 22, 2021

Read on the Web

Ruby Weekly

Benchmarking Your Ruby with time_uptime_up is a new benchmarking gem that makes creating multiple timers as easy as clicking a stopwatch. The gem also has some nice printing and display capabilities. Time to try it out…

Justin Searls

Fullstaq Ruby: A Production-Optimized CRuby Distribution — We featured this alternative CRuby/MRI-based Ruby distribution over a year ago when it was new, but it’s now been updated with Ruby 3.0.2, 2.7.4, and 2.6.8 variants. The basic idea is memory allocation is jemalloc-based which can yield big benefits in production…

Hongli Lai

Try Scout’s New Error Monitoring…

Long live Ruby 

Multiline puts with one-liner

Saeloun Blog 

React 18 adds automatic batching

Batching is a React feature that combines all the state updates into a single update, causing a single re-render thereby improving the performance of the app. In earlier versions of React, batching was only done for the event handlers.

Before

Let’s take the following example

import React, { useState } from "react";

export default function App() {
  const [counter1, setCounter1] = useState(0);
  const [counter2, setCounter2] = useState(0);

  const handleClick = () => {
    setCounter1(counter1 + 1);
    setCounter2(counter2 + 1);
  }

  console.log('Rerendered');

  return (
    <div className='App'>
      <button onClick={handleClick}>Click me</button>
    </div>
  );
}

On clicking the…

Justin Collins' Blugh 

Rails 6.1 SQL Injection Updates

Since early 2013, I have been maintaining rails-sqli.org, a collection of Rails ActiveRecord methods that can be vulnerable to SQL injection.

Rails 6 has been out since December 2019, but sadly the site has been missing information about changes and new methods in Rails 6.

As that deficiency has recently been rectified, let’s walk through what has changed since Rails 5!

delete_all, destroy_all

In earlier versions of Rails, delete_all and destroy_all could be passed a string of raw SQL.

In Rails 6, these two methods no longer accept any arguments.

Instead, you can use…

delete_by, destroy_by

New in Rails 6, delete_by and destroy_by accept the same type of arguments as where: a Hash,…

The Ruby on Rails Podcast 

Episode 376: Technically Speaking (Brittany and Jemma)

Jemma's debut as a co-host on The Ruby on Rails Podcast! Brittany and Jemma discuss WNB.rb's upcoming Fireside Chats about Technical Speaking and how Jemma is approaching the event as a moderator. Brittany shares her experience onboarding three (!) new Junior developers at TextUs and they both discuss how the approach writing and submitting talks. Lastly, they talk about setting engineering cultures within teams.

Show Notes & Links:

Sponsored By:

Scout APM

Try their error monitoring and APM free for 14-days, no credit card needed! And as an added bonus for Ruby on Rails listeners: Scout will donate $5 to the open-source…

Notes to self 

Elixir Authorization Plugs

Similar to Ruby’s Rack, Plug is a general specification for composing modules between web applications and application servers. Here’s how we can use them to build authorized pipelines in your router.

Note that this post is not about whether you should do authorization at the router level. It’s likely you’ll do it as part of your business logic for the most part. But when it makes sense, you can use Plugs.

Authorization plug is a genetic plug, but one that might need to stop the execution of the request. If we import Plug.Conn we can pipe to halt/1 to do exactly that. We should also render a custom error message.

I’ll demonstrate by checking claims from a Guardian token and compare them…

All Ruby Podcasts by Devchat.tv 

Building with Just What You Need Using Roda with Jeremy Evans - RUBY 507

Jeremy Evans, author of the Roda framework, joins the Rogues to talk about how to use Roda to build Ruby web applications.

Roda is a super lightweight framework that adds features through plugins to give you the power you need when you need it to build your applications. This allows you to bring in only what you need in order to get fast and easy to maintain code.

Panel

  • Charles Max Wood
  • Dave Kimura 
  • Luke Stutters

Guest

  • Jeremy Evans

Sponsors

Links

Greater Than Code 

242: Considering The Social Side of Tech with Trond Hjorteland

01:20 - The Superpower of Sociotechnical System (STS) Design: Considering the Social AND the Technical. The social side matters.

09:14 - The Origins of Sociotechnical Systems

18:42 - Design From Above vs Self-Organization

  • Participative Design
  • Idealized Design
  • Solving Problems is not Systems…

29:39 - Systemic Change…

Ruby Together News 

June 2021 Monthly Update

Hello! Welcome to the monthly update. During June, our work was supported by Zendesk, DigitalOcean, Stitch Fix, and many others.

ruby together news

In June, Ruby Together was supported by 40 different companies and 108 developer members. Thanks to all of our members for making everything that we do possible. <3

rubygems & bundler news

This month in RubyGems, we released new versions for Bundler 2.2.20 and 2.2.21 and RubyGems 3.2.20 and 3.2.21.

RubyGems shipped a security fix for possible malicious code execution from @sonalkr123.

In Bundler, we worked on improving the seamless migration of insecure lock files by automatically dealing with them when possible instead of printing a…

AkitaOnRails.com 

[Akitando] #102 - Entendendo Sistemas de Arquivos: FAT

DESCRIÇÃO

Como seus programas sabem onde encontrar arquivos no HD? Como diretórios e arquivos são organizados?

Conteúdo

  • 00:00 - Intro
  • 00:47 - Revisando sobre Cartuchos
  • 03:46 - Sprites em Arquivos?
  • 06:24 - Primeiros Sistemas de Arquivos
  • 09:12 - Anos 80: Tudo incompatível
  • 09:34 - Revisando MBR
  • 12:55 - FAT12
  • 15:42 - FAT16
  • 16:37 - Windows 95 - Nomes Longos
  • 17:48 - Introdução a Bit Vector
  • 19:28 - VFAT
  • 21:09 - FAT32
  • 22:03 - Microsoft e IBM
  • 23:23 - IDE, SATA, AHCI, etc
  • 25:15 - HPFS ao NTFS e HFS
  • 25:53 - B+Tree
  • 27:28 - Resource Fork e Alternate Streams

Links

  • Design of the FAT file system (https://en.wikipedia.org/wiki/Design_of_the_FAT_file_system)
  • A Disk Editor View of the NTFS Boot…
Rails with Jason 

104 - Nick Agliano, Software Engineer

In this episode, Nick Agliano and I discuss finding your first programming job, infrastructure, and AWS.

Saeloun Blog 

Rails 7 allows loading nested locales in the engine

If we want to have multiple languages for our Rails application, I18n will be the standard way to do it.

Rails internationalization (I18n) provides a neat API to ensure creating an application that can be accessible to various parts of the world by providing translations and localizations for languages.

The way to use I18n is by adding locales inside the config/locales directory. By default, we already have en.yml for all our English translations. If we want to add Spanish translations, we could add es.yml translations inside the config/locales directory.

Once the application scales, our translation files become too large and will need to be split into multiple files for better…

The Bike Shed 

301: Ants in the Cookie Store

What do you get when you mix a worm and a hammerhead shark? Also ants. Steph made some cool new discoveries in bug-land. She also talks about deploys versus releases and how her and her team has changed their deploy structure. Two words: feature flags.

Chris talks about cookies: cookie sessions, cookie payloads, cookie footprints, cookie storing. Mmm cookies! The convo wraps up with lamenting over truthiness in code. Truthy or falsy? What's your call?

Transcript:

STEPH: At the top of my notes for today, I have marauder ants and hammerhead worms. [laughs]

CHRIS: I'm sorry, what? I lost you there for...not lost you, but I stopped…

Test Double Blog 

Benchmarking your Ruby with time_up

If you were losing a lot of time to distractions and wanted to start spending more of your day focused on what matters, you might start with a personal time-tracking tool like RescueTime, Toggle, or Daily, to measure and understand where your time was going.
Riding Rails 

Performance and parallel testing improvements and more!

Hi, this is Greg, bring you the latest news of the Rails world. It’s been a quiet week, so we don’t have much changes to cover this time.

Fix try and try! performance slowdown in Ruby 2.7+

This PR fixes a performance regression in try and try! under ruby 2.7+.

Fix eager_loading? when ordering with Hash syntax

After this change, eager_loading? is triggered correctly when using order with hash syntax on an outer table, instead of raising an error.

Parallelize tests only when there are enough to justify the parallelization overhead

Parallelizing tests has a cost in terms of database setup and fixture loading. This change makes Rails disable parallelization when the number of tests is…

Josh Software 

React native vs Flutter

Programmers fall into a dilemma while choosing the right platform for product development. Nowadays, there are several different technologies available for App development. Among all, the most popular is Flutter and React native. Today we will be comparing these technologies in terms of various aspects given below. Learning curve Installation setup UI building State management … Continue reading React native vs Flutter
Honeybadger Developer Blog 

Building a Documentation Workflow in Rails

Modern documentation workflows are becoming increasingly intertwined with the software development workflow. You might track documentation issues in GitHub or Jira, or you might write docs in code comments or Markdown files. The developers on your team might be working directly with technical writers, or they might be writing docs independently. Docs are often stored in code repositories, tested for quality using linters, and published continually on static sites. Technical writers have recently coined the term docs-like-code or docs-as-code to describe this type of workflow.

Docs-as-code is defined by automation. It involves creating, updating, reviewing, and approving documentation using…

Truemark Technology 

Update Multiple Records at Once in Rails

Rails provides a built-in create method for adding multiple records in single line of code or in more technical term "batch create". For update, if we want to update attributes with same value for all available records then we can do so with the method update_all. But what if we want to update multiple attributes at once and for multiple records? How do we "batch update" in Rails?

We will be looking at the answer to that question today in this blog.

For updating multiple records at once, there may be two cases; when we want to update

  • Same attribute/s in all rows
  • Different attributes in each row

Update same attribute/s in all rows

To update same attributes with same values…

Test Double Blog 

Double Agent Profile: Minnie Lee

Name: Minnie Lee Designation: Agent 0079 Double Agent Role: Senior Software Consultant Special Skills: Project management, research, and a deep curiosity for the sociology of human behavior and what that looks like in a team.
Remote Ruby 

How Chris and Andrew Became 10X Black Hats

[00:00:51] Chris gives a shout-out to Adam McCrea, the Developer behind the Rails
Autoscale for Heroku, and how he grew the product over the course of three years and
had $300,000 in annual revenue. He was recently talking about it on an episode of
“Startups For the Rest of Us.”

[00:02:21] The guys talk about feeling burnt out, Chris going on vacation in two weeks,
Andrew needing a massage or float therapy, and good books to read.

[00:08:48] Andrew tells us he is slowly working his way through meta programming
Ruby and starting to read how to take smarter notes.

[00:11:12] The topic here is about taking good notes. Learn about a cool app that
Andrew likes to use for quick capture called…

Brandon Weaver 

Let's Read – Polished Ruby Programming – Ch 2

Polished Ruby Programming is a recent release by Jeremy Evans, a well known Rubyist working on the Ruby core team, Roda, Sequel, and several other projects. Knowing Jeremy and his experience this was an instant buy for me, and I look forward to what we learn in this book.

You can find the book here:

https://www.packtpub.com/product/polished-ruby-programming/9781801072724

This review, like other "Let's Read" series in the past, will go through each of the chapters individually and will add commentary, additional notes, and general thoughts on the content. Do remember books are limited in how much information they can cram on a page, and they can't cover everything.

With that said let's…

Hint Blog Feed 

Senior Engineer

Hi There!

We’re looking for good humans who strive to write good code. We have a preference for folks with Ruby on Rails and/or React experience, but if you understand how to write good software, are hungry to learn, and hungry to help, we want to hear from you!

Please email your resume and a short cover letter telling us about yourself to join@hint.io. We'll get back to you within a week or so to start our selection process. An actual human reviews every resume and we don’t ghost our candidates. Even if you’re not the right fit right now, we’ll let you know.

Your Role

Hint Developers work on self-managed teams of 2-4 developers based on client needs. Teams are project-based, so you'll get to…

Hint Blog Feed 

Is your team struggling to ship code?

At first, it was easy. The future was bright. But the codebase grew, and so did the team. Instead of shipping features, they're fixing regressions, and now the business team is wondering, "what happened?".

Sound familiar? It's a typical story. Before you can scale your Rails application any further, you have some housekeeping to do. The problem is that finding the time is nearly impossible at this stage. We can help.

Onboarding new developers taking forever?

Every new-hire can ship code on their first day on the job. We'll automate everything we can and document the rest.

  • Create a fine-tuned development environment with Docker that is fast on macOS and Windows too.
  • Utilize all the power of VS…
Hint Blog Feed 

DevOps Engineer

Hi There!

We’re looking for good humans who strive to write good code. We have a preference for folks with Ruby on Rails and/or React experience, but if you understand how to write good software, are hungry to learn, and hungry to help, we want to hear from you!

Please email your resume and a short cover letter telling us about yourself to join@hint.io. We'll get back to you within a week or so to start our selection process. An actual human reviews every resume and we don’t ghost our candidates. Even if you’re not the right fit right now, we’ll let you know.

Your Role

Hint Developers work on self-managed teams of 2-4 developers based on client needs. Teams are project-based, so you'll get to…

Hint Blog Feed 

Delivery Lead

Hi There!

We’re looking for good humans who strive to write good code. We have a preference for folks with Ruby on Rails and/or React experience, but if you understand how to write good software, are hungry to learn, and hungry to help, we want to hear from you!

Please email your resume and a short cover letter telling us about yourself to join@hint.io. We'll get back to you within a week or so to start our selection process. An actual human reviews every resume and we don’t ghost our candidates. Even if you’re not the right fit right now, we’ll let you know.

Your Role

Hint Developers work on self-managed teams of 2-4 developers based on client needs. Teams are project-based, so you'll get to…

Awesome Ruby Newsletter 

💎 Issue 269 - Complex Ruby transformations made simple with dry-transformer!

Brandon Weaver 

Let's Read – Eloquent Ruby – Ch 2

Perhaps my personal favorite recommendation for learning to program Ruby like a Rubyist, Eloquent Ruby is a book I recommend frequently to this day. That said, it was released in 2011 and things have changed a bit since then.

This series will focus on reading over Eloquent Ruby, noting things that may have changed or been updated since 2011 (around Ruby 1.9.2) to today (2021 — Ruby 3.0.x).

Note: This is an updated version of a previous unfinished Medium series of mine you can find here.

Chapter 2. Chose the Right Control Structure

This chapter covers the use of control structures in Ruby like if, unless, and other branch type methods.

If, Unless, While, and Until

Mike Perham 

On Multi-Platform Docker images

Until recently, Faktory only supported the x86_64 platform. With the rise of the Apple Silicon chip and AWS Graviton, it was obvious that I would need to roll out ARM64 support soon. This week I spent several days fighting Docker’s support for multi-platform images and wanted to document what I learned. Faktory OSS The Faktory OSS build was relatively straightforward, with three steps for each platform: Build the ./faktory binary on the host.
Ruby Weekly 

GitHub brings cross-cluster associations to Rails 7

#​561 — July 15, 2021

Read on the Web

Ruby Weekly

Adding Support for Cross-Cluster Associations to Rails 7 — Engineers at GitHub have been working on a new Rails feature coming in Rails 7.0: support for handling associations across database clusters. We also get to learn GitHub uses 30 databases (15 primaries and 15 replicas) with its Rails monolith.

Eileen M. Uchitelle (GitHub)

A Comparison of Ruby Version Managers for macOS — You’ve likely heard of most of the managers here (RVM, rbenv, chruby, maybe asdf) but Frum (Rust-based) was new to us. Each manager is briefly explained here along with the…

Daniel Kehoe

Fast…

RubyGems Blog 

3.2.24 Released

RubyGems 3.2.24 includes bug fixes and documentation.

To update to the latest RubyGems you can run:

gem update --system

To install RubyGems by hand see the Download RubyGems page.

## Bug fixes:

  • Fix contradictory message about deletion of default gem. Pull request #4739 by jaredbeck

## Documentation:

  • Add a description about GEM_HOST_OTP_CODE to help text. Pull request #4742 by ybiquitous

SHA256 Checksums:

  • rubygems-3.2.24.tgz
    94e9f8f8f5177df461037aeb1f968bd7b952e6781a82348e367e10a0c040ce25
  • rubygems-3.2.24.zip
    57a20237fb7937be2fe4bbd7ebf8c7562da11700db156c1efa1cad2b09ca59c8
  • rubygems-update-3.2.24.gem
    c87ae12e7de8ecdd655ffcd59675cc901aa564d2488c332dc7b39fc61f233d8d
Saeloun Blog 

React 18 introduces new root API ( ReactDOM.createRoot )

React 17 released in August 2020, didn’t bring new features but built a foundation for seamless adoption of future updates. The React team has recently announced the plan for React 18 and published React 18 Alpha to give it a try and provide feedback.

One of the most important changes in React 18 is the introduction of the new root API ( ReactDOM.createRoot ).

Before going into the details of the new API, let’s check out the existing root API.

The Root API

In React, we render our App component into the root element on the page. Here we are using a simple example similar to the one used in the original discussion.

import ReactDOM from 'react-dom';
import App from 'App';

const contai…
Jemma Issroff 

NHL Time on Ice Visualizations: 2020-2021 Season

#vizDefenseman { width:100%; height: 900px; border: 1px solid gray; } #vizForward { width:100%; height: 900px; border: 1px solid gray; }

These interactive graphs are best viewed on a laptop. They’ll take a few seconds to load. Zoom and click around on the players for more info!

Defensemen

Forwards

Interpreting the graphs

These graphs represent shared ice time in the NHL during the 2020-2021 season. There is one graph for defensemen and one for forwards.

Nodes:

  • Each node is a player
  • Clicking on the node gives more information about the player (ice time is in minutes)
  • S…
Jemma Issroff 

Running Specific specs with RSpec

This was the tip of the week in the July 8, 2021 Ruby Weekly Newsletter.


Sometimes when writing Ruby tests with RSpec we want to run the whole test suite. Other times, we want to run only specific tests. Here are a few different ways to only run part of a test suite:

–fail-fast flag

Running a spec file or full test suite with the --fail-fast flag will stop the tests at the first failure. For example: rspec spec --fail-fast will complete fully only if there are no failures in the suite. This can be helpful for large suites.

–example (-e) flag

The --example (or -e) flag takes a string argument and runs only examples whose names include the argument.

For example, if we had this spec…

The Ruby on Rails Podcast 

Episode 375: A Technical CTO with Frank Lamantia

Brittany and Brian are joined with Frank Lamantia, CTO for Bold Penguin. His background is in software engineering; he likes to call himself a recovering Java developer. He runs product management, software engineering, cloud & site-reliability engineering, information security, and internal IT. The trio discuss the recent Bold Penguin feature on the Stack Overflow Podcast and Bold Penguin's hiring practices.

Show Notes & Links:

Sponsored By:

Scout APM

Try their error monitoring and APM free for 14-days, no credit…

Saeloun Blog 

Rails 7 adds support for `if_exists/if_not_exists` on `remove_foreign_key/add_foreign_key`

Rails 6.1 added support for if_exists/if_not_exists on remove/add column and extended it further to support if_not_exists on add_index and if_exists on remove_index.

To maintain the same behavior across add/remove constraints of databases, Rails 7 added support for if_exists/if_not_exists on remove_foreign_key/add_foreign_key.

Before Rails 7

Add foreign key

Let’s say we have an e-commerce application with Order and User models. An order belongs to a user, and we want to add a user_id foreign key constraint on the orders table. We would add a migration as shown below:

class AddUserReferenceToOrder < ActiveRecord::Migration[6.0]
  def change
    add_foreign_key :orders, :users
  end
end
All Ruby Podcasts by Devchat.tv 

What's Cooking in Rails 7 featuring Jason Dinsmore - RUBY 506

Jason Dinsmore went spelunking through the changelogs for Rails and pulled out the latest features for the most popular Ruby web development framework.

Jason and the Rogues go through the changes and discuss the upcoming changes in Rails 7.

Panel

  • Charles Max Wood
  • Darren Broemmer
  • Dave Kimura
  • John Epperson
  • Luke Stutters

Guest

  • Jason Dinsmore

Sponsors

Links

Picks

Rails with Jason 

103 - From Junior to Intermediate with Aweys Ahmed

In this episode, Aweys Ahmed and I discuss life as a junior developer, leveling up your skill set, and how to market yourself as a job candidate.

Saeloun Blog 

Rails 7 MySQL adapter improves the security of untyped bound values

Databases like MySQL, SQLServer have typecasting as a default feature for comparison operations. This opens ActiveRecord up for potential vulnerabilities.

To illustrate, consider the SQL query below.

Example: Typecasting

SELECT "556" = 556;

# Returns 1 for match

In the above case, 556 of the type string is converted to an integer for comparison with the right-hand value 556 of the type integer.

To illustrate clearly, a more explicit typecasting can be done as below.

Example: Explicit Typecasting

SELECT CONVERT( "556", UNSIGNED INTEGER) = 556

# Returns 1 for match

Example: Explicit Typecasting

In case the string is not a valid number, it is type-casted to an integer with the…

The Bike Shed 

300: Mozzarella Sticks & Knowledge Silos

The big "Three Oh Oh!" What a milestone for this podcast! Aside from celebrating that the show has made it this far, Chris gives some followup on some Inertia.js issues he had been having, and talks about open source licenses and legality and testing against external APIs. Steph has thoughts on mozzarella sticks and what makes good ones; particularly the cheese to bread ratio...

They then, together, answer a listener question re: knowledge silos:

Jan asked, "Our team (3 pairs) is currently working on two different projects due to that fact we are creating information silos. Now we are looking into ways how we can minimize those information silos. Do you have any ideas how we…

Hint Blog Feed 

Test Like You Fly - Intro

I practice TLYF.

In contrast to all the other important test methodologies, "Test Like You Fly", or TLYF for short, emphasizes testing to find fundamental flaws in a system that will prevent it from performing the mission. Most testing methodologies strive to confirm that requirements - the input to our designs - are being met by the system as written.

TLYF is all about confirming that the system - as a whole - will operate in the environment it is designed to operate, the environment we typically refer to as "live" or "production". It is vitally important to find what doesn’t perform as expected and to understand the reasons for this anomalous behavior, especially where such defects can…

Long live Ruby 

Generate array of alphabet

RubySec 

CVE-2021-32740 (addressable): Regular Expression Denial of Service in Addressable templates

Within the URI template implementation in Addressable, a maliciously crafted template may result in uncontrolled resource consumption, leading to denial of service when matched against a URI. In typical usage, templates would not normally be read from untrusted user input, but nonetheless, no previous security advisory for Addressable has cautioned against doing this. Users of the parsing capabilities in Addressable but not the URI template capabilities are unaffected.
Code with Jason 

How to have a productive programming day

Why productivity is desirable

The way I look at productivity is this: if I have to be at work all day, I might as well get as much done in that chunk of time as I can.

It’s not about running myself ragged. It’s not about “hustling”. It’s simply about not being wasteful with my time.

In fact, my goal is to accomplish more than other developers do, but with less time and effort.

Why bother being productive? Because the more work I’m able to get done, the faster I’ll be able to learn, the smarter I’ll get, the better my job will be, the better my career will be, the more money I’ll earn, and so on. And if none of that even requires more effort than being less productive, it’s an obvious win.

H…

Hanami Mastery newest episodes! 

Why I'm giving so much appreciation everywhere?

People seem to be surprised being mentioned in my articles, tweets, videos, or when I send a personal 'thank you' email. I've decided to sort it out here...
EquiValent 

Rails Active Storage CDN

Ruby on Rails Active Storage there is posibility to configure CDN.

Set up Rails

# config/environments/staging.rb
Rails.application.configure do
  # ...
  config.x.cdn_host = 'https://myapp-stg.b-cdn.net'
  config.active_storage.resolve_model_to_route = :cdn_proxy
  # ...
# config/environments/production.rb
Rails.application.configure do
  # ...
  config.x.cdn_host = 'https://myapp-prod.b-cdn.net'
  config.active_storage.resolve_model_to_route = :cdn_proxy
  # ...
# config/environments/test.rb
# ..
# no changes
# ..
# config/environments/development.rb
# ..
# no changes
# ..
# config/routes.rb
# ...
  direct :cdn_proxy do |model, options|
    if model.respond_to?(:signed_id)
    …
Truemark Technology 

Override Default Date Format in Rails Admin

Rails Admin is a Rails engine that provides an easy-to-use interface for managing your data. It's perfect for the cases where we want admin dashboard quickly for CRUD (Create, Read, Update and Delete) operations.

When using engines, it can be difficult to override its default behavior. It was the same case for overriding the default date format. It was tricky as I didn't know exactly where to look at.

After some research, I found out that Rails Admin uses long date and time format from the locale. We can check the related code in official gem repository.

Line for the exact code may change in the future, if it has, you can search for the code below:

  register_instance_option…
Honeybadger Developer Blog 

Refactoring Your Rails App With Service Objects

A service object is a Ruby object that performs a single action. It encapsulates a process in your domain or business logic. Imagine that you need to create a book instance in an imaginary library application; in a plain Rails app, you'd do the following:

class BookController < ApplicationController
  def create
    Book.new(*args)
  end
end

This is fine for simple things. However, as the app grows, you may end up with lots of boilerplate surrounding it:

class BookController < ApplicationController
 def create
    default_args = { genre: find_genre(), author: find_author() }
    Book.new(attrs.merge(default_args))
 end

 private

 def find_genre
   // ...
 end

  def find_author
   // ...

Service objects allow you to abstract this behavior into a separate class. Then, your code becomes simple again:

class BookController < ApplicationController
  def
    BookCreator.c…

Why You Need Service Objects

Rail…

Long live Ruby 

Invoke rake task from Rails console

Riding Rails 

Rails 6.1.4 and plenty of developer UX goodies

Hi, zzak again with the changes from the last week in Rails.

Rails 6.1.4 was released

This release includes many bug fixes so be sure to upgrade! You can read the full summary of changes here.

Deleting an item from the Middleware stack should raise if the item is not found

A bug was fixed when trying to remove a non-existent middleware off the stack.

Generators should raise an error if an attribute has an invalid index

An error is now raised in bin/rails when trying to generate a model with a misspelled “index” attribute.

config_for accepts root shared as an array

A bug was fixed when using config_for with a shared config that is defined as an array.

Handle error when file does not…

RubyGems Blog 

June 2021 RubyGems Updates

Welcome to the RubyGems monthly update! As part of our efforts at Ruby Together, we publish a recap of the work that we’ve done the previous month. Read on to find out what updates were made to RubyGems and RubyGems.org in June.

RubyGems News

This month in RubyGems, we released new versions for Bundler 2.2.20 and 2.2.21 and RubyGems 3.2.20 and 3.2.21. The release for RubyGems included a security fix contributed by Aditya, and Bundler release ships with several fixes and improvements.

We also worked on improving the seamless migration of insecure lock files by automatically dealing with them when possible instead of printing a warning and still installing them - #4647 and #4683.

We also…

Josh Software 

Svelte and Sapper — Initial thoughts after a course by Rich Harris (the creator of Svelte) and a mini project

I recently completed 2 courses on Svelte and Sapper — one by Rich Harris on Frontend Masters and another on Udemy. I built a mini project using Svelte and recreated it in Sapper — here are my first thoughts. What I loved Syntax — the syntax is soooo much leaner! There’s very little boiler plate … Continue reading Svelte and Sapper — Initial thoughts after a course by Rich Harris (the creator of Svelte) and a mini project
Brandon Weaver 

Let's Read – Eloquent Ruby – Ch 1

Perhaps my personal favorite recommendation for learning to program Ruby like a Rubyist, Eloquent Ruby is a book I recommend frequently to this day. That said, it was released in 2011 and things have changed a bit since then.

This series will focus on reading over Eloquent Ruby, noting things that may have changed or been updated since 2011 (around Ruby 1.9.2) to today (2021 — Ruby 3.0.x).

Without further ado, let’s get started!

Note: This is an updated version of a previous unfinished Medium series of mine you can find here.

Chapter 1 — Write Code That Looks Like Ruby

We start in with an introduction on writing code that looks and feels like Ruby.

The Very Basic…

BigBinary Blog 

React 18 introduces Automatic Batching

Earlier versions of React batched multiple state updates only inside React eventhandlers like click or change to avoid multiple re-renders and improveperformance.

React 18 adds automatic batching for all use cases to improve performance evenfurther. Now, React batches state updates in React events handlers, promises,setTimeout, native event handlers and so on.

Let's jump into an example to understand different use cases of batching.

In these examples we are assuming that you already replaced render withcreateRoot API. Automatic batching only works with createRoot API. Pleasecheck this discussion tolearn more about replacing render with createRoot.

We're using simplest example, also used in theo…

RubyGems Blog 

3.2.23 Released

RubyGems 3.2.23 includes enhancements.

To update to the latest RubyGems you can run:

gem update --system

To install RubyGems by hand see the Download RubyGems page.

## Enhancements:

  • Rewind IO source to allow working with contents in memory. Pull request #4729 by drcapulet

SHA256 Checksums:

  • rubygems-3.2.23.tgz
    7a35de5be271b2c18076e87a2a9b50a7f2aefe3e0219aa9f028af05b45870a48
  • rubygems-3.2.23.zip
    8877b316493345f447d19e3cdab3e6e6e9503752cb178a11cd4c3a7672fdd92e
  • rubygems-update-3.2.23.gem
    5c62672fbd7d785a5d1c5fa2104ebb3779b64c5e654713b58f8733308610df2b
Hanami Mastery newest episodes! 

#6 Complex Ruby Transformations made simple with Dry::Transformer

Have you ever need to stringify keys outside of rails? Whether you want to import or export CSVs or communicate with external services you may need to parse the input to different output. 'dry-transformer' can help you with it.