Rubyland

news, opinion, tutorials, about ruby, aggregated
Sources About
Hi, we're Arkency 

Painless Rails upgrades

Sooner or later your Rails application will require an upgrade of the framework itself. There are many reasons behind that. Bugs, incompatibility with modern libraries, or the worst: the version you use will no longer receive security updates. Living on the edge might be tempting, but it can also end badly for the business which relies on the application. User data leak, frauds, this all can simply lead to serious legal and financial issues.

Upgrade all the things

At Arkency we mostly work with legacy applications. Customers that we tend to cooperate with are successful businesses. They often need assistance with improving existing codebase, implementing new business features, and rather…

Remote Ruby 

Andrew needs a job and TailwindCSS ViewComponents

[00:01:03] Andrew fills us in on being laid off from his job and he talks about how his job search is going. 
[00:09:32] Jason asks Andrew how the interviewing process has been going and if he’s had to do any whiteboarding. Andrew tells us what he’s had to do for some interviews. 
[00:14:32] Andrew tells us he’s been redoing his website with BridgetownRB, Tailwind, and little bit of Stimulus. He also mentions Tailwind Builder and what it does. He gives a s/o to Jared White from BridgetownRB who was recently on this podcast. 
[00:20:26] Jason talks about using a Jekyll Tailwind starter kit and working on his Field Help app which he wants to launch now. Andrew tells us about a blog post…
Awesome Ruby Newsletter 

💎 Issue 215 - AnyCable 1.0: Four years of real-time web with Ruby and Go

Ruby Weekly 

A proposed new syntax for struct literals

#508 — July 2, 2020

Read on the Web

Ruby Weekly

A Syntax for Anonymous Struct Literals — A proposed new Ruby feature where ${a:1, b:2} would be roughly equivalent to Struct.new(kw.keys).new(kw.values) (where kw is {a:1, b:2}) which may be more practical in situations where you’d use a hash now. There’s already a pull request to bring this to Ruby.

Koichi Sasada

Writing Better, Type-Safe Code with Sorbet — The initial Sorbet hype has abated, so now we’re into the Real World Examples phase. Here are four such examples that had me wishing I had interned at Shopify.

Shopify Engineering

CI/CD with…

RubyMine – RubyMine Blog | JetBrains 

RubyMine 2020.2 EAP5: New Inspections Widget, Problems View, Improved Git Actions Dialogs, and More

RubyMine 2020.2 EAP5 is now available! Here are the main highlights in this build:

A new way to review problems in your code

RubyMine 2020.2 comes with a new Inspections Widget. This widget provides information about the number of warnings, errors, and other issues in the current file.

The widget is located in the top-right corner of the editor. It shows the number of issues in the current file, and the arrows on the right make it easy to navigate between them.

New inspections widget

You can also configure the highlighting directly inside the widget, choosing between None, Errors Only, and All Problems.

This build also adds a new Problems…

JRuby.org News 

JRuby 9.2.12.0 Released

The JRuby community is pleased to announce the release of JRuby 9.2.12.0

JRuby 9.2.x is compatible with Ruby 2.5.x and stays in sync with C Ruby. As always there is a mix of miscellaneous fixes so be sure to read the issue list below. All users are encouraged to upgrade.

As we are still actively working on 9.3.0.0 we decided to put out another 9.2.x release to fix some of the more recently reported issues.

Java Integration

  • The last remaining triggers of the “Illegal access” warnings and errors in JRuby core have been fixed. JRuby will avoid accessing Java modules and packages that have not been exported…
Honeybadger Developer Blog 

Understanding and Implementing Bubble Sort in Ruby

If you're a software engineer, I would bet that you spend a large portion of your time manipulating data. I personally spend quite a bit of time looking for a particular element. This often requires sorting and searching. Luckily, many of the popular programming languages, Ruby included, have methods to accomplish this built-in, so you don't really have to think about or know what's happening under the hood.

However, understanding the various searching and sorting algorithms is not an inconsequential endeavor. Performance matters, and showing a potential employer or your current manager that you understand the trade-offs of different sorting implementations might just tip the scale during…

OmbuLabs Blog 

Introducing Dash - An open source dashboard from OmbuLabs

At OmbuLabs we are always trying to find or create tools to help our processes and workdays run as smoothly and efficiently as possible. For the past few months we have been developing just such a tool, and recently we made it open source. Dash is a dashboard application written in Ruby on Rails that integrates open pull requests and issues from GitHub with Pivotal Tracker stories.

dash ombulabs

Why

We created this dashboard so that we can see a full list of our todos all in one spot. Dash allows the user to sync up to the latest information available on Github and Pivotal Tracker and see it all in one organized list. Sometimes it's difficult to keep track of the todos when they come from different…

Ruby on Rails Podcast 

324: Rails::Engine with Vladimir Dementyev

Vladimir Dementyev is a mathematician who found his happiness in programming Ruby and Erlang, contributing to open source and being an Evil Martian. He is the author of AnyCable, TestProf and an advocate for building monoliths with Rails Engines.

Links for this episode:

Brought to you by:

Raygun

Raygun gives you a…

Martian Chronicles, Evil Martians’ team blog 

AnyCable 1.0: Four years of real-time web with Ruby and Go

Author: Vladimir Dementyev, Lead Developer at Evil Martians

It is time to proudly announce the 1.0 release of AnyCable—a drop-in turbo-extension for Action Cable that relies on the same API and also works outside of Rails. It took me four years to turn a demented (last name pun intended) idea into a robust backbone for real-time Ruby applications. Discover new features, learn from our wins and fails, peek into the AnyCable’s future, and see how using Ruby and Go together gives you the best of both worlds!

AnyCable brings performance and scalability to real-time applications built with Ruby and Rails. It achieves that by moving low-level WebSocket handling from Ruby to Go but leaving…

Greater Than Code 

189: Succeeding in Science with Deborah Berebichez

01:13 - Debbie’s Superpower: Having an excellent memory and a detailed-oriented brain

03:23 - Teaching Science in Fun Ways

05:49 - Understanding Data & Data Literacy

15:16 - Negative Results Are Important (Failure)

Alfredo Motta 

Not So Random Software #32 – Confidence and decrypting cookies

Hello everyone and welcome back to Not So Random Software! This week’s links are about confidence, and how to avoid being fooled by it. Lastly, we are going to jump into the world of browser cookie decryption, something I dealt with it recently. Enjoy the random walk! A random article or paper Don’t blink; the ... Not So Random Software #32 – Confidence and decrypting cookies
Julia Evans 

entr: rerun your build when files change

This is going to be a pretty quick post – I found out about entr relatively recently and I felt like WHY DID NOBODY TELL ME ABOUT THIS BEFORE?!?! So I’m telling you about it in case you’re in the same boat as I was.

There’s a great explanation of the tool with lots of examples on entr’s website.

The summary is in the headline: entr is a command line tool that lets you run a arbitrary command every time you change any of a set of specified files. You pass it the list of files to watch on stdin, like this:

git ls-files | entr bash my-build-script.sh

or

find . -name *.rs | entr cargo test

or whatever you want really.

quick feedback is amazing

Like possibly every single programmer…

Julia Evans 

Tell candidates what to expect from your job interviews

In my last job, I helped with a few projects (like brag documents and the engineering levels) to help make the engineering culture a little more inclusive, and I want to talk about one of them today: making the interview process a little easier to understand for candidates.

I worked on this project for a few days way back in 2015 and I’m pretty happy with how it turned out.

giving everyone a little information helps level the playing field

Different tech companies run their interviews in very different ways, and I think it’s silly to expect candidates to magically intuit how your company’s interview process works.

It sucks for everyone when a candidate is surprised with an…

Valentino Gagliardi - RSS Feed 

Testing an HTML canvas with Cypress

Testing an HTML canvas with Cypress - Visual regression testing

What is a canvas?

An HTML canvas is an element which can be drawn on the page with JavaScript. Consider the following example:

A simple canvas

To draw this rectangle we use JavaScript on an HTML <canvas> element. HTML canvas are everywhere, from HTML games to charts. A popular chart library for JavaScript, Chart.js uses canvas to draw beautiful charts.

Canvas are great and all, but they're somewhat hard to test because of their nature. Let's see how to test a canvas in this quick guide.

Setting up the project

To start off create a new folder and move into it:

mkdir testing-canvas && cd $_

Initialize a new JavaScript project:

npm init -y

Inside the project…

Rails with Jason 

051 - Developer Productivity with Itamar Turner-Trauring

In this episode I talk with Itamar Turner-Trauring, author of The Secret Skills of Productive Programmers. We share a number of productivity tips including don't get stuck, don't work long hours, implement the riskiest part first, write down what you're working on, and much more.

All Ruby Podcasts by Devchat.tv 

RR 462: Graphiti, REST, and GraphQL with Lee Richmond

Lee Richmond is one of the primary developers behind the Graphiti library for Ruby. Lee describes Graphiti as the spiritual successor to ActiveResource. It provides a convenient way to provide an API that understands the object graph in your application without needing to resort to GraphQL.

Panel

  • Charles Max Wood
  • Dave Kimura
  • John Epperson
  • Luke Stutters
  • Matt Smith

Guest

  • Lee Richmond

Sponsors

Rails Remote Conf 2020

Links

Picks

Charles Max Wood:

Dave Kimura:

John Epperson:

The Official BigBinary Blog | BigBinary 

Rails 6.1 tracks Active Storage variant in the database

This blog is part of our Rails 6.1 series.

Active Storage variants are the transformation of the original image. These variants can be used as thumbnails, avatars, etc.

Active Storage generates variants on demand by downloading the original image. The image is transformed into a variant and is stored to the third party services like S3.

When a request to fetch a variant for an Active Storage object is made, Rails checks if the variant is already been processed and is already available on S3 or not. But to do so Rails has to make a call to find out if the variant is available on S3. This extra call adds to the latency.

Active Storage has to wait until the image variant check call is…

The Bike Shed 

250: To Infinity and Beyond

On this week's episode, Chris and Steph discuss the importance of using inclusive language, branching into new branch names, and strategies that encourage the use of inclusive terminology. Chris also shares his latest experience with merging two systems that were split apart back into one system, tackling conflicting foreign keys and competing auth libraries. Steph discusses using polling vs web sockets to monitor work being completed in a background job and communicating to the user the various states of success and failure.

Test Double | Our Blog 

Why functional?

The internet is full of information, mostly related to learning how to do something, but when it comes to software development, I feel the bigger question is why we should learn something.
Honeybadger Developer Blog 

Honeybadger Actions

We understand error management can be painful.

Incidents might leave you reeling with pages of faults to triage and either deal with or move to the wayside. How about that one persistent error that keeps alerting you, even though it's not affecting customers?

We've added a feature we call Actions to assist with error management, and it comes in two flavors:

Project Actions

Wouldn't it be nice to automatically assign errors to yourself or another team member? How about adding tags to specific error classes for better organization?

Project Actions give you the ability to do these things by allowing a custom set of defaults for your incoming errors.

Here at Honeybadger, we all wear many…

On the Edge of Ruby 

The Ruby Spec Suite Compatibility Report

Introduction

For a long time I wanted to show visually the compatibility of Ruby implementations with ruby/spec. This is not as easy as it sounds. First, we would like the same version of ruby/spec for all tested Ruby implementations, but in general each Ruby implementation uses a different version (except when synchronized once a month). We would like the same Ruby compatibility version (e.g., 2.6), but some Ruby implementations do not target 2.6 currently. And finally the number of specs (that is, of it examples) on a given platform should be fairly constant, which required a few fixes in ruby/spec.

As a quick recap, ruby/spec and CRuby tests are the two major test suites for Ruby…

Martian Chronicles, Evil Martians’ team blog 

Power for Kadenze: More performance, less cloud costs

Authors: Irina Nazarova, Account Manager at Evil Martians and Olga Rusakova, Writer at Evil Martians

The Kadenze project is a perfect showcase of the eLearning platform that was lucky to face performance challenges due to a growth in demand—not because of technical imperfection. Martians had to be fast and furious to help the platform scale swiftly, saving up to 25% on cloud infrastructure along the way.

Kannu is the Kadenze, Inc.’s flagship learning management system (LMS) that powers the digital learning experiences of schools, institutions, and companies all over the world. Kannu is also the core of kadenze.com, an online course platform focused on art, music, and creative…

The Ruby Blend 

Episode 17: Open sourcing a Ruby gem with Brittany Martin

The Ruby Blend - Episode 17

Welcome to The Ruby Blend! On today's episode, we have special guest,
Brittany Martin, who is Lead Web Developer for the Pittsburgh Cultural
Trust, where she is part of a team that develops the non-profits
ticketing and festival web application and is also the host of the Ruby
on Rails Podcast on the 5 by 5 Network. Brittany is here to tell us all
about what she does, gem wrappers, and she is seeking some counsel from
the guys today on various things. We talk about how important Readme's
are, useful tools for documentations, a project from Evil Martians, a
gem called Combustion, and RSpec API documentation is discussed. We end
with Brittany telling us…

Remote Ruby 

MiniTest for Those Who RSpec

Welcome to Remote Ruby!  On this episode, we have Jason and Chris.  Chris tells us that their Hey email addresses got secured and that makes him excited for Rails 6.1. Jason brings up his struggles with MiniTests and Chris comes to the rescue and helps him out.  Also, the guys have discussions on Tailwind CSS and PurgeCSS config, working on field help, RSpec, Factories, Fixtures, Faker and Mocha Gems, and Shoulda Matchers. We end with finding out Jason is publishing the Stimulus Reflex Testing Library. Download this episode now! 

[00:01:45] Chris and Jason talk about Hey email and how they love using it.  
[00:07:50] Chris mentions Snowpack, which he doesn’t know much about, so he…
RubyMine – RubyMine Blog | JetBrains 

RubyMine 2020.2 EAP5: New Inspections Widget, Problems View, Improved Git Actions Dialogs, and More

RubyMine 2020.2 EAP5 is now available! Here are the main highlights in this build:

A new way to review problems in your code

RubyMine 2020.2 comes with a new Inspections Widget. This widget provides information about the number of warnings, errors, and other issues in the current file.

The widget is located in the top-right corner of the editor. It shows the number of issues in the current file, and the arrows on the right make it easy to navigate between them.

New inspections widget

You can also configure the highlighting directly inside the widget, choosing between None, Errors Only, and All Problems.

This build also adds a new Problems…

John Nunemaker 

More Descriptive Flipping

The flipper ui just got a fresh coat of paint and I am here to tell you about it. From adding descriptions to your features to bringing the OSS UI more in line with flippercloud.io, flipping features just got even better.

Adding Descriptions

First, let’s talk descriptions, since that is what triggered all this work anyway. It started with a contributed pull request that got me thinking about it. Juan Roldán got it super close and I took it over the finish line akin to Usain Bolt.

John Nunemaker Moves Flipper Across The Finish Line

The end result is a bit of code like this:

Flipper::UI.configure do |config|
  config.descriptions_source = lambda do |keys|
    {
      "unused" => "Not used.",
      "suits" => "Are suits necessary in…
Super Good Software 

I've joined the Solidus Core Team!

I’m happy to announce that a few weeks ago I joined the Solidus Core Team, a group of talented developers who manage the technical side of the Solidus eCommerce platform.

I’ve been involved in Solidus since its inception. I’ve seen the project grow from an idea at the first informal Solidus Conf in Whistler to what it is today and I’m excited to see where it goes next. My renewed efforts on the open-source side of the project have landed me the opportunity to help steer the development of Solidus and make sure it remains an excellent platform for both Super Good’s clients and the broader Solidus community.

I don’t know what’s coming next, but with eCommerce playing an increasingly important…

Awesome Ruby Newsletter 

💎 Issue 214 - Building GitHub-style Hovercards with Stimulus and HTML-over-the-wire

Schneems - Programming Practices, Performance, and Pedantry 

Rate Limiting, Rate Throttling, and how they work Together

In the beginning, there were API requests, and they were good. But then some jerk went and made too many requests too fast and brought the server crashing to its knees. Enter: Rate limiting.

Test Double | Our Blog 

Black Lives Matter

Test Double supports Black Lives Matter and the protests against systemic racism around the world inspired by the tragic murder of George Floyd, Breonna Taylor, and so many others before and after them.
Ruby Weekly 

Factory Bot 6.0, Enumerable#filter_map, and scraping the Web with Ruby

#507 — June 25, 2020

Read on the Web

Ruby Weekly

Building GitHub-Style 'Hovercards' with Stimulus and HTML-Over-The-Wire — HEY! What’s old is new again. The concepts behind pjax to update a page take center stage with some new tools (Stimulus 2.0) thanks to Basecamp’s new app (HEY). A great writeup.

Matt Swanson

Factory Bot 6.0: A Library for Setting Up Ruby Objects as Test Data — Last week it was the classic Shoulda testing system hitting v4, now Factory Bot has hit 6.0 (automatically defined enum traits is a neat new feature). There’s a new release of factory_bot_rails too. Great to see thoughtbot…

thoughtbot, inc.

Try Redis 6.0 on RedisGreen — SSL encryption,…

Alfredo Motta 

Not So Random Software #31 – Collaborative Filtering, Coaching, Rails performance and SQL views

Hello everyone and welcome back to Not So Random Software! This week links are as random as it gets; we will start with a research paper on collaborative filtering, will jump on a book on coaching, and close off with two Rails resources! Hope you are not gonna get lost, enjoy the random walk! A ... Not So Random Software #31 – Collaborative Filtering, Coaching, Rails performance and SQL views
Honeybadger Developer Blog 

Troubleshooting Encoding Errors in Ruby

Troubleshooting encoding errors in Ruby

You have thought about all the edge cases of your code, writing unit and integration tests for them, and yet, when you least expect it, you see a notification that an exception occurred. So, you investigate the problem, discover that it's an encoding error, and see some odd characters, such as "�" in the error message. How do you resolve this error?

For many of us, string encoding is like car maintenance; we only think about them when they break. If you're reading this, it's very likely that you spend a lot of time writing software, so we can try to get ready for encoding errors and leave the cars for later.

The good news is that encoding errors…

Jekyll • Simple, blog-aware, static sites 

Jekyll 4.1.1 Released

Jekyll 4.1.0 brought two notable changes: Page-excerpts and Liquid Drop for Page objects. However these seemingly benign changes had unexpected adverse side-effects which did not figure in our tests.

The Core team decided that the best way forward is to revert introduction of the Liquid drop for Pages but push back generating excerpts for pages behind a flag until v5.0.

Page-excerpts are henceforth an opt-in experimental feature which can be enabled by setting page_excerpts: true in your configuration file. Due to its experimental nature, we have narrowed the scope for page-excerpts to limit their negative effect on builds. Excerpts will not be generated for pages that do not output into…

code.dblock.org | tech blog 

Using Bash Parameter Expansion for Conditionals in GitHub Actions

I am late to using GitHub Actions for CI, and immediately ran into an issue trying to figure out how to conditionally install a different version of Bundler for a certain version of Rails in radar/distance_of_time_in_words#104. Bundler 2.x doesn’t work with Rails 4, and needs to be downgraded.

Fetching gem metadata from http://rubygems.org/.............
Fetching gem metadata from http://rubygems.org/.
Resolving dependencies...
Bundler could not find compatible versions for gem "bundler":
  In rails_4.gemfile:
    bundler

    rails (~> 4.0) was resolved to 4.2.11.3, which depends on
      bundler (>= 1.3.0, < 2.0)

  Current Bundler version:
    bundler (2.1.4)

I decided to use default…

Depfu 

Auto-Merge, Nightshift and Auto-Activation

We wrapped up and polished a few smaller features recently that we had working in one form or another for individual customers. Let me tell you about them:

Auto-Merge

This does exactly what you think it does: Depfu will automatically merge a PR if and when all the status checks come back green.

You can configure to only auto-merge development or runtime dependencies and even specifically limit by SemVer type for very fine grained control.

⚠️ We advise to use this feature very cautiously: with compromised packages and continuous deployment you could quickly get into trouble. But for some projects it can make a lot of sense. You can also combine it with our reasonably up-to-date feature

Ruby on Rails Podcast 

323: Keen to Keeping Using Ruby with Nick Schwaderer

The cat is out of the bag! Nick Schwaderer is back to answer all of Brittany's questions about his new role at Chef. They also dive into graphic design/typography, Ruby's popularity and the new minimal Rails app skeleton generator.

Links for this episode:

Brought to you by:

Raygun

Raygun gives you a window into how users are really…

Greater Than Code 

188: Going Off the Rails with Damien Burke

01:10 - Damien’s Superpower: The ability to hold conflicting beliefs at the same time.

04:09 - Life is Hard. How do we make things easy?

12:03 - Treating Expertise as Transferable to Different Fields

17:54 - Loving Yourself Unconditionally and Seeing Flaws

“You are whole, perfect, and complete.” – Damien Burke

Test Double | Our Blog 

Activism for developers

The opposite of love is not hate, it’s indifference. The opposite of art is not ugliness, it’s indifference. The opposite of faith is not heresy, it’s indifference. And the opposite of life is not death, it’s indifference.
Hi, we're Arkency 

Don't blindly apply software patterns

I went for a run today and I was catching up with some podcast episodes today and I would like to share my comments to the great episode about sagas & process managers published by Mariusz Gil in the Better Software Design.

Mariusz has been talking with Kuba Pilimon. This was the third episode when these devs have discussed how to design software using Domain Driven Design techniques & design patterns. (The podcast is in Polish but some episodes - like the inverview with Alberto Brandolini are recorded in English).

I’ve listened to this podcast and the overall discussion is very interesting but I have some remarks:

Patterns are not the silver bullet

Mariusz & Kuba have dicsussed the sag…

Rails with Jason 

050 - DevOps for Beginners with Adam Hawkins

In this episode I talk with DevOps expert Adam Hawkins, who also appeared in episode 49. Adam and I talk about what DevOps is and how you can use DevOps principles to deliver better software faster.

GoRails Screencasts 

Code Coverage with SimpleCov and RailsBytes

Add code coverage to your app using SimpleCov and RailsBytes. We'll walk through installing simplecov and creating a RailsByte to automate it for us going forward.
Pawel U. | Ruby on Rails Performance Consultant Blog 

Postgres Indexes for ActiveRecord Join Tables in Rails Apps

Join tables are a common citizen in Ruby on Rails apps. Their use case is to provide many to many relation between database models. Adding correct Postgres indexes on join tables is not obvious. I’ve noticed that some tutorials, Stack Overflow posts, and even Rails itself provide incorrect advice on how to do it. In this tutorial, we’ll look into how compound PostgreSQL indexes work and how to correctly use them with join tables.

We will start by explaining the basics of join models and later deep dive into analyzing the output of the PostgreSQL EXPLAIN query plan with different database indexes.

What is a join table and model in Rails?

Many to many relation is often necessary to model…

Everyday Rails 

Rails architecture tips from route helpers

A subtle feature of Rails routing gave me a new appreciation for the attention to detail that the authors of the Rails framework put into making it a pleasant development experience.
The Bike Shed 

249: What Would You Say You Do Here?

On this week's episode, Steph and Chris trade some consulting and everyone comes out a winner. Steph talks about a win and a loss on the battlefield of refactoring, and Chris shares a related effort around identifying and removing unused code. Chris shares a pattern his team has been using with a special "demo" flag to provide small enhancements but otherwise keep sales demos within the product.

Steph then shares some friction related to using dependabot on her team's project that hints at more foundational ideas at the intersection of workflow, team dynamics, testing, deployment. And finally, Chris asks Steph for her thoughts on how best to add testing around the structure of API…

RubyMine – RubyMine Blog | JetBrains 

RubyMine 2020.2 EAP4: Improved Completion, Support for Git installed in WSL2, and More

RubyMine 2020.2 EAP4 is now available! Here are the main highlights in this build:

Improved completion for standard library methods

We’ve improved completion for many of the common standard library methods (such as Array#sort_by, Hash#each, and many others). RubyMine will now suggest more accurate methods in completion.

For example, the completion will now recognize the key and value types of a hash and suggest methods based on them:

Improved completion for standard library methods

New intention action to sort hashes by their keys

We’ve added a new intention action…

Boring Rails: Skip the bullshit and ship fast 

Building GitHub-style Hovercards with Stimulus and HTML-over-the-wire

Somewhere along the way toward our current JavaScript hellscape, programmers decided that HTML was over. We’re done with it.

The emergence of tools like React shifted programmers away from writing HTML, instead writing JSX, a fancier tag-based markup language that worked nicely inside your JavaScript.

Backends were then relegated to being dumb JSON API endpoints. Or if you were fancy and chasing upvotes, you’d use GraphQL!

But HTML? Yuck!

A Brief History of HTML-over-the-wire

One of the key pillars of Rails is to “Value integrated systems”. While the industry moves towards microservices, highly decoupled front-ends and teams, and the siren song of Programming via LEGO Bricks, Rails…

RubyMine – RubyMine Blog | JetBrains 

RubyMine 2020.2 EAP4: Improved Completion, Support for Git installed in WSL2, and More

RubyMine 2020.2 EAP4 is now available! Here are the main highlights in this build:

Improved completion for standard library methods

We’ve improved completion for many of the common standard library methods (such as Array#sort_by, Hash#each, and many others). RubyMine will now suggest more accurate methods in completion.

For example, the completion will now recognize the key and value types of a hash and suggest methods based on them:

Improved completion for standard library methods

New intention action to sort hashes by their keys

We’ve added a new intention action…

All talk but no code 

Rails 6.1’s ActiveModel Errors 介面大翻新

The English version of this post is available here

Rails 6.1 預計今年會推出,其中包含了 ActiveModel Errors 的大改變。我想來解釋一下改變的原因,以及開發者該怎樣做準備。

每個錯誤都被包成一個物件

當 model attribute 有錯誤資料時,呼叫 valid? 會在 errors.messages 這個 hash 中產生每個 attribute 相對應的錯誤訊息。不過在 Rails 5.0 開始,又新增了另一份叫做 details 的 hash,讓開發者還能取得更詳細的錯誤資訊。

這兩個hash應該要同步一對一,但是要把messages中某訊息對應到details是一件很瑣碎的工作。我們必須記得array index後才能在另一邊取得資料。這兩個 hash 也會在某些特定狀況變得不一致。有學過物件導向的大家應該都能了解資料不封裝的話,資料一致性就容易被破壞。所以在 Rails 6.1 ,我們把單一錯誤的所有資訊都封裝在一個物件中。

現在book.errors其實是一陣列的Error物件.

大改變通常就會伴隨著deprecation或是需要開發者修復的breaking change,以下我會把最重要的改變列出來:

如何更新?

messagedetails

原本 messages, full_messages and details 這些方法都是一次提供所有錯誤資訊。現在新的 Error 物件只提供關於自己的資料:

e = ActiveModel::Error.
The Ruby Blend 

Episode 16: Playbook Thirty-nine with Nick Haskins

Welcome to The Ruby Blend! On today’s episode, we have special guest, Nick Haskins, who works as a full-time solo Dev for CG Cookie and a year later he launched Blender Market. Both sites were started on WordPress but eventually outgrew the platform. Without any prior experience with Ruby on Rails, he built both apps from scratch and spent the next few years fixing, learning, and maintaining those platforms. Today, he is going to tell us all about his book he recently published called, Playbook Thirty-nine. There’s an interesting story how he came up with the name. He also tells us about his new platform called Mavenseed. Also, Nick lets us know how it’s been traveling and living…

avdi.codes 

Rubber Duck Session: Rails Polymorphic Attributes with Karim Talek

In this public Rubber Duck Session, my pairing partner Karim wanted to move some logic for editing message-display rules from the frontend to the backend. We settled on using JSONB and Rails polymorphic attributes as our implementation strategy.

Code with Jason 

Protected: How I think about tech’s flawed hiring practices

This content is password protected. To view it please enter your password below:

Password:

The post Protected: How I think about tech’s flawed hiring practices appeared first on Code with Jason.

Julia Evans 

A little bit of plain Javascript can do a lot

I’ve never worked as a professional frontend developer, so even though I’ve been writing HTML/CSS/JS for 15 years for little side projects, all of the projects have been pretty small, sometimes I don’t write any Javascript for years in between, and I often don’t quite feel like I know what I’m doing.

Partly because of that, I’ve leaned on libraries a lot! Ten years ago I used to use jQuery, and since maybe 2017 I’ve been using a lot of vue.js for my little Javascript projects (you can see a little whack-a-mole game I made here as an intro to Vue).

But last week, for the first time in a while, I wrote some plain Javascript without a library and it was fun so I wanted to talk about it a…

RubyMine – RubyMine Blog | JetBrains 

Video Tutorial: Testing and Coverage in RubyMine

Hello everyone,

In this tutorial, you’ll learn how to:

  • Run and debug tests in RubyMine
  • Get coverage information
  • Create new tests
  • Customize test templates

For more information about this topic, you can also read the section dedicated to testing in the RubyMine documentation.


You can download the sample Rails application used in this tutorial from GitHub.

And as always, please report any issues you encounter.

Happy developing!
The RubyMine team

Remote Ruby 

Advanced StimulusReflex & CableReady in real-world apps

[00:06:10] Jason starts out by talking about working on action cable this past weekend since he uses stimulus reflex for everything in life and he couldn’t control the logging.  Chris mentions he had a similar issue happen to him. 
[00:10:00] Andrew chimes in to say he thinks this is a place where components can really shine with cable ready. Jason talks about using components at work. 
[00:13:19] Chris wonders if Jason has dropped down into Cable Ready since he’s been using Stimulus Reflex a lot. Chris finds it far more effective than Stimulus Reflex for what he has to do. 
[00:18:51] Jason brings up offline and using it with Trix and he feels like he’s having to break rules to get…
RubyMine – RubyMine Blog | JetBrains 

Video Tutorial: Testing and Coverage in RubyMine

Hello everyone,

In this tutorial, you’ll learn how to:

  • Run and debug tests in RubyMine
  • Get coverage information
  • Create new tests
  • Customize test templates

For more information about this topic, you can also read the section dedicated to testing in the RubyMine documentation.

https://youtu.be/25VlYrBQhmg


You can download the sample Rails application used in this tutorial from GitHub.

And as always, please report any issues you encounter.

Happy developing!
The RubyMine team

Awesome Ruby Newsletter 

💎 Issue 213 - Web Scraping with Ruby

Ruby – AWS Developer Blog 

Maintenance Mode and End of Support Dates Announced for AWS SDK For Ruby V2

We are announcing that version 2 of the AWS SDK For Ruby will enter maintenance mode on 11/20/2020. Support for version 2 will end on 11/21/2021. During maintenance mode we will continue to fix bugs and patch security issues until support for version 2 ends, at which point no further updates to version 2 will be released. We encourage customers to upgrade from version 2 to version 3 to continue receiving regular updates.

Version 3 of the AWS SDK For Ruby released in August of 2017. Version 3 maintains API compatibility with version 2 making upgrades easy.

Benefits of upgrading to V3

Version 3 introduces many improvements over the version 2 SDK, including modularization. Benefits of…

Ruby Weekly 

Sparking ✨ joy ✨ by running fewer tests

#506 — June 18, 2020

Read on the Web

Ruby Weekly

SimpleDiscussion: A Simple, Extensible Rails Forum — If Discourse is a bit on the heavy side for you, you might find this simple forum software extracted from GoRails of interest.

Chris Oliver

Spark Joy by Running Fewer Tests — Tests are slow and sometimes people feel they can impact the joy of coding, but in many cases they’re necessary. Shopify experimented with using dynamic analysis to reduce the tests run on each PR and reclaimed some ‘joy.’

Jessica Xie (Shopify)

Building Admin APIs for Rails Apps — From REST to gRPC to Unrestful. Our…

Depfu 

Update your engines!

Ever since we started working on Depfu, we wondered if it would make sense to update the runtimes or, as we call it more generically: engines as well. Updating to a new Ruby or Node.js version is, very much like updating dependencies, an unloved chore with clear benefits when done regularly. Today we’ll start the beta test of this as a new Depfu feature.

On the surface, this feature doesn’t sound very complicated, but don’t be fooled. For dependencies, at least in the runtimes we support, there usually is a single (or double, if you count the lockfile separately) source of truth. For runtimes, things get complicated really, really fast. Even if you are using one of the version managers…

Alfredo Motta 

Agile or Waterfall; a risk management perspective

Today Agile is the default choice for the software development life cycle (SDLC); every conference, book, or blog post is telling us we are doomed to fail if we don’t follow this established convention. But isn’t it surprising to think that we should use Agile for every possible company doing software out there? Are we ... Agile or Waterfall; a risk management perspective
Hi, we're Arkency 

Rails multiple databases support in Rails Event Store

Rails 6 released in August 2019 has brought us several new features. One of the notable changes is support for multiple databases.

To make the story short, to use multiple databases you need to:

  • define multiple database configurations in config/database.yml file (for each environment)
  • define a new abstract class that uses connects_to to set the target databases
  • define a separate folder for other database migration files (don’t forget to set it in the database config)
  • define new models that inherit from new abstract class - all of them will be read & written to the database defined in the base class

All details have been described in Rails guides and I’ve already read several blog posts…

OmbuLabs Blog 

The OmbuLabs Workflow: working with GitHub and Pivotal Tracker

As a remote team, we work and communicate asynchronously a lot of the time. Additionally, as a software agency, we work not only on client projects but also internal projects related to various aspects of the company. This means we will have stories and pull requests opened accross different internal projects at all times and it is important that everyone is on the same page when it comes to what needs their attention and what the next steps are.

We have shared more information on how we use Pivotal Tracker here. We also like to use GitHub to its full potential. Therefore, we needed a standardized workflow that would take into account how we use both these tools and ensure everybody on the…

Saeloun Blog 

Encapsulate each validation error as an Error object

Rails modified the way errors are represented when a model save, create or update action fails.

Before

Let’s say we have a User model, with columns like first_name, last_name, contact_number, email and all of them are mandatory. If we try to create a User object without passing first_name and contact_number as a string, the #errors function will show the errors as below

class User < ApplicationRecord
  validates :contact_number,
            presence: true,
            numericality: true,
            length: { :minimum => 10, :maximum => 15 }
end

user = User.create(email: "sam@example.com", last_name: "Example", contact_number: "abcdefghijk")

user.errors
=> #<ActiveModel::Errors:0x00007…
Riding Rails 

Rails 6.0.3.2 has been released!

Hi everyone!

Rails 6.0.3.2 has been released! This version of Rails contains an important security patch, and you should upgrade! The release contains only one patch that addresses CVE-2020-8185. You can read about CVE-2020-8185 here.

Here are the checksums for the released gems:

$ shasum *6.0.3.2*
49c72c7d45ea6de626313d6142f2c307628d4f7e  actioncable-6.0.3.2.gem
dac7b0bab305f2666525369dc55b33c7cce03b96  actionmailbox-6.0.3.2.gem
a39e5f6e1cb4988ce17e7778a4c6d01b4b24bcdd  actionmailer-6.0.3.2.gem
82f70a87edf540897449d21dde0503213bd62bb2  actionpack-6.0.3.2.gem
fcb1d3e4e67e4a1036d11826f80a9dcbeb849e6c  actiontext-6.0.3.2.gem
0516d18bb37a0a23092b19c4a0473229b706c810 …
Julia Evans 

What happens when you update your DNS?

I’ve seen a lot of people get confused about updating their site’s DNS records to change the IP address. Why is it slow? Do you really have to wait 2 days for everything to update? Why do some people see the new IP and some people see the old IP? What’s happening?

So I wanted to write a quick exploration of what’s happening behind the scenes when you update a DNS record.

how DNS works: recursive vs authoritative DNS servers

First, we need to explain a little bit about DNS. There are 2 kinds of DNS servers: authoritative and recursive.

authoritative DNS servers (also known as nameservers) have a database of IP addresses for each domain they’re responsible for. For example, right now an…

Ruby in Source Diving on Medium 

Testing external dependencies using dependency injection

If you work on a bigger Ruby (on Rails) project, chances are that you need to interact with some external resource like a database, cloud API or message queue. Testing these external resources can sometimes be tricky, let’s have a look at different approaches.

Example

As an example, we will use the Dropbox API gem to upload a file.

https://medium.com/media/1b5dd403ce16fa4cac68dc4198bcf129/href

We have an Uploader class which accepts the file content and file name. Finally it uses the Dropbox client to upload the data to the cloud.

WebMock

An approach we often see is to use WebMock to stub the HTTP requests.

From the official documentation, it is described as a

Library for stubbing and setting…
Ruby Magic by AppSignal 

Using Service Objects in Ruby on Rails

This article has been modified from its original appearance in Playbook Thirty-nine - A Guide to Shipping Interactive Web Apps with Minimal Tooling, and tailored to fit this guest post for AppSignal.

There’s a lot of functionality that your app needs to handle, but that logic doesn’t necessarily belong in the controller or even the model. Some examples include checking out with a cart, registering for the site, or starting a subscription.

You could include all this logic in the controller, but you’ll keep repeating yourself, calling the same logic in all those places. You could put the logic in a model, but sometimes, you need access to things that are easily available in the controller,…

Ruby on Rails Podcast 

322: Rails CI Pipeline Performance with Kelly Sutton

Kelly Sutton is a software engineer at Gusto on their application infrastructure team. He and Brittany discuss his project, TestDesiderata, and his latest blog post, "From 25 Minutes to 7 Minutes: Improving the Performance of a Rails CI Pipeline".

Links for this episode:

Brought to you by:

Raygun

Raygun gives you a window into how users are really experiencing your software applications. Raygun is thrilled to launch the next chapter in their ongoing support…

Greater Than Code 

187: Seeing The World with Bryan Liles

01:50 - Bryan’s Superpower: The ability to see the world as it is

06:52 - Conference Circuits / Virtual Conferencing

17:44 - Working Remotely During Quarantine

  • Productivity
  • Depression
  • Find a Piece of Life That Makes You Happy

23:48 - The Premise of Being Greater Than Code

  • We Are Not Our Code

26:24 -…

Honeybadger Developer Blog 

Evaluating Go's Package Management and Module Systems

A package manager is a tool for automating the process of building your code, as well as downloading, updating, and removing project dependencies in a consistent manner. It can determine whether a specific version of a package is installed on a project, and then install or upgrade the package, typically from a remote host.

Package managers have been around for a long time. They were first used in operating systems and later used in programming environments. While there are differences between system-level and language-level package managers, there is also significant overlap in how they work.

In a language context, a package manager makes it easier to work with first-party and third-party…

Ruby Conferences 'n' Camps in 2020 - What's Upcoming? 

ONLINE ONLY! RubyConfBY @ Minsk, Belarus Announced

Conferences 'n' Camps

What's News? What's Upcoming in 2020?

ONLINE ONLY! RubyConfBY
Jul/18+19 (2d) Sat+Sun @ Minsk, Belarus • (Updates)

See all Conferences 'n' Camps in 2020».

Hi, we're Arkency 

Introducing EventStoreClient - a ruby implementation for Greg's EventStore

A guest post by Rails Architect Masterclass alumnus, Sebastian Wilgosz from Useo.

Not so long ago, I’ve been challenged by one of my clients to split a big, monolithic 10-year old rails application into a Domain-Driven Designed, microservice-based, event-sourced ecosystem of distributed applications.

Not on my own of course, but still - it was quite a challenge.

Event Store Client

One of the key components was to design a communication channel for our services and after a lot of options checks, we’ve decided to go with events as our Source Of Truth and eventual consistency for the whole ecosystem.

To make a long story short, we’ve created an EventStoreClient gem for Ruby. It’s a ruby…

Rails with Jason 

049 - Testing Your Deployment Pipeline with Adam Hawkins

In this episode I talk with Adam Hawkins about the concept of not just testing your application code, but testing your deployment pipeline so that you mitigate the risk of running bad deploys that take your site down.

GoRails Screencasts 

Multiuser Live Video Chat in Rails

Using Vonage (previously known as OpenTok), we can add multiuser live video chat to Rails in just 20 minutes. It also supports broadcasting things like webinars, recording videos, and more.
JetRockets 

Choosing the right technology stack for your project

Building a new software product? Make sure you are choosing the most appropriate tech stack and for the right reasons!
Rebased Blog 

Wheel of Fortune for videocalls

Here at Rebased we’ve been invested in remote work for a few years now, while still keeping small offices in three big Polish cities for people who want to work from office, meet their coworkers and have a good coffee from a local roastery. The COVID-19 situation meant working from...
Rails Girls Summer of Code Blog 

Travis Foundation Statement

The past few months have been a testing time for us all. As the global pandemic led to the cancellation of so many events and created new challenges for nonprofits, we remained steadfast that Rails Girls Summer of Code should go ahead as planned.

Despite this determination and the extra measures put in place to safeguard the program, we have been unable to gather the resources necessary to keep Travis Foundation running. Sadly, it will soon close its doors for good.

Without the team to manage the program, we regret that Rails Girls Summer of Code has also been cancelled.

Many of you will share our disappointment at this turn of events. Thanks to the incredible efforts of this awesome…

Valentino Gagliardi - RSS Feed 

4 ways to fake an API in frontend development

x ways to fake an API in frontend development

Who this guide is for and what you need to know

This guide assumes a basic understanding of testing theory and testing runners.

The examples are in pure JavaScript.

To experiment with the examples you should have a working installation of Node.js on your system.

To skip directly to practice jump here, otherwise take some theory first!

The Bike Shed 

248: Here Be Dragons

On this week's episode, Steph shares a keyboard confession and interest in migrating to a split keyboard layout. Chris dives into creating static error pages that are independent of the app while still leveraging the app's CSS framework. They also respond to a listener question about Conventional Commits and discuss when automation tooling feels helpful vs harmful.

ErgoDox EZ Keyboard
Keyboardio Atreus
[Tailwind CSS][]

Martian Chronicles, Evil Martians’ team blog 

Figma Auto Layout: Practical tips for dynamic designs

Authors: Gleb Stroganov, Designer at Evil Martians and Andy Barnov, Writer at Evil Martians. Teacher at Le Wagon

Go beyond pixel pushing and start speaking the same language as your engineering team by harnessing the power of Figma Auto Layout in your UI mockups. Learn how we use it to implement universal dynamic component systems—from design to code. See how Auto Layout allowed us to rethink the way we create interfaces for our clients and internal projects.

In the ideal world, everyone would just design websites from scratch directly in code. Modern browsers give us perfect tools to inspect, tweak, and test our components with instant visual feedback.

Designing with…
Prathamesh Sonpatki 

Allowing dots in Rails routes

Rails routing is very powerful and it allows to define different types of routes. Though resourceful routes is recommended, it also gives us ability to define routes for specific cases using dynamic segments.

post '/users/:id/upgrade', to: 'upgrade#create'

This route matches users/123/upgrade and provides params[:id] with value 123.

All good so far. Now, we want to rather support users/john.smith/upgrade to make the URLs user friendly. As we are using the dynamic id segment in the route already, hopefully we will get that value in the params[:id].

Let's try hitting our application with this URL.

$ curl -iv "http://localhost:3000/users/john.smith/upgrade"

< HTTP/1.1 404 Not Found
< Content-Type:…
Julia Evans 

Questions to help people decide what to learn

For the last few months, I’ve been working on and off on a way to help people evaluate their own learning & figure out what to learn next.

This past week I built a new iteration of this: https://questions.wizardzines.com, which today has 2 sets of questions:

  1. questions about UDP
  2. questions about sockets

It’s still a work in progress, but I’ve been working on this for quite a while so I wanted to write down how I got here.

the goal: help people learn on their own

First, let’s talk about my goal. I’m interested in helping people who are trying to learn on their own. I don’t have any specific materials I’m trying to teach – I want to help people learn what they want to learn.

I’ve done…

The Rails Tech Debt Blog 

Upgrading a Large Rails Application from Rails 5.0 to 5.1

We recently collaborated with Procore on a Rails upgrade for their Rails application which allows teams in the construction industry to connect their entire business process.

We spoke with Andy Maltun, Procore’s VP of Software Engineering, about the work performed to help them upgrade their app to version 5.1. According to Maltun, Procore’s R&D department is large and complex. While Procore previously had handled their Rails upgrades internally, with so many teams working on the application, it caused a lot of disruption as each team would handle only part of the upgrade. Therefore, Maltun "wanted to take a different approach this time in an effort to centralize the update and minimize the…

Rémi Mercier 

How to wrap your head around a new codebase

For the last eighteen months, I’ve spent my time trying to understand bits of code I’d never seen before. Eighteen months later, I still don’t know every corner of this reasonably sized codebase (~300_000 lines of code). But what I do know is how to get familiar with new parts of it.

So today, I’ll try and give you some tips about an understated skill: how to wrap your head around a new (part of the) codebase.

What you probably shouldn’t do

Don’t. Be. Stubborn.

That part, I’ve struggled with a lot. Stubbornness impeded the order of magnitude of my output for months.

I would try to understand the code alone and knock my head on my keyboard for hours on end. Man, my ego REALLY got into…

Remote Ruby 

Past Rubies and Rails history with Nick Schwaderer

[00:03:20] Jason talks about the form stuff he’s been working on in Reflex.
[00:08:02] Nick tells us about the background of “Past Rubies,” which has been on hiatus since Christmas, but will be reappearing in the next month.  
[00:15:12] The merge of Rails and Merb is brought up by Chris and he mentions a fascinating blog post by Yehuda Katz. 
[00:21:30] Nick talks about Brighton Ruby’s alternative conference which is a remote conference this year and they are giving a hard copy of “Why’s (poignant) Guide to Ruby.”
[00:29:30] Andrew talks about a RailsCast he watched called, “Polymorphism” which he says is still completely relevant.  Chris also has a story about one he watched too. 
[00…
RubyGems Blog 

May 2020 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 May.

RubyGems News

This month, we refactored the spec suite to be faster and collated changes that will be shipped in the next bundler release. We fixed an activation issue on old versions of Bundler. We’ve fixed several regressions in RubyGems custom require and made specific tests work when running from ruby-core (thanks @deivid-rodriguez). We revisited a bunch of old PRs and work from the old repo, and got it ready to merge into the new repo.

In May, Rubygems gained …

Awesome Ruby Newsletter 

💎 Issue 212 - The RuboCop Name Drama Redux

Honeybadger Developer Blog 

Taming Legacy Code With Characterization Tests

Have you ever needed to change code that already works, but has no tests and is difficult to fully understand? How did you feel deploying those changes? Were you nervous?

I recently had to upgrade a 7 year old API endpoint with hundreds of lines of code. This was part of a new feature release, and in order to make the changes safely, while also making sure the final code was cleaner and well tested, I made use of some techniques that I'd love to share using a short but interesting example.

For our example, let's say that we mask sensitive data in some places in our product. Our product manager asks us if we can change the way emails are masked so that they look like this:

*****@example.co…
Ruby Weekly 

An interview with Richard Schneeman

#505 — June 11, 2020

Read on the Web

📢 We've got a bit of bonus content this week in the form of an interview with Richard Schneeman at the footer of the issue :-)

Ruby Weekly

An Interview with Rails' Creator David Heinemeier Hansson — Evrone are a development company who did a pretty neat interview with Matz recently and now we have DHH too, our favorite race car driver, Basecamper, and framework creator.

Evrone

Why and How 'mkdev' Switched to Fullstaq RubyFullstaq Ruby is a “server-oriented configuration of Ruby” provided via maintained packages for RHEL/CentOS/Ubuntu, etc. It also touts reduced…

Martian Chronicles, Evil Martians’ team blog 

Desktop frontier: Video app optimization for Lowkey

Authors: Irina Nazarova, Account Manager at Evil Martians and Olga Rusakova, Writer at Evil Martians

Today, many brand-new desktop applications are built either entirely on web technologies to run in the modern browsers, or based on Electron, a framework for merging web and desktop tech stacks. These apps inherit both “web benefits”—like a short development time and “web downsides”—like huge resource consumption and slower interfaces. For gaming applications, such performance bottlenecks are vital: gamers have zero tolerance for any lags.

Our performance optimization case with Lowkey was a fighting chance to explore a whole new professional area for Martians and to find instruments to…

RubyMine – RubyMine Blog | JetBrains 

RubyMine 2020.2 EAP3: Improvements for Liquid, Code Assistance, and More

RubyMine 2020.2 EAP3 is now available! In this build, we’ve added new features for the Liquid template language, a couple of improvements for code assistance, and changed the look of the search results in Search Everywhere.

Improvements for Liquid

We continue working on the basic support for the Liquid template language. This build includes a number of bug fixes and a couple of new features.

We’ve added support for methods that contain question marks in their names:

Methods with question marks in Liquid

RubyMine now also…

Alfredo Motta 

Not So Random Software #30 – Learning to rank

Hello everyone and welcome back to Not So Random Software! It’s been a while since I blogged about neural networks and how to use them to rank a set of items based on the users’ preferences. The blog was in 2015 and a lot has happened since then. I think it might be a good ... Not So Random Software #30 – Learning to rank
RubyMine – RubyMine Blog | JetBrains 

RubyMine 2020.2 EAP3: Improvements for Liquid, Code Assistance, and More

RubyMine 2020.2 EAP3 is now available! In this build, we’ve added new features for the Liquid template language, a couple of improvements for code assistance, and changed the look of the search results in Search Everywhere.

Improvements for Liquid

We continue working on the basic support for the Liquid template language. This build includes a number of bug fixes and a couple of new features.

We’ve added support for methods that contain question marks in their names:

Methods with question marks in Liquid

RubyMine now also…

Saeloun Blog 

Rails support bulk insert/upsert on relation

Rails 6.1 has added support for bulk insertion for associations. Previously, bulk insertion for associations did not work as expected.

Before Rails 6.1

Rails 6.0 has added support in ActiveRecord for bulk record insertion which works similar to update_all. It provides methods like insert_all, insert_all!, upsert_all etc for the bulk creation. We can do bulk insert in a table as:

Address.insert_all(
  [
    {
      address1: 'address1',
      city: 'city1',
      state: 'state1'
    },
    {
      address1: 'address2',
      city: 'city2',
      state: 'state2'
    }
  ]
)

# Address Bulk Insert (198.5ms)  INSERT INTO
# "addresses"("address1","city","state") VALUES 
# ('address1',…

It will create 2 records for Address.

Now, if we try to create multiple records using an association as below:

user.addresses.insert_all(
  [
    {
Code with Jason 

Lessons I learned converting all my database IDs to UUIDs

The motivation

About seven months ago I became aware of a slightly worrisome problem in the application I maintain at work.

The application is a medical application. Each patient in the system has a numeric, incremental account number like 4220. Due to coincidental timing of business and technology, the database ID of each patient is pretty close to the account number. The patient with account number 4220 might have a database ID of something like 4838.

You can imagine how this might cause confusion. Imagine wanting to check which patient you’re viewing and you see 4220 on the screen and patients/4838 in the URL. If you’re not paying close attention it can be confusing.

I brought this issue…

Ruby on Rails Podcast 

321: Ruby API and Bundler with Colby Swandale

Colby Swandale is a Ruby Engineer at Envato in Melbourne. He is also a core contributor to the Bundler, RubyGems & RubyGems.org projects. Colby recently started a new project called Ruby API to help improve finding and reading Ruby documentation on the web!

Links for this episode:

Brought to you by:

Raygun

Raygun gives you a window into how users are really experiencing your software applications. Raygun is thrilled to launch the next chapter in their…

Ruby on Rails Podcast 

321: Ruby API and Bundler with Colby Swandale

Colby Swandale is a Ruby Engineer at Envato in Melbourne. He is also a core contributor to the Bundler, RubyGems & RubyGems.org projects. Colby recently started a new project called Ruby API to help improve finding and reading Ruby documentation on the web!

Links for this episode:

Brought to you by:

Raygun

Raygun gives you a window into how users are really experiencing your software applications. Raygun is thrilled to launch the next chapter in their…

Greater Than Code 

186: The Universe Makes it Happen with Emily Gorcenski

Emily has been on GTC before! Check out her previous episode: 037: Failure Mode

01:08 - Emily’s Superpower: Hunting Nazis and Data Science

  • Emily’s Motivation to Do This Work – Fighting Back
  • What is the question behind the question?
  • Data Science + SCIENCE

14:55 - Being Willing to Be Wrong / Failure and Learning

  • Methods for Determining You’re Going to be Tracking Wrong Things
  • Simpson’s Paradox
  • Means Are a Lie
  • Detecting Nonlinearities

34:49 - Cybernetics

38:43 - The COVID-19 Pandemic Crisis and The Need For Systematic Restructuring

47:16 - Nuance, Power, and Authority

  • High-Reliabilit…
Rails with Jason 

048 - Chad Pytel, Developer and CEO at thoughtbot

In this episode, packed with nuggets of wisdom, I talk with thoughtbot CEO Chad Pytel about the meaning of the terms "code quality" and "bad code", the ways in which poor-quality code comes into existence, how to add tests to a codebase that doesn't have much test coverage, and much more.

All Ruby Podcasts by Devchat.tv 

RR 461: Rethinking the View Layer with Components with Joel Hawksley

Joel Hawksley is an engineer at Github who works on some of their Rails architecture. He is one of the authors of the view_component gem. He walks the Rogues through the genesis of the project and the pros and cons of using a library like view_component and how it adds testability and easy management to Rails views.

Panel

  • Charles Max Wood
  • Dave Kimura
  • Luke Stutters

Guest

  • Joel Hawksley

Sponsors

"The MaxCoders Guide to Finding Your Dream Developer Job" by Charles Max Wood is now available on Amazon. Get Your Copy Today!

Links

Picks

Joel Hawksley:

Charles Max…

Ruby on the halcyon blog 

Exploring Metaprogramming in Ruby

Metaprogramming is an integral part of Ruby, more so than in any other language. Many frameworks and libraries rely on it, so if you want to know how those tools function, you will have to learn what goes on under the hood.
Everyday Rails 

Work around flaky test failures in Rails with rspec-retry

Nobody likes an intermittently failing test. Here's one way to keep your test suite running green, even when a test sometimes fails.
The Bike Shed 

247: Acronyms By Moonlight

On this week's episode, Steph and Chris discuss potential approaches to a complex client-side workflow, Chris shares the highs and lows of his recent adventures revising the caching in a REST API, Steph shares an Ember testing pro-tip and then explores the questions it brings up, and lastly, they revisit prettier-ruby and it's fantastic configuration setup.

This episode is brought to you by Datadog. Click through to get a free 14-day trial and a free Datadog t-shirt!

Sponsored By:

Ruby Together News 

May 2020 Monthly Update

Hello! Welcome to the monthly update. During May, our work was supported by Zendesk, Stripe, DigitalOcean, Bleacher Report, and many others.

ruby together news

In May, Ruby Together was supported by 45 different companies, including Sapphire member Stripe. Five companies joined as new members.

On top of those companies, five new developers signed up as members, including Lola Odelola and Jakob Waller. In total, we were supported by 102 developer members. Thanks to all of our members for making everything that we do possible. <3

Stay safe out there, and have a good Juneteenth! Black lives matter, and if you support Ruby Together’s mission to provide fair compensation for open source…

Code with Jason 

I’m seeking guests for the Rails with Jason podcast

I’m looking for guests for my podcast, Rails with Jason.

Do you have someone in mind you’d like to see on the show? Would you yourself like to come on the show? Fill out the form below with some combination of Twitter handle, name, email, etc—just a way for me to get a hold of whomever the potential guest is—and I’ll reach out if it seems like a good fit.

It’s great if the person is Rails-focused but they don’t have to be. For example, I had Kelsey Hightower on the show to talk about Kubernetes because that topic overlaps with Rails developers’ interests.

I’m especially interested in hearing from people who we traditionally don’t hear as much from in the dev community, including people from…

code.dblock.org | tech blog 

I've Asked You to Become an Open-Source Project's Co-Maintainer

If you made any significant, high quality, contribution to one of my open-source projects, and have a decent contribution history on Github, I will ask you to join as a co-maintainer. In some ways, this ask is a non-automated, higher touch, softer implementation of the Moya Contributing Guidelines.

You will typically get the following note.

Thanks for the contribution! Would you like to help out with project maintenance? Maybe make the next release?

For Ruby projects I may add a note along the lines of drop me an email with your rubygems username/email.

Some examples of this in grape#1803, open-weather-ruby-client#20, iex-ruby-client#63, slack-ruby-bot-server#95, mongoid-history#202

Why do I ask?

My goal is to reduce bus factor, and…

GoRails Screencasts 

Realtime browser updates with Cable Ready

Learn how to use Cable Ready to perform realtime browser updates using actions generated in Rails controllers, models, and background jobs. Cable Ready is the magic behind Stimulus Reflex.
Drifting Ruby Screencasts 

Tracking Changes on Action Text

Without using any gems, we look at tracking changes within Action Text. It seems like a simple thing, but challenges arise through several layers of abstraction due to the flexibility that Action Text provides.