Rubyland

news, opinion, tutorials, about ruby, aggregated
Sources About
Jekyll • Simple, blog-aware, static sites 

Jekyll 3.9.0 Released

Jekyll 3.9.0 allows use of kramdown v2, the latest series of kramdown.

If you choose to upgrade, please note that the GitHub-Flavored Markdown parser and other features of kramdown v1 are now distributed via separate gems. If you would like to continue using these features, you will need to add the gems to your Gemfile. They are as follows:

  • GFM parser – kramdown-parser-gfm
  • coderay syntax highlighter – kramdown-syntax-coderay
  • mathjaxnode math engine – kramdown-math-mathjaxnode
  • sskatex math engine – kramdown-math-sskatex
  • katex math engine – kramdown-math-katex
  • ritex math engine – kramdown-math-ritex
  • itex2mml math engine – kramdown-math-itex2mml

Jekyll will require the given…

Prathamesh Sonpatki 

Effective enqueuing of background jobs

TLDR;

Lot of times we can avoid enqueuing the jobs to the background queue if they are going to be discarded immediately upon execution.


Let's say we have a background job to send a webhook notification to Slack.

# app/services/events_service.rb

class EventsService
  def process
    @event = create_event
    SlackJob.perform_later(@org, @event)
  end
end

# app/jobs/slack_job.rb

class SlackJob < ApplicationJob
  def perform(org, payload)
    if org.slack_enabled?
      SendSlackNotification.new(org, payload).process
    end
  end
end

The job is enqueued for sending the notification and then inside the job we are checking if the organization has enabled slack or not. Only if slack is enabled…

OmbuLabs Blog 

Our Code Review Etiquette

Code Review is one of the greatest tools we have as software developers to help us improve the quality of our code. It can be incredibly beneficial, but it can also be a source of pain, frustration, and overall, a waste of time instead of a time-saver.

Because of that, a while ago we wrote these code review tips that should be acknowledged and incorporated by everyone in our team and now we want to share them with you.

Code Review is a way of sharing responsibilities and learning from each other. It’s where we can catch bugs and mistakes and it's also a way to enforce broadly agreed upon code standards between team members.

But besides knowing what code review is for, we need to know…

Ruby Magic by AppSignal 

Introduction to Ruby on Rails Patterns and Anti-patterns

Welcome to the first post in our series about Ruby on Rails Patterns and Anti-patterns. In each of the posts, we’ll take a deep dive into all sorts of patterns you might come across while working with Rails apps.

Today, we’ll show what a (design) pattern is and then try to explain what an anti-pattern is as well. To better illustrate explanations, we will use the Ruby on Rails framework that has been around for quite some time. If Rails isn’t your cup of tea for some reason, hang on, the ideas (or patterns) described here might resonate with whatever technology you wind up using.

But before we jump into explaining what patterns and anti-patterns are, how did we get to the point where we…

Greater Than Code 

194: I Don’t Need You To Like Me, I Need You To Hate Racism with Dr. Courtney D. Cogburn

02:28 - Courtney’s Superpower: Speaking on the Topic of Racism

“You can’t prioritize your discomfort over living your own values.” – Courtney

  • White Liberals Are Dangerous: the “I’m liberal...I’m not that bad” narrative
  • Action & Engaging in Antiracist Practices Over Lipservice
  • Antiracism is a Lifelong Learning Process
  • Not Seeing Race is Problematic – Disproportive Representation

13:16 - Adopting Attitudes Towards Antiracism

  • Understanding White Supremacy
  • If It’s Not Antiracist, It’s Racist

16:24 - 1000 Cut Journey

25:59 - Empathy is Insufficient

Honeybadger Developer Blog 

How to Test Ruby Code That Depends on External APIs

We strive for good test coverage in our Ruby apps but that can be hard to achieve—especially when your code makes use of external APIs.

External APIs present several problems when testing. They're provided by other people, so they could change or disappear without notice. They're subject to rate limiting, outages, and connectivity issues, and they're often slow.

In this article, we'll discuss several possible ways to test code that consumes third-party APIs. We'll start with a naive approach and show how its failings lead to more sophisticated measures like manual mocking, automated mocking, and contracts.

Calling the external API in the tests

Let's start with a straightforward, naive…

OmbuLabs Blog 

The Value of Internal Projects

With the constant pressure to both find and then execute on client projects, agencies often lose sight of the possibility of working on internal projects. While the initial reaction is often to dismiss them as a distraction from the important client facing work, carefully chosen interal projects can be very valuable. Aside from the obvious benefit of solving internal problems that might not have a readily available solution, they also provide training opportunities for developers. They give you a chance to try new ways of doing things with relatively low risk, or perhaps preview new languages and frameworks you've been considering.

Here at OmbuLabs, we use internal projects for all of…

Rails with Jason 

056 - Rails Deployment using Docker and Kubernetes with Cameron Dutro

In this episode I talk with Cameron Dutro, software engineer at quip, about deploying Rails applications using Docker and Kubernetes. Cameron has built a tool called Kuby which helps with Rails/Kubernetes deployment.

Saeloun Blog 

How to investigate your build size in Webpack

A big sized js libraries bundle is never good for the user experience. A major problem being the download time as it increases the wait time for the application to get ready.

Another issue that it causes is a bigger overhead in execution time during initialization.

Today we will look at a few ways to investigate our bundle size and the probable factors that might be increasing its size unnecessarily.

Webpack Bundle Analyzer

First up, we have a webpack plugin - webpack-bundle-analyzer.

This is a visual tool to see which components are contributing the most to the size of our bundle. It uses the webpack stats JSON file to provide us with an interactive treemap visualization of the…

Idiosyncratic Ruby 

Assignments In-Style

The introduction of pattern matching in Ruby 2.7 brought us a new style of multi-assigning local variables: The pattern assignment, or, how you could also call it, the assignment in-style.

After you have deactivated the warnings for experimental features, try the following piece of code:

[1, 2, 3, 4] in [first, second, *other]

Think: Put [1, 2, 3, 4] into [first, second, *other]

first # => 1
second # => 2
other # => [3,4]

This is a great addition to the previous two and a half ways of assigning local variables. Let's see some more examples, starting with the most basic one:

0 in a # => nil
a # => 0

When assigning multiple values, be sure to supply exactly the number of expected…

All Ruby Podcasts by Devchat.tv 

RR 466: Beating Impostor Syndrome with Dylan Andrews

In this episode of Ruby Rogues guest, Dylan Andrews (GoNoodle) shares his journey from pro-drummer to junior developer to successful senior software engineer. Dylan and the rogues talk about on-boarding junior developers and building up confidence.

Panel

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

Guest

  • Dylan Andrews

Sponsors

Rails Remote Conf 2020

Picks

Dylan Andrews:

Charles Max Wood:

Luke Stutters:

John Epperson:

The Official BigBinary Blog | BigBinary 

Rails 6.1 deprecates the use of return, break or throw to exit a transaction block

This blog is part of our Rails 6.1 series.

Rails 6.1 deprecates the use of return, break or throw to exit a transaction block.

return / break

>> Post.transaction do
>>   @post.update(post_params)
>>
>>   break # or return
>> end

# => TRANSACTION (0.1ms)  begin transaction
# => DEPRECATION WARNING: Using `return`, `break` or `throw` to exit a transaction block is
# => deprecated without replacement. If the `throw` came from
# => `Timeout.timeout(duration)`, pass an exception class as a second
# => argument so it doesn't use `throw` to abort its block. This results
# => in the transaction being committed, but in the next release of Rails
# => it will rollback.
# => TRANSACTION (0.8ms) …

throw

>> Timeout.timeout(1) do
>>   Post.transaction do
>>     @post.update(post_params)
>>
>>     sleep 3 # simulate slow request
>>   end
>> end

# => TRANSACTION (0.1ms)  begin transaction
# => DEPRECATION WARNING: Using `return`, `break` or `throw` to exit a transaction block is
# => deprecated without replacement. If the `throw` came from
# => `Timeout.timeout(duration)`, pass an exception class as a second
# => argument so it doesn't use `throw` to abort its block. This…

Here, even when the error was thrown the transaction is committed. This is something which…

The Official BigBinary Blog | BigBinary 

Rails 6.1 deprecates the use of return, break or throw to exit a transaction block

This blog is part of our Rails 6.1 series.

Rails 6.1 deprecates the use of return, break or throw to exit a transaction block.

return / break

>> Post.transaction do
>>   @post.update(post_params)
>>
>>   break # or return
>> end

# => TRANSACTION (0.1ms)  begin transaction
# => DEPRECATION WARNING: Using `return`, `break` or `throw` to exit a transaction block is
# => deprecated without replacement. If the `throw` came from
# => `Timeout.timeout(duration)`, pass an exception class as a second
# => argument so it doesn't use `throw` to abort its block. This results
# => in the transaction being committed, but in the next release of Rails
# => it will rollback.
# => TRANSACTION (0.8ms) …

throw

>> Timeout.timeout(1) do
>>   Post.transaction do
>>     @post.update(post_params)
>>
>>     sleep 3 # simulate slow request
>>   end
>> end

# => TRANSACTION (0.1ms)  begin transaction
# => DEPRECATION WARNING: Using `return`, `break` or `throw` to exit a transaction block is
# => deprecated without replacement. If the `throw` came from
# => `Timeout.timeout(duration)`, pass an exception class as a second
# => argument so it doesn't use `throw` to abort its block. This…

Here, even when the error was thrown the transaction is committed. This is something which…

Rails Performance Audit and Tuning Consultant for Hire 

How to Improve ActiveRecord Query Performance with Subquery Caching

Slow database queries are a common performance bottleneck for Ruby on Rails apps. Simplifying a complex query is often not possible due to the underlying business logic. Instead, you can extract parts of a query, cache and reuse them to improve performance. In this tutorial, I’ll describe a range of techniques on how to do it.

We will cover more advanced ActiveRecord and PostgreSQL topics like EXPLAIN ANALYZE, and query plan visualizer tool.

Let’s get started!

When subquery caching makes sense for slow ActiveRecord queries?

Subquery caching is a bit more convoluted solution for optimizing slow queries. Before you decide to implement it you should double-check if more straightforward…

The Official BigBinary Blog | BigBinary 

Rails 6.1 automatically generates an abstract class when using multiple databases

This blog is part of our Rails 6.1 series.

Rails started supporting multiple databases from Rails 6.0. To use a specific database, we can specify the database connection in the model using connects_to. In the following case we want Person model to connect to crm database.

class Person < ApplicationRecord
  connects_to database: { writing: :crm }
end

As the application grows, more and more models start sharing the same database. Now a lot of models may contain connects_to call to the same database.

class Person < ApplicationRecord
  connects_to database: { writing: :crm }
end

class Order < ApplicationRecord
  connects_to database: { writing: :crm }
end

class Sale < ApplicationRecord
  

In order to avoid the duplication, we can create an abstract class connecting to a database and manually inherit all…

The Official BigBinary Blog | BigBinary 

How to render liquid templates when the template refers to other liquid templates

Shopify’s Liquid Templates is a great way for templating in Ruby on Rails applications.

If the template is as simple as this one then there are no issues.

{% if user %}
  Hello {{ user.name }}
{% endif %}

However sometimes we have a liquid template which is using another liquid template. Here is an example.

home.liquid

<!DOCTYPE html>
<html>
  <head>
    <style>{% asset 'main.css' %}</style>
  </head>
  <body>
    {% partial 'header' %}
    <h1>Home Page</h1>
  </body>
</html>

In the above case home.liquid is using two other liquid templates main.css and header.liquid.

Let’ see what these templates look like.

main.css

* {
  color: {{ theme.text_color }};
}
a {
  color: {{…
The Bike Shed 

255: Aiming for 'Capable'

On this week's episode, Steph and Chris chat about the relatively new Rails view_component library from GitHub, Steph talks about her work with Storybook as part of extracting and defining a design system, and they chat about the attr_extras project with convenience helpers for ruby & Rails apps. They round out the conversation with some keyboard updates (ErgoDox onramp is steep!) and project rotation notes.


This episode is brought to you by ScoutAPM.
Give Scout a try for free today and Scout will donate $5 to the open source project of your choice when you deploy!


Test Double | Our Blog 

What Can You Do in 6 Weeks?

In Shape Up, we work in 6-week cycles to solve business problems. This constraint is meant to put pressure on the pitch writing process. With only 6 weeks, we must ensure that we are not biting off more than we can chew, or rather that we know we can chew (and swallow) everything we’ve bitten.
JRuby.org News 

JRuby 9.2.13.0 Released

The JRuby community is pleased to announce the release of JRuby 9.2.13.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.

Security

Concurrency

  • Int…
Saeloun Blog 

Rails 6.1.0.alpha allows relations with different SQL comments and Optimizer hints in "or"

Annotations: Before

Rails 6 has added a way to annotate the SQL queries generated by Active Record. We can read about annotations here for a quick refresher.

However, the problem was, we were not able to combine relations with SQL comments using or, as demonstrated below:

# Loading development environment (Rails 6.0.3.2)
2.5.5 :001 > User.active.annotate("active users").or(User.all.annotate("all users"))
# Traceback (most recent call last):
        # 1: from (irb):1
ArgumentError (Relation passed to #or must be structurally compatible. Incompatible values: [:annotate])

After

With the recent changes merged to master, the edge version of Rails or Rails 6.1.0.alpha fixes the above…

We…

Saeloun Blog 

Ruby 3.0 - Procs accepting a single rest argument and keyword arguments are no longer subject to autosplatting

This blog post discusses the inconsistent behaviour of procs regarding autsplatting when rest argument and keyword arguments are present.

Before

The behavior for autosplatting was inconsistent when an input is passed to procs with rest argument and keyword arguments vs when the same input is passed to procs with only rest argument.

proc_with_only_rest_argument = Proc.new { |*rest| [rest] }

proc_with_only_rest_argument.call(["content"])
 #=> [[["content"]]]

proc_with_rest_and_kwargs = Proc.new { |*rest, **kwargs| [rest] }

proc_with_rest_and_kwargs.call(["content"])
#=> [["content"]]

As we can see in the above example, for the same input both procs behaved differently. The output is…

Idiosyncratic Ruby 

Warning: The Experiment

Ruby's Warning module learned some new tricks in Ruby 2.7:

Support for muting different categories of compile warnings has been introduced. This is a mechanism on top of the warning level reflected by the $VERBOSE variable.

You can now silence deprecation warnings: These are aspects of the language which will be removed or changed in a future version of Ruby. One example is the infamous: warning: Using the last argument as keyword parameters is deprecated; maybe ** should be added to the call

It is also possible to mute experimental features warnings: These are new features of Ruby, which might not have a stable API yet, like the new pattern matching

Per Ruby

Warning[:experimental] =…
rossta.net 

A visual guide to Webpacker

Confused about how Webpacker works in Rails? Let's unpack it with some diagrams.

First, we'll see how things look when requests are served with the Rails asset pipeline in development, as a comparison.

HTML request with the asset pipeline

Rails request with the asset pipeline

With the asset pipeline, when an HTML request is processed (1), bundling takes place within your Rails server (2). The asset pipeline is responsible for creating the bundled assets in the public/assets/ directory and providing URLs to those assets to be rendered in the View.

<script src="/assets/application-3b2c...a7e.js">

Note: Please consider the diagrams in this post as approximations…

Drifting Ruby Screencasts 

Apple Silicon Developer Transition Kit

First look at the upcoming Apple Silicon processor and what it will be like for us Ruby Developers. Honestly, I wish that it was a better experience. However, with macOS Big Sur being beta and the DTK not being the final consumer hardware, there's still hope yet.
Remote Ruby 

Building Homes & Software, Translations, and Bridgetown

[00:03:02] Jason and Chris chat about moving, selling, and designing their new homes. Chris has gone down a rabbit hole lately and tells us to check out a Matt Risinger, a builder in Texas, on YouTube. 
[00:11:20] Jason talks about using Stripe's hosted billing stuff and it was a dream come true. Chris brings up Paddle and wanting to try it.
[00:21:19] Chris has been spending the past few days extracting every string out of Jumpstart Pro into Locales and he finds there some cool stuff and some annoying stuff.
[00:23:46] Andrew informs Chris that after he converted Jumpstart to Slim, he converted it back. Why?
[00:26:32] Chris talks about a new screencast he wants to do. 
[00:31:27]…
Awesome Ruby Newsletter 

💎 Issue 219 - Introducing RBS, Ruby’s new type signature language

Scott Watermasysk 

Heroku + CloudFlare + SSL

For a couple of years now, Heroku has had pretty good free’ish SSL support. You add your domain, enable auto certs, and enter a DNS record.

heroku domains add www.mkrank.com
heroku certs:auto:enable

Heroku makes it super easy, but it does come with one big drawback: Heroku does not support root (apex) level domains. Whether you should use your root domain or subdomain and if it matters is a debate for another day. All I care about here is the user experience around setting up a root level SSL cert and if it is easy to set up and maintain.

Lack of Heroku certs on root level domains is usually not a big deal. Most of your traffic likely comes from something other than a person typing a URL…

Scott Watermasysk 

MKRank.com

A couple of weeks ago, I built and released a new side project, MKRank.com.

MKRank.com

The goal of MKRank is to allow members of the mechanical keyboard community to rank some of their favorite products.

There were a couple of interesting technical changes I need to write up for this site (SSL, Stimulus.js, Tailwind, and the leaderboards in particular).

From an app perspective, similar to HowIVSCode, I am determined to build this without the need to market to the existing user base continually. I am not collecting emails, no tracking, etc.

Lack of contact information means growth will be slow, but new people are signing up daily, and I have been able to keep adding new content consistently.

If it…

Ruby Weekly 

An interview with Michael Hartl

#512 — July 30, 2020

Read on the Web

🎉 At the end of this week's issue we have an interview with the man, the legend, Michael Hartl of Rails Tutorial fame – don't miss it 😄

Ruby Weekly

The State of Ruby 3 Typing: Introducing RBS — Back in May we mentioned RBS, a language being used for type signatures in Ruby programs, but this is a much more accessible introduction to the concepts around it. RBS and the tooling around it will ship with the eventual Ruby 3.

Soutaro Matsumoto

RubyMine 2020.2 Released — RubyMine is a commercial Ruby IDE but popular enough for a release to be noteworthy :-) There’s a new…

OmbuLabs Blog 

Understanding Bundler - To `bundle exec` or not? that is the question

We, Ruby developers, are used to running scripts or commands with the prefix bundle exec, but sometimes it's not needed, but sometimes it is, and when it's not needed it still works just fine if we add it. So it may not be clear why we need to use it in some cases.

In this blogpost I'll try to answer these questions with a little insight on what Bundler (and Ruby and Rubygems) do.

What does Bundler do?

We use Bundler for a few different things:

  • Resolve dependencies and versions for all the gems required in a project
  • Store the calculated versions in a file so all the developers have the same gem versions
  • Make sure our Ruby code has access to those specific versions of the gems
  • We can…

I'm only going to talk about how Bundler makes sure our code uses specific versions of the gems.

The Problem

When we are…

The Official BigBinary Blog | BigBinary 

Rails 6.1 adds annotate_rendered_view_with_filenames to annotate HTML output

This blog is part of our Rails 6.1 series.

Rails 6.1 makes it easier to debug rendered HTML by adding the name of each template used.

Rails 6.1

Add the following line in development.rb file to enable this feature.

config.action_view.annotate_rendered_view_with_filenames = true

Now the rendered HTML will contain comment indicating the begining and end of each template.

Here is an example.

Annotated HTML output

In the image we can see the begin and end for each of the templates. It helps a lot in debugging webpages to find out which template is rendered. Check out the pull request for more details on this.

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

RubyMine 2020.2 Released: Better Code Assistance and VCS Integration, Liquid Support, and More!

RubyMine 2020.2 Released

RubyMine 2020.2 is here!
Check out the video overview or visit the What’s New page to learn about all the new additions.

Build highlights

Here are some of the biggest highlights you need to know about in RubyMine 2020.2:

A new way to review and fix problems in code

We’ve added a new widget that shows the number of issues in the current file. Clicking it opens a tool window with a list of those issues. From there, you can jump to the code containing an issue, or you can fix issues directly from the tool window.

A new way to review problems in code

Support for Liquid template language

RubyMine 2020.2 includes basic support for the Liquid template language. The IDE will show you if there are any issues with the syntax,…

Ruby on Rails Podcast 

328: rails new cool_app --minimal with Haroon Ahmed

This week, Brittany is joined by Haroon Ahmed, a programmer from Coventry, UK. He is a Hacker, Rubyist, and open source contributor. They discuss his latest contribution to Rails (--minimal) and how OS can open up career opportunities for developers.

Links for this episode:

Brought to you by:

ExpressVPN

ExpressVPN makes sure your ISP can’t see what sites you…

solnic.codes 

Be cautious with Ruby coercion methods

Coercion is a tricky problem to solve and it’s something we need pretty much everywhere. Whether you’re building a web application or a CLI tool, you will have to coerce values in some way. I say it’s a tricky problem because Ruby comes with many builtin coercion methods but it’s not enough. Furthermore, the builtin methods may actually lead to bugs or surprising behaviors.

In this article we’ll take a look at the builtin coercion methods, various caveats that come with their usage and ways how you can handle coercion in a more predictable and strict way.

Instance coercion methods

Let’s start with the most problematic type of coercion methods – instance coercion methods that start…

Greater Than Code 

193: Optimizing For Happiness with Tudor Gîrba

02:09 - Tudor’s Superpower: Storytelling

  • Getting Beyond Your Self-Critic
  • Writing Code is Storytelling
  • There’s No Semantics Without Syntax

13:04 - Reading Stories (and Code)

  • Reading Code Takes Place in an Editor
  • Code is Not Text. Code is Data.

17:56 - Optimizing For Happiness

  • Automation Creates More Jobs
  • Choosing Tools is Important

“The tools that we create end up influencing how we see the world.” – Marshall McLuhan

27:48 - Moldable Development

32:50 - Editing Code as a Joint Activity

  • rust-analyzer
  • Simultaneous Perspectives Increase Communication Bandwidth

38:40 - Encouraging and Supporting the…

Valentino Gagliardi - RSS Feed 

Deploying a FastAPI app with Docker, Traefik, and Let's Encrypt

Deploying a FastAPI app with Docker, Traefik, and Let's Encrypt

While fitting all the pieces together for configuring Traefik with Docker and Let's Encrypt I ended up with fifteen browser's tab open.

This guide is an attempt to spare you an hour or so. Enjoy!

Requirements

To follow along with this guide you should have:

  • a basic understanding of Docker and Docker Compose.
  • Docker and Docker Compose installed on your local machine.

For deploying in production:

  • Docker and Docker Compose installed on a remote machine (a Digital Ocean or Hetzner VPS will do).
  • a registered domain for requesting SSL certificates in production.
RubyGems Blog 

API key logging leak

API key logging leak

Summary

407 user API keys were inadvertently sent to a third-party service via HTTP logs between Oct 2018 and Jul 2020. The data was available to the public, but based on the service’s query logs, no one ever queried for any of the API keys that were sent.

Out of an abundance of caution, we have reset all 407 API keys. We are also updating the API key system to reduce the chance this type of issue could happen again in the future.

What happened

RubyGems.org started sending Fastly and Nginx access logs to Honeycomb in October 2018. Honeycomb provides public access to the RubyGems.org dataset, and there is lots of useful and interesting data there about the Ruby…

Honeybadger Developer Blog 

Protecting Your Apps From Link-based Vulnerabilities: Reverse Tabnabbing, Broken-Link Hijacking, and Open Redirects

Links! They're the very fabric of the Web. Browsing simply wouldn't be possible without them. Creating and following links feels so natural that you probably don't stop very often to wonder about the risks associated with them. In this post, I want to cover three vulnerabilities involving links: broken-link hijacking, open redirects, and reverse tabnabbing.

Broken-link hijacking

You probably share useful resources in your blog posts, on your social networks, etc. By linking to some third-party website and inviting your readers, though, you're implicitly establishing some kind of contract with them. You're essentially saying:

Hey! We believe that the resource accessible at the end of…

Rails with Jason 

055 - When NOT to use Rails with Noah Gibbs

In this episode I talk with Noah Gibbs about when NOT to use Rails. We also talk about aliens, cephalopods, and several other pertinent topics.

Links:

All Ruby Podcasts by Devchat.tv 

RR 465: WebAuthn in Ruby with Gonzalo Rodriguez and Braulio Martinez

As the world becomes more security conscious, we need to think about the ways we allow people to authenticate to our applications. WebAuthn is a standard that allows you to accept biometric, device based, and other types of authentication as a second or first factor. Gonzalo and Braulio have published a gem that allows you to add webauthn to your Ruby applications and have joined the Rogues to talk through the implications of using it in your applications.

Panel

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

Guests

  • Gonzalo Rodriguez
  • Braulio Martinez

Sponsors

Rails Remote…

Prathamesh Sonpatki 

How I write tests for my Rails (API) apps

How I write tests for my Rails (API) apps

These days I am building lot of Rails APIs and in this post I will discuss my approach for writing tests.


TLDR;

  • Drive code by integration tests to get quick feedback.
  • Integration tests over unit tests.
  • Don't chase 100% test coverage.
  • Testing outcomes over internals.

Background

Broadly there are two types of tests, unit tests and integration tests. Unit tests test a part of code in isolation whereas the integration tests test multiple pieces of the code together. Rails provides a testing DSL built on top of minitest out of the box which supports writing unit tests, integration tests in the form of system tests. RSpec - which is another testing library in the Ruby ecosystem - supports writing…

The Bike Shed 

254: Listener Mailbag Roundup Rodeo

On this week's episode, Steph celebrates passing an important test and discovers an API that returns different data than it's provided while Chris asks the important bikeshed question "What is the proper maximum line length?".

They also roundup the latest listener questions and discuss establishing freelancing rates, property-based testing, and time tracking skills that help them manage competing priorities.


This episode is brought to you by ScoutAPM.
Give Scout a try for free today and Scout will donate $5 to the open source project of your choice when you deploy!


Sponsored By:

Valentino Gagliardi - RSS Feed 

A checklist for investigating slowness in web applications

A checklist for investigating slowness in web applications

More often than not I find myself dealing with legacy web applications of any kind (mostly Python and PHP). Sometimes these websites and applications can show signs of slowness, or they become slow all of a sudden once migrated to a new environment.

Most issues are low hanging fruit, and don't require complex instrumentation. In all these cases it's important to have a simple checklist to investigate and solve these issues quickly. Here's mine!

1. Check DNS resolution and outgoing HTTP requests

This is old but gold. DNS resolution problems are frequent and subtle.

Sometimes a web application becomes too slow without any clear cause. Before setting up more serious…

The Rails Tech Debt Blog 

OmbuLabs Open Source Guidelines

Contributing to open source projects is a big part of our philosophy at OmbuLabs. It’s even written into our values. Some of us like to contribute to open source even in our spare time!

Recently we have been thinking about what guidelines we should follow when starting a new open source project, and also about how to organize and keep track of the ones we contribute to.

This article will give you some tips on keeping those open source projects organized, and also how to start them off on the right foot.

Creating new Open Source projects.

When creating a new OSS project these are some important things to include in the README.

Description of the Project

A good description of the…

Code with Jason 

How to Dockerize a Sinatra application

Why we’re doing this

Docker is difficult

In my experience, Dockerizing a Rails application for the first time is pretty hard. Actually, doing anything with Docker seems pretty hard. The documentation isn’t that good. Clear examples are hard to find.

Dockerizing Rails is too ambitious as a first goal

Whenever I do anything for the first time, I want to do the simplest, easiest possible version of that thing before I try anything more complicated. I also never want to try to learn more than one thing at once.

If I try to Dockerize a Rails application without any prior Docker experience, then I’m trying to learn the particulars of Dockerizing a Rails application while also learning the…

Saeloun Blog 

Rails makes ActiveStorage `web_image_content_types` configurable

Rails added config.active_storage.web_image_content_types option to ActiveStorage which allows application to make content types configurable.

Before

The image variants were defined in ActiveStorage::Variant class as below.

WEB_IMAGE_CONTENT_TYPES = %w[ image/png image/jpeg image/jpg image/gif ]

WEB_IMAGE_CONTENT_TYPES constant was used in the Rails code for identifying and processing the image variant.

And if the image content-type is different from the above constant, it would fallback to default PNG format.

After

We can now add the image variants in our configuration file with this ActiveStorage update, as below

config.active_storage.web_image_content_types = %w(image/jpeg…

The above config…

Julia Evans 

Some CSS comics

Hello! I’ve been writing some comics about CSS this past week, and I thought as an experiment I’d post them to my blog instead of only putting them on Twitter.

I’m going to ramble about CSS at the beginning a bit but you can skip to the end if you just want to read the comics :)

why write about CSS?

I’ve been writing a tiny bit more CSS recently, and I’ve decided to actually take some time to learn CSS instead of just flailing around and deciding “oh no, this is impossible”.

CSS feels a little like systems programming / Linux to me – there are a lot of counterintuitive facts that you need to learn to be effective with it, but I think once you learn those facts it gets a lot easier.

S…

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

RubyMine 2020.1.4 Is Available

RubyMine 2020.1.4 bug-fix update is now available!
You can update to it using the Toolbox App or right from inside the IDE. You can also download RubyMine 2020.1.4 from our website.

You’ll find the following important fixes in this update:

Check out the release notes for the complete list of closed tickets. And as always, please report any issues you encounter.

Happy developing!
The RubyMine team

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

RubyMine 2020.2 Release Candidate

RubyMine 2020.2 Release Candidate is now available! This new build adds some finishing touches in preparation to deliver a major update of RubyMine.

To catch up on what has already been implemented in v2020.2, check out our previous EAP blog posts. In this post, we’ll talk about a couple of features that we haven’t announced yet.

In-editor RDoc/YARD documentation comments rendering

Reading RDoc or YARD docs in the editor can be annoying because of all the tags you have to wade through, for example, when you need to interact with reference links. This is why we’re adding a way to render documentation directly in the…

Enable the…

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

RubyMine 2020.2 Release Candidate

RubyMine 2020.2 Release Candidate is now available! This new build adds some finishing touches in preparation to deliver a major update of RubyMine.

To catch up on what has already been implemented in v2020.2, check out our previous EAP blog posts. In this post, we’ll talk about a couple of features that we haven’t announced yet.

In-editor RDoc/YARD documentation comments rendering

Reading RDoc or YARD docs in the editor can be annoying because of all the tags you have to wade through, for example, when you need to interact with reference links. This is why we’re adding a way to render documentation directly in the…

Enable the…

Remote Ruby 

Futurism, Jumpstart, and Javascript Dependencies

[00:02:20] Andrew and Chris chat about Slim, Tailwind, and Components.  They also mention Steve Schoger and Adam Wathan, who are the creators, designers, and developers of Tailwind CSS, and how they built this framework and then taught you how to use it. 
[00:08:32] Andrew talks about why he’s been invested in Tailwind since college. Chris talks about how you can a lot of Bootstrap themes in Tailwind. The guys also discuss GitHub and Patreon sponsorships.
[00:14:57] Webpack configs is talked about here with node modules and peer dependencies. 
[00:19:34] Andrew talks about rails developers and how their packages could be bundled and shipped better. The guys also discuss the Pika Pack…
Awesome Ruby Newsletter 

💎 Issue 218 - Ruby Method Overloading

Ruby Weekly 

Pumas, Unicorns, Prizes, and Stimulus(.js)

#511 — July 23, 2020

Read on the Web

Ruby Weekly

GitLab on Its Migration from Unicorn to Puma — While GitLab is running at a pretty large scale, these two application servers are widely used throughout the Ruby community, so it’s interesting to see what conclusions GitLab came to.

GitLab

Announcing the 2021 Fukuoka Ruby Award — Each year, the government of Fukuoka, Japan, collaborates with Matz (the creator of Ruby!) to offer an award to an interesting Ruby program or system developed or updated over the past year – the award will make you a millionaire, too, in Japanese Yen at least 😄 Matz will be…

Saeloun Blog 

ACID transactions in every day applications

ACID, a term coined by Andreas Reuter and Theo Härder in 1983 describing the requirements a database must possess for the reliable processing of transactions. They build it on earlier work done by Jim Gray who enumerated atomicity, consistency, and durability but left out isolation.

To most web developers, databases and ACID properties can be mundane, but they are extremely beneficial. In recent years, there have been plenty of trending non-ACID databases, but even if they don’t support ACI, they tend to get the durability correct which essentially guarantees that if the system blows up, your data would be safe!

A lot has been written on the topic, so we won’t be covering the…

Prathamesh Sonpatki 

Installing Timescaledb on Mac OS X with Postgres.app

I use Postgres.app to manage PostgreSQL on my Mac. I wanted to install Timescaledb locally and ran into few issues while installing it which are discussed in this post.

Timescaledb is an open-source database built for analyzing time-series data which is built on top of PostgreSQL.

Timescaledb allows installation on OS X via two mechanisms - via Source and via Homebrew. If we are using PostgreSQL managed by Homebrew then we can install Timescaledb also via Homebrew. But if we want to use Timescaledb along with Postgres.app then we have to install it via Source as per Timescaledb documentation.

Prerequisite

Before starting the installation make sure that the pg_config path is using the path of pg…

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

RubyMine 2020.1.4 Is Available

RubyMine 2020.1.4 bug-fix update is now available!
You can update to it using the Toolbox App or right from inside the IDE. You can also download RubyMine 2020.1.4 from our website.

You’ll find the following important fixes in this update:

Check out the release notes for the complete list of closed tickets. And as always, please report any issues you encounter.

Happy developing!
The RubyMine team

Ruby on Rails Podcast 

327: JetBrains & RubyMine with Natalie Kudanova

Natalie Kudanova is a product marketing manager for JetBrains RubyMine, an IDE for Ruby and Rails developers. She helps the RubyMine team understand the needs of their users. In this short episode, she and Brittany discuss the best way to reach Ruby developers and IDE innovations.

Links for this episode:

Brought to you by:

Datadog

Do you have an app in production that is slower than you like? Is its performance all over the place (sometimes fast, sometimes slow)? Do you know why?

Greater Than Code 

192: Bringing Our Whole Selves with Siobhán Cronin

02:36 - Siobhán’s Superpower: Catalyzing Personal and Community Change

04:19 - Managing Change During COVID-19

  • Experiencing Joy While Grieving
  • Bringing Your Whole Self to Work (a boundary being stretched like never before)
  • Working From Home: Ranges of Experiences and Comfort-Levels

13:51 - Pros and Cons of Bringing Your Whole/Full Self to Work

  • Building Affinity & Care
  • Interfacing with Capitalism
  • Painpoints as Learning Opportunities
  • Having Boundaries
  • Building Inclusive Communities and Workspaces
  • Extending Grace and Care

34:08 - People Have to Do Work on Themselves

“You’re not categorically a good person.” – Siobhán

  • Check Yourself: Look at Yourself Honestly
  • Psychological…

Reflections:

John: How can we…

Alfredo Motta 

Not So Random Software #35 – This is Water

Hello everyone and welcome back to Not So Random Software! This week has been one of reflection and thinking. It’s often the case that I …
rossta.net 

Why doesn't Webpacker use my test config when I run Rails tests?

Here's something you might not expect: when running Rails tests, Webpacker will load the development webpack config instead of the test config by default.

To demonstrate, I'll use some "puts" debugging. Here's a console.log statement in the development config.

// config/webpack/development.js
// ...
console.log('Loading config/webpack/development.js...')

When I run my RSpec tests while logging to STDOUT and RAILS_ENV set to test, the log line is displayed.

$ RAILS_LOG_TO_STDOUT=true RAILS_ENV=test bin/rspec

# ...
[Webpacker] Compiling...
# ...
[Webpacker] Loading config/webpack/development.js...
# ...

If you've noticed this before, there's nothing wrong with your setup; this is the…

Rails with Jason 

054 - Third-Party APIs, Refactoring and Roller Derby with Brittany Martin

In this episode I talk with Brittany Martin, Lead Web Developer at the Pittsburgh Cultural Trust and host of the 5x5 Ruby on Rails Podcast. Brittany and I talk about working successfully with poor-quality APIs, whether to extract application code into gems or not, and, of course, roller derby.

All Ruby Podcasts by Devchat.tv 

RR 464: PWAs on Rails with John Beatty

 

John Beatty joins the Rogues to talk about building Progressive Web Applications on Ruby on Rails. He walks the Rogues through the ins and outs of building a PWA and what it’s like adding the features you need to get a PWA set up on Rails. It turns out to be surprisingly straightforward and yet has a ton of potential.

Panel

  • John Epperson
  • Matt Smith
  • Charles Max Wood

Guest

  • John Beatty

Sponsors

Rails Remote Conf 2020

Links

Picks

John Beatty:

John Epperson:

The Official BigBinary Blog | BigBinary 

Rails 6.1 allows enums attributes to configure the default value

Rails 6.1 makes it easier to configure a default value for Active Record enum attributes.

Let’s take an example of blog posts with status and category columns.

class Post < ApplicationRecord
  enum status: %i[draft reviewed published]
  enum category: { rails: "Rails", react: "React" }
end

Before Rails 6.1, defaults for enum attributes can be configured by applying default on the database level.

class AddColumnStatusToPosts < ActiveRecord::Migration[6.0]
  def change
    add_column :posts, :status, :integer, default: 0
    add_column :posts, :category, :string, default: "Rails"
  end
end

After Rails 6.1, defaults for enum attributes can be configured directly in the Post model using _d…

The Bike Shed 

253: Find Yourself Through The Art of Podcast

On this week's episode, Steph and Chris have a brief chat about Snowpack, a new and ultra-speedy bundler in the front-end world, and revisit a conversation around namespacing models in Rails. The conversation then shifts to a discussion of the ins and outs of hosting a podcast and how folks might be able to dive in if they're interested in starting one themselves -- from selecting topics, to the hardware and software they use, to the guiding philosophy in how to discuss technical concepts.


This episode is brought to you by:

  • ScoutAPM - Give Scout a try for free today and Scout will donate $5 to the open source project of your choice when you deploy
  • Indeed - Click through and…

Ruby Together News 

June 2020 Monthly Update

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

ruby together news

In June, Ruby Together was supported by 44 different companies, including Ruby member Zendesk and Sapphire member Stripe. Those companies were joined by 102 developer members. Thanks to all of our members for making everything that we do possible. <3

rubygems news

In June, RubyGems saw significant improvements to the Bundler and RubyGems development process. We released Bundler 2.2.0.rc.1 and RubyGems 3.2.0.rc.1! 🎉

We also worked on synchronizing the latest versions of both libraries with ruby-core, and fixed issues that came up. We also …

A Year of Commits 

Making RSpec Tests More Robust

RSpec is a popular framework for testing Ruby code. With an expect assertion, a developer can make sure their code calls the proper method or an acceptable result is returned. The expect().to receive matcher in a test overrides the default implementation and can cause some unintended side effects.

To demonstrate this potential problem, assume a very simple API client exists that can update models.

Testing an API Client

An example api_client.rb class defines a single put method that calls the underlying API with a Faraday connection.

# api_client.rb

class APIClient
  def put(url, body)
    client.put(url, body)
  end

  private

  def client
    Faraday.new('https://some-cool-api.com')

Inheriting from api_client.rb is my_model.rb which defines an update method.

# my_model.rb

class MyModel < AP…
Ruby News 

2021 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.

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

Entry Deadline: December 4, 2020

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 #34 – Risk, the strategy game

Hello everyone and welcome back to Not So Random Software! I have been enjoying the summer time in UK lately and with lockdown looking for …
Awesome Ruby Newsletter 

💎 Issue 217 - 99 Bottles of OOP - 2nd Edition Released

The Ruby Blend 

Episode 18: Interviewing

The Ruby Blend - Episode 18

Welcome to The Ruby Blend! The guys catch up on what's been going on
this week. Ron has been taking an insurance class with his work to learn
the ins and outs of the insurance industry, Nate's been busy working
with Code Fund becoming an independent company, and Andrew has been on
the interviewing circuit trying to find a new job. Which leads us into
the topic of today's episode, which is "Interviewing." The guys chat all
about all different things they've experienced over the years with the
interviewing process and all the different things they've encountered
with finding new jobs over the years. They do have some bits of advice
to share as well.…

Ruby Weekly 

Workflows, testing, and why you might want to log into RubyGems.org

#510 — July 16, 2020

Read on the Web

Ruby Weekly

Introduction to AWS Simple Workflow Service (SWF) — SWF is used for building and managing background jobs made up of numerous parallel or sequential steps, and like many AWS services it gets complicated fast despite the 'simple' moniker. This post covers the concepts along with a Ruby based example.

Adrian Ancona

System of a Test: Proper Browser Testing in Rails — Covers a few good practices for end-to-end browser testing in Ruby. Focuses on using Ferrum and Cuprite instead of Selenium and writing tests into your Rails app.

Vladimir Dementyev

Sco…

code.dblock.org | tech blog 

Comparing Version Numbers in Ruby

Time and again, developers fail to compare gem or ruby version numbers correctly. It’s an easy mistake to make.

> RUBY_VERSION
 => "2.6.6"
> RUBY_VERSION > '2.7.7'
 => false # ok
> RUBY_VERSION > '2.6.5'
 => true # ok
> RUBY_VERSION > '2.10.0'
 => true # ouch

There’s a great post that comes up on top of Google that recommends using Gem::Version.

> Gem::Version.new(RUBY_VERSION)
 => #<Gem::Version "2.6.6">
> Gem::Version.new(RUBY_VERSION) > Gem::Version.new('2.7.7')
 => false # ok
> Gem::Version.new(RUBY_VERSION) > Gem::Version.new('2.6.5')
 => true # ok
 > Gem::Version.new(RUBY_VERSION) > Gem::Version.new('2.10.0')
 => false # ok

This works correctly, including for pre-release versions.

Prathamesh Sonpatki 

Custom directory for Webpacker in Rails apps

Starting from Rails 6, Webpacker is the default JavaScript compiler for Rails apps.

By default, Rails recommends adding the Webpacker related JavaScript code in app/javascript directory. A lot of people wanted to place the JavaScript code in custom directory instead of app/javascript. It is now possible to customize it.

You just need to set the source_path in the config/webpacker.yml to the directory relative to the app folder where you want to place the Webpacker JavaScript code.

# config/webpacker.yml

default: &default
  source_path: app/frontend

This change is available in Webpacker gem from version 4.1.0 onwards and in Rails from Rails 6.0.1 onwards.

With this change, we can place our…

Honeybadger Developer Blog 

Building a Toy Lexer in Ruby

Full Source on Github

A complete implementation of the Stoffle programming language is available at GitHub. This reference implementation has a lot of comments to help make reading the code easier. Feel free to open an issue if you find bugs or have questions.

In this blog post, we're going to implement the lexer for Stoffle, a toy programing language built entirely in Ruby. You can read more about this project in the first part of this series.

Learning how to build a lexer, even if it's a simple one, will make you a better programmer. It will help you understand how programming languages really work and will open doors to other fields, such as natural-language processing. It might…

Engine Yard Blog 

Announcing The New Engine Yard Kontainers

At Engine Yard we are on a continuous journey to provide you with tools to minimize your operational burden, moving you towards friction free NoOps application deployments.  Today we are pleased to share an exciting new capability which was one of the top asks from our Ruby community.  Yes, we are talking about support for containers in Engine Yard.

RubyGems Blog 

Removing SHA1 passwords from RubyGems.org

When the RubyGems.org Rails app was created in 2009, the “standard” way to store passwords was to use the SHA1 hashing algorithm. While there were limited academic attacks against SHA1 published as early as 2005, practical attacks didn’t arrive until the mid-2010s. Today, SHA1 is is widely considered insecure, and there are much better options available.

RubyGems.org switched to using BCrypt by default for new accounts in 2013. As part of that switch, users from before 2013 are automatically migrated from SHA1 to BCrypt the next time they log in. In the coming days, RubyGems.org will be removing the remaining SHA1 passwords for any user who has not logged in to their account since 2013.

A…

RubyGems Blog 

June 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 June.

RubyGems News

In June, RubyGems saw significant improvements on Bundler and RubyGems development. We released Bundler 2.2.0.rc.1 and RubyGems 3.2.0.rc.1! 🎉

We also worked on synchronizing the latest versions of both libraries with ruby-core, and fixed issues that came up. We also enforced our ruby-core workflow to try to prevent further tedious integrations with ruby-core in the future by catching issues early and minimizing the back and forth of patches between…

We…

Ruby on Rails Podcast 

326: Job Searching and Hiring Advice During the Pandemic with Brian Mariani

A timely episode for the employers hiring and the Ruby developers looking for work during the pandemic. After a heartfelt story, Brian Mariani, founder of Mirror Placement, revealed hiring patterns and honest advice for these unprecedented times.

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 for Application Performance Monitoring: Ruby support for Raygun APM. Don’t wait for users to report…

Greater Than Code 

191: Sitting Down Together with Amy Tobey

02:14 - Amy’s Superpower: Looking at a mess and seeing the potential for what it could be.

03:40 - Generalists vs Specialists

“The job description should describe the capabilities that the team needs, not that the individual needs.”

15:28 - Finding a “Beautiful” Mess in Technical Systems

“The biggest impediment to change is your users.” – Jessica

22:40 - Artisanal and Industrial Modes of Production

  • Systems are indelibly stamped by the experience of the people who built them

28:25 - Design, Use, and Reliability

32:30 - Convincing Executives to Care About a…

Rails with Jason 

053 - Tim Cheadle, Director of Engineering at Resolve to Save Lives

In this episode I talk with Tim Cheadle, Director of Engineering at Resolve to Save Lives. Tim and I discuss the app Tim works on, called Simple, which helps healthcare professionals in India and elsewhere manage hypertension patients' needs. We also talk about scaling issues and usability testing.

Julia Evans 

When your coworker does great work, tell their manager

I’ve been thinking recently about anti-racism and what it looks like to support colleagues from underrepresented groups at work. The other day someone in a Slack group made an offhand comment that they’d sent a message to an engineer’s manager to say that the engineer was doing exceptional work.

I think telling someone’s manager they’re doing great work is a pretty common practice and it can be really helpful, but it’s easy to forget to do and I wish someone had suggested it to me earlier. So let’s talk about it!

I tweeted about this to ask how people approach it and as usual I got a ton of great replies that I’m going to summarize here.

We’re going to talk about what to say, when to…

Rails with Jason 

053 - Tim Cheadle, Director of Engineering at Resolve to Save Lives

In this episode I talk with Tim Cheadle, Director of Engineering at Resolve to Save Lives. Tim and I discuss the app Tim works on, called Simple, which helps healthcare professionals in India and elsewhere manage hypertension patients' needs. We also talk about scaling issues and usability testing.

Martian Chronicles, Evil Martians’ team blog 

System of a test: Proper browser testing in Ruby on Rails

Author: Vladimir Dementyev, Lead Developer at Evil Martians

Discover the collection of best practices for end-to-end browser testing of Ruby on Rails applications and adopt them in your projects. See how to ditch Java-based Selenium in favor of leaner, meaner Ferrum-Cuprite combo that uses Chrome DevTools Protocol directly through pure Ruby. And if you use Docker for development—we’ve got you covered too!

Disclaimer: This article is being regularly updated with the best recommendations up to date, take a look at a Changelog section.

Ruby community is passionate about testing. We have plenty of testing libraries, there are hundreds of blog posts on the topic, we even had a dedicated

All Ruby Podcasts by Devchat.tv 

RR 463: Can We Fix What We Can't See? with James Thompson

 

Join the 30-DAY CHALLENGE: "You Don't Know JS Yet"

In this episode of Ruby Rogues, James Thompson, a Software Architect at Mavenlink, delves into how to address errors in a service-based system and how to prioritize what errors to fix. He goes into how to recognize the errors when they are creeping in and so much more.

Panel

  • Dave Kimura
  • John Epperson
  • Matt Smith
  • Luke Stutters

Guest

  • James Thompson

Sponsors

Rails Remote Conf 2020

Links

Picks

James Thompson:

  • Follow James on Twitter @pl…
RubyMine: The Ruby on Rails IDE – RubyMine Blog | JetBrains 

RubyMine 2020.2 Beta

RubyMine 2020.2 Beta banner

RubyMine 2020.2 Beta is available!

To give you a picture of what the upcoming 2020.2 release will look like, here is a roundup of the most notable new features.

The links will take you to the EAP posts published over the last few months, which contain detailed descriptions of each feature.

Note that Beta builds are significantly more stable than EAP builds, but some issues might still arise. If you run into any, please report them to our issue tracker. No license is required to use this build.

Liquid template language support

The upcoming RubyMine 2020.2 includes basic support for the Liquid template language:

  • Support for Liquid syntax, including tags or braces like {{, {{-, {%, {%-. The…
The Official BigBinary Blog | BigBinary 

Rails 6.1 adds support for where with a comparison operator

Rails 6.1 adds support to comparison operator in the where clause. The four comparison operators supported are:

  • Greater than (>).
  • Greater than equal to (>=).
  • Less than (<).
  • Less than equal to (<=).

The comparison operator is also supported by the finder methods in ActiveRecord which internally uses where clause, for example: find_by, destroy_by, delete_by.

The new style for comparisons has to follow advantages:

  • The where clause with the comparison operator doesn’t raise an exception when ActiveRecord::Relation uses ambiguous column name.
  • The where clause with the comparison operator handle proper precision of the database columns.

Before Rails 6.1, to add a condition with…

Passenger - Phusion Blog 

Passenger 6.0.6

Passenger 6.0.6

Version 6.0.6 of the Passenger application server has been released. This release is mainly focused on compatibility with the new Ubuntu Focal Nginx package release.

Passenger 6, introduced Generic Language Support, or: the ability to support any and all arbitrary apps.

Updates & improvements

  • Update gemspec with up to date metadata.

  • Reverts the addition of the 'etc' gem to the Passenger gemspec, because it broke on normal ruby installs. Closes GH-2283.

  • Builds Ubuntu focal Nginx dynamic module package against Nginx 1.18.0. Closes GH-2291.

  • No longer providing prebuilt Ruby 2.1 or 2.2 binaries, they have been EOL for years and rubygems no longer supports them.

  • Updated various library…

Installing 6.0.6

Please see the installation guide for advice on getting started with Passenger. Coming from a…

The Bike Shed 

252: I'm a Designer Now

On this week's episode, Steph and Chris discuss leveraging the Unix utility sed to search files and remove unnecessary test setup, using Vim's Arglist to create a to-do list for file edits, and budgeting time for fancy command-line scripts. They then take a deep dive into the world of utility-first CSS and TailwindCSS.


This episode is brought to you by:

  • ScoutAPM - Give Scout a try for free today and Scout will donate $5 to the open source project of your choice when you deploy
  • ExpressVPN - Click through to get get an extra three months FREE on a one-year package

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

RubyMine 2020.2 Beta

RubyMine 2020.2 Beta banner

RubyMine 2020.2 Beta is available!

To give you a picture of what the upcoming 2020.2 release will look like, here is a roundup of the most notable new features.

The links will take you to the EAP posts published over the last few months, which contain detailed descriptions of each feature.

Note that Beta builds are significantly more stable than EAP builds, but some issues might still arise. If you run into any, please report them to our issue tracker. No license is required to use this build.

Liquid template language support

The upcoming RubyMine 2020.2 includes basic support for the Liquid template language:

  • Support for Liquid syntax, including tags or braces like {{, {{-, {%, {%-. The…
Martian Chronicles, Evil Martians’ team blog 

Apollo launch: Building a migration architecture for 2U

Authors: Irina Nazarova, Account Manager at Evil Martians and Sergey Ponomarev, Team Lead at Evil Martians

The microservice stitching gateway at 2U, once designed to empower a distributed development process for multiple standalone engineering teams, suddenly made it too hard due to growing inefficiency and complexity. Martians helped company’s services to declare independence again, migrating the platform to Apollo GraphQL Federation.

2U, Inc. is a global leader in education technology and a trusted partner and brand steward of great universities. 2U builds, delivers, and supports more than 400 digital and in-person educational offerings, including graduate degrees, professional…

Code with Jason 

Intro to logical arguments for programmers

What it means to be wrong and why it’s bad

Logical incorrectness

It’s generally better to be right than to be wrong. Since there’s more than one way to be wrong, I want to be specific about the type of wrongness I want to address in this post before I move on.

The type of wrongness I’m interested in in this post is logical incorrectness, like two plus two equals five.

The danger of being wrong

Being right or wrong isn’t just an academic concern. In programming, being wrong often has concrete negative economic (and other) impacts. Developers who are often wrong will be much less efficient and burn up much more payroll cost and opportunity cost than developers who are wrong less often.

Being…

Julia Evans 

scanimage: scan from the command line!

Here’s another quick post about a command line tool I was delighted by.

Last night, I needed to scan some documents for some bureaucratic reasons. I’d never used a scanner on Linux before and I was worried it would take hours to figure out. I started by using gscan2pdf and had trouble figuring out the user interface – I wanted to scan both sides of the page at the same time (which I knew our scanner supported) but couldn’t get it to work.

enter scanimage!

scanimage is a command line tool, in the sane-utils Debian package. I think all Linux scanning tools use the sane libraries (“scanner access now easy”) so my guess is that it has similar abilities to any other scanning software. I…

Julia Evans 

Twitter summary from 2020 so far

Hello! I post a lot of things on Twitter and it’s basically impossible for anyone except me to keep with them, so I thought I’d write a summary of everything I posted on Twitter in 2020 so far.

A lot of these things I eventually end up writing about on the blog, but some of them I don’t, so I figured I’d just put everything in one place.

I’ve made most of the links to non-Twitter websites.

comics

Let’s start with the comics, since that’s a lot of what I write there.

debugging

These are from a debugging zine I’m still trying to finish. (https://wizardzines.com/zines/bugs/)

Remote Ruby 

Exploring HEY's Gemfile

Welcome to Remote Ruby!  The guys are all back together this week! In the last episode, COVID-19 was talked about, so the guys want to shift the focus to new and better things happening in the Gem world, like DHH’s Hey’s Gemfile and Basecamps Gemfile.  Jason made an Avatar Component and how he uses formBuilder. They guys also talk about WebAuthn Gem, Two-factor Authentication, and Turbolinks. There are some newer Gems out there they discuss as well and some of their favorites.  Jason brings back another question of the week to see if it will get answered. Will Jason’s secret question get answered? Download this episode now! 
[00:04:21] The guys chat about DHH’s Hey’s Gemfile,…
RubyMine: The Ruby on Rails IDE – RubyMine Blog | JetBrains 

RubyMine 2020.1.3 Is Available

RubyMine 2020.1.3 bug-fix update is now available!

You can update to it using the Toolbox App or right from inside the IDE. You can also download RubyMine 2020.1.1 from our website.

You’ll find the following important fixes in this update:

  • Fixed an issue causing delays when applying auto-completion: JBR-2475
  • Fixed an issue causing excessive CPU usage: RUBY-26400
  • Fixed a couple of issues with UI localization: RUBY-26282, RUBY-26351

Check out the release notes for the complete list of closed tickets. And as always, please report any issues you encounter.

Happy developing!
The RubyMine team

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

RubyMine 2020.1.3 Is Available

RubyMine 2020.1.3 bug-fix update is now available!

You can update to it using the Toolbox App or right from inside the IDE. You can also download RubyMine 2020.1.1 from our website.

You’ll find the following important fixes in this update:

  • Fixed an issue causing delays when applying auto-completion: JBR-2475
  • Fixed an issue causing excessive CPU usage: RUBY-26400
  • Fixed a couple of issues with UI localization: RUBY-26282, RUBY-26351

Check out the release notes for the complete list of closed tickets. And as always, please report any issues you encounter.

Happy developing!
The RubyMine team

Awesome Ruby Newsletter 

💎 Issue 216 - A Fast Car Needs Good Brakes: How We Added Client Rate Throttling to the Platform API Gem

Super Good Software 

Solidus Roadmap Update Q2 2020 Released

With the second quarter of 2020 in the rear view mirror, it’s time to revisit the progress being made on the Solidus eCommerce platform. Alessandro Desantis has just published the roadmap update over on the Solidus blog and there’s lots to be excited about. Two of the new extensions stand out to us as big steps forward for Solidus.

Headless CMS Integration

solidus_content streamlines the process of integrating with the ecosystem of headless CMS systems that have become very popular for managing all kinds of content for eCommerce storefronts. Integrating with these platforms is a really great way to provide your marketing and merchandising teams with flexible tools that help them be more…

GraphQL…

Ruby Weekly 

More on an anonymous struct literal syntax for Ruby

#509 — July 9, 2020

Read on the Web

Ruby Weekly

A Fast Car Needs Good Brakes: How Heroku Added Client Rate Throttling to Their API Client Gem — When you’re interacting with remote APIs, you’ll often need to take rate limits into account. As Richard amusingly says:

“If you provide an API client that doesn’t include rate limiting, you don’t really have an API client. You’ve got an exception generator with a remote timer.”

Richard Schneeman (Heroku)

More on Anonymous Struct Literals — Last week we reported on a proposed syntax for defining anonymous Struct literals in Ruby, but this post fleshes out the…

Jared Norman

Scout APM - A…

solnic.codes 

Open Source Status Update – April – June 2020

It’s finally time for another Open Source Status Update! This one’s different as it covers last three months. Due to pandemic situation and having my kids at home, including online schooling, it was really difficult to do any OSS hacking. We’ve got some things done regardless in March and April thanks to support from our contributors, so I also would like to use this as an opportunity to thank you all for your help!

OK let’s see what happened during the last three months.

April

We had a new dry-monitor release that fixed compatibility with Rack::Builder#use and also brought a couple of performance improvements. Thanks to Anton and Luca from the Hanami team for helping with this…

Ruby Magic by AppSignal 

Scaling Queue Workers Efficiently with AppSignal Metrics

Most web apps can benefit from a background queue, often used to process error-prone or time-consuming side jobs. These background jobs can vary from sending emails, to updating caches, to performing core business logic.

As any background queueing system scales the number of jobs it needs to process, the pool of workers processing those jobs needs to scale as well. In cases where the rate of jobs being enqueued varies, scaling the number of queue workers up becomes a key aspect in maintaining processing speed. Additionally, scaling down workers during low queue throughput can provide significant savings!

Unfortunately, many queueing backends don’t come equipped with scaling logic to turn…

Schneems - Programming Practices, Performance, and Pedantry 

A Fast Car Needs Good Brakes: How We Added Client Rate Throttling to the Platform API Gem

When API requests are made one-after-the-other they’ll quickly hit rate limits and when that happens:

Ruby on Rails Podcast 

325: [REPOST] Ruby Blend: Open Sourcing a Ruby Gem with Brittany Martin

Brittany guested on the Ruby Blend! The hosts counsel her on opensourcing her googlepay gem. They then dive into how important README's are, useful tools for documentation, a project from Evil Martians, a gem called Combustion, and RSpec API documentation.

Links for this episode:

Brou…

Greater Than Code 

190: Social Media, Privacy, and Security with Joe LeBlanc

01:32 - Joe’s Superpower: Hospitality

06:20 - Social Media: It's time for us to stop acting like we are getting access to social media for free.

  • When you add up your household's cable/Internet/phone bills, you're paying bare minimum $100/mo.
  • This money isn't going to Facebook and Twitter, but it is the entry fee for bringing these platforms into your home, where they subsequently track everything you do, everyone you know, build a facial recognition database with the photos you post, and determine your sexual orientation before you even disclose it.
  • Nobody reads the privacy policies.
  • UBDI – Universal Basic Data…

15:36 - Owing Your Identity & Data

25:25 - Protecting Children’s’ Privacy & Data

32:00 - Leading The Movement; Rolling Out a Solution: Taking back control of our data

  • People who are willing to be hobbyists
  • Experimentation & Activism

Reflections:

Christina: The value and the power of open source and thinking beyond giving your data out willy-nilly.

Jac…

Heroku 

A Fast Car Needs Good Brakes: How We Added Client Rate Throttling to the Platform API Gem

When API requests are made one-after-the-other they'll quickly hit rate limits and when that happens:

That tweet spawned a discussion that generated a quest to add rate throttling logic to the platform-api gem that Heroku maintains for talking to its API in Ruby.

If the term "rate throttling" is new to you, read Rate limiting, rate throttling, and how they work together

The Heroku API uses Genetic Cell Rate Algorithm (GCRA) as described by Brandur in this post on the…

The API limits the number of…

Rails with Jason 

052 - Debugging Techniques with Chelsea Troy

In this episode I talk with Chelsea Troy regarding the debugging techniques she shared in her recent RailsConf talk, "Debugging: Techniques for Uncertain Times". Chelsea and I talk about "progress mode" vs. "investigation mode", binary search, tests as scientific experiments, and, naturally, outer space.

Alfredo Motta 

Not So Random Software #33 – Journaling and multi-armed bandit

Hello everyone and welcome back to Not So Random Software! This week’s links are about journaling; I found such a habit to be a powerful …
Everyday Rails 

Rails application templates made even easier with Rails Bytes

Application templates aren't just for new Rails apps! Stop copy-pasting configurations and get back to productivity with modular templates from this promising new service.
The Bike Shed 

251: Absent-Minded Whistling

On this week's episode, Steph and Chris discuss using JSONB to store survey responses and the differences between JSON and JSONB, using (or not using!) exceptions in Ruby and the fail keyword, the pros and cons of namespacing models in Rails to organize features, and a new recommendation for running tests from vim.

This episode is brought to you by ScoutAPM.
Give Scout a try for free today and Scout will donate $5 to the open source project of your choice when you deploy!

Sponsored By:

Code with Jason 

Why validation matchers are the only Shoulda matchers I use

One of the testing questions I commonly get is about Shoulda matchers. People ask if I use Shoulda matchers and if Shoulda matchers are a good idea.

I’ll share my thoughts on this. First I’ll explain what Shoulda is, then I’ll explain why the only Shoulda matchers I use are validation matchers.

What Shoulda is

If you’re unfamiliar with Shoulda matchers, the premise, from the GitHub description, is: “Shoulda Matchers provides RSpec- and Minitest-compatible one-liners to test common Rails functionality that, if written by hand, would be much longer, more complex, and error-prone.”

A few examples of specific Shoulda matchers are validates_presence_of (expects that a model attribute has a…