Rubyland

news, opinion, tutorials, about ruby, aggregated
Sources About
Andy Croll 

Really, Really, Really Don’t Interpolate Strings into Active Record Methods

Protecting your application against malicious users is one of your key responsibilites as a developer. The built-in security provided by a well-maintained framework, such as Rails, is an excellent reason to use one.

This is particularly true of the protection afforded within Active Record for sanitizing user input before it is written to your database. However there are ways to pass strings directly to Active Record scopes when you need to, but that power should be used very sparingly and carefully.

Instead of…

…using strings in any arguments sent to Active Record:

User.delete_by("id = #{params[:id]}")
User.where("email = #{params[:email]}")

Use…

…hash-based variants of the same…

Saeloun Blog 

Extract Sample Rate of an Audio File with Audio Analyzer in Rails 7.1

With ActiveStorage, storing files in Rails is made easier.

However, when it comes to audio files, it’s often necessary to go beyond simple storage and analyze the audio content itself.

To achieve this, integrating a media stream analyzer into a Rails application can be incredibly valuable.

For this, we can use the ffprobe which is already used by the Rails analyzer to extract basic information about the media file.

How does the Rails Analyzer work?

Rails has three analyzers to extract metadata of a blob, they are AudioAnalyzer, ImageAnalyzer, and VideoAnalyzer.

It also has NullAnalyzer which will be used if content type is not detected.

When the analyze method is called which is a…

Akshay's Blog 

A Beginner's Guide to Rails Parameters

A Beginner's Guide to Rails Parameters

If you are building a dynamic web application, you will need to access the user-submitted data on the server. Maybe the user uploaded a photo, wrote a comment, posted a tweet, or clicked a link containing the id of an article they want to read.

How do you access this data on the server, in your Rails application?

That’s where parameters enter the picture.

Similar to the parameters to a function, Rails parameters read the data submitted by the user's browser, either in the link or via form submission and make it available in your Rails application.

Consider the following code that mimics the browser-server interaction.

# Rails app
def rails(params)
  # do stuff with params
end

# browser sends…
Remote Ruby 

Ruby 3.3 Preview 1 & The Mystery Of The 3 Inch Round Button

On this episode of Remote Ruby, Jason, Chris, and Andrew begin by sharing their thoughts on some shows they’re watching such as “White House Plumbers,” “Curb Your Enthusiasm,” and “Seinfeld.” The conversation then shifts towards the exciting release of Ruby 3.3 Preview 1, which focuses on performance improvements for YJIT and the introduction of compiler RJIT. They dive into the challenges of implementing autosaving and error display forms using Turbo and Hotwire in Rails. Then, the conversation takes a turn towards serverless function, with Andrew sharing his experiences using Vercel, and a discussion on Hatchbox and Fly for hosting applications, and the appeal of PlanetScale for…

Ruby on Rails 

This Week in Rails - May 26, 2023

Hey! zzak here with another edition of This Week in Rails.

Reminder: The Rails World CFP is open until June 16.
Whether you’re a seasoned veteran or a newcomer to the Rails ecosystem, we encourage you to submit proposals that showcase forward-thinking ideas and push the boundaries of what’s possible with Rails.

Rails 7.0.5 has been released
In case you missed it, a bugfix release for the 7.0 series of Rails was cut.

Improve performance of MemoryStore
This PR optimizes the MemoryStore::DupCoder internal API to avoid unnecessary work when writing and reading complex objects.

Refactor error highlight detection
Before this commit, some calls to render were hard-coding error highlight as…

Giant Robots Smashing Into Other Giant Robots 

Avoid Putting Logic in Map Blocks

As Rubyists, we write map blocks all the time. These blocks tend to pick up logic that belongs elsewhere. Consider this innocent looking piece of code.

class ShoppingCart
  # other methods

  # SMELLY
  def sub_totals
    items.map do |item|
      item.base_cost + item.bonus_cost
    end
  end
end

If we look closely we can notice a few different code smells:

  1. The caller suffers from Feature Envy because it cares a lot about properties on the item and wants to take over item-related responsibilities.
  2. Conversely, Item seems to be an Anemic Model that holds data but none of the operations that are done to that data.

Move logic to items being iterated

The body of the block is…

Awesome Ruby Newsletter 

💎 Issue 366 - Rails 7.1 adds ActiveRecord::Base::normalizes API for attribute values

Ruby Central 

April 2023 Monthly Update

Hello! Welcome to the monthly update. During April, our work was supported by Zendesk and many others.

Ruby Central News

In April, Ruby Central's open source work was supported by 35 different companies, including Ruby member Zendesk.

In total, we were supported by 162 developer members. Thanks to all of our members for making everything that we do possible. <3

RubyGems News

This month in RubyGems, we released RubyGems 3.4.11, 3.4.12 and Bundler 2.4.11, 2.4.12.

The following improvements and fixes are included in these releases (see the changelog for more information):

  • reduced chances of Bundler reverting to old APIs by removing a fallback to full indexes on big gemfiles in RubyGems - #6578.
  • made…
Julia Evans 

New playground: memory spy

Hello! Today we’re releasing a new playground called “memory spy”. It lets you run C programs and see how their variables are represented in memory. It’s designed to be accessible to folks who don’t know C – it comes with bunch of extremely simple example C programs that you can poke at. Here’s the link:

>> Memory Spy <<

This is a companion to the “how integers and floats work” zine we’ve been working on, so the goal is mostly to look at how number types (integers and floats) are represented.

why spy on memory?

How computers actually represent variables can seem kind of abstract, so I wanted to make it easy for folks to see how a real computer actually represents variables in…

Aha! Blog 

Add Video and Audio Files Directly in Aha! Software

Product builders can now insert video and audio files directly into notes. See how you can up-level your notes to communicate and collaborate more effectively  driving product development forward.
Ruby Weekly 

So quiet that I'm Photoshopping broccoli

#​655 — May 25, 2023

Read on the Web

✍️ When I started looking around for things to write up for this issue, I was surprised at how.. quiet it was – even Björk would have something to say about it. Everyone's probably taking a well-earned nap after RubyKaigi, so for this week, we make the most of things by going a little off piste here and there.. :-)
__
Your editor, Peter Cooper

Ruby Weekly

Rails Brotli Cache: A Drop-in Enhancement for Rails' Cache — Brotli isn’t yet another sour green vegetable but a pretty good data compression algorithm developed by Google, and you can take advantage of its improvements by…

Paweł Urbanek

Nokogiri 1.15 ReleasedNokogiri is one of…

Akshay's Blog 

How to Render Markdown Views in Rails

How to Render Markdown Views in Rails

For a personal project, I wanted to render markdown files in my Rails views. Not fetching and rendering markdown from the database, but rendering the plain markdown files under the views directory.

At first, I thought it would be complicated, involving searching for views, parsing the markdown content, and rendering it. But a little Google search revealed that Rails already supports this functionality, with a few lines of configuration. This also lets you render them as partials within other views.

Let's see how to accomplish this in two simple steps.

Step 1: Add a Handler to Convert Markdown into HTML

Let's add a new class called MarkdownHandler which converts markdown content to HTML using…

Giant Robots Smashing Into Other Giant Robots 

This week in #dev (May 5, 2023)

Welcome to another edition of This Week in #dev, a series of posts where we bring some of the most interesting Slack conversations to the public.

Measuring Elapsed Time Correctly

Sara Jackson learned about Process::CLOCK_MONOTONIC. It should be used instead of system time updates when measuring elapsed time because it ensures that the measurement is accurate and not affected by system time updates.

start_time = Process.clock_gettime(Process::CLOCK_MONOTONIC)
do_something(args)
end_time = Process.clock_gettime(Process::CLOCK_MONOTONIC)

puts "Elapsed time: #{end_time - start_time}"

Secret Active Record Methods

Summer ☀️ shares a cool Active Record feature: using !

Ruby Rogues 

Rails I18n Manager with Weston Ganger - RUBY 586

Weston Ganger is a Software Architect and an Expert in Ruby-on-Rails. He joins the show to discuss "rails_i18n_manager". He starts off by discussing his professional career and projects. He talks about translations, some of his approaches, and the challenges he encountered


Sponsors


Links


Socials




Advertising Inquiries: https://redcircle.com/brands

Privacy & Opt-Out: https://redcircle.com/privacy
Ruby on Rails 

Rails 7.0.5 has been released

Hi everyone,

I am happy to announce that Rails 7.0.5 has been released.

CHANGES since 7.0.4

To view the changes for each gem, please read the changelogs on GitHub:

To see a summary of changes, please read the release on GitHub:

7.0.5 CHANGELOG

Full listing

To see the full list of changes, check out all the commits on GitHub.

SHA-256

If you’d like to verify that your gem is the same as…

Giant Robots Smashing Into Other Giant Robots 

New Docs for factory_bot

We have improved the documentation for factory_bot, our Ruby library that makes it easy to quickly instantiate new model objects. The new book contains a general guide, a cookbook with solutions to common problems, and a quick reference. The factory_bot wiki contains details on how to best integrate factory_bot into third-party libraries.

In this post we want to acknowledge the work that lead to this, talk about the decisions we made, and provide excitement about the future.

History

At factory_bot’s inception in 2008, README.md contained examples of how to use it. In 2011 we moved them out into their own document, GETTING_STARTED.md, so they could be easier to read.

This file…

Aha! Blog 

My Name is Mark Crowe — This Is What I Achieve at Aha!

Discover what Mark loves about using his product building experience to help Aha! customers achieve their goals. Plus, get his perspective on why it pays to embrace hard work.
The Ruby on Rails Podcast 

Episode 471: RubyKaigi 2023 Recap (Brittany + Jemma)

The moderator of Ruby Committers and the World, Jemma, answers all of Brittany's questions about her recent trip to Matsumoto, Nagano, Japan for RubyKaigi 2023. The pair talk about Matz's keynote, the panel and Jemma's recent work on YARP.

Show Notes:

Sponsored By:

Honeybadger

If you want to simplify your stack, and lower your bills, it’s time to check out Honeybager. Honeybadger combines all of those services into one easy to use platform—it’s everything you need to keep production healthy and your customers happy.

Get started today in as little as 5 minutes at Honeybadger.io with…

Evil Martians, an extraterrestrial product development consultancy 

11 HTML best practices for login & sign-up forms

Author: Andrey Sitnik, Author of PostCSS and Autoprefixer, Principal Frontend EngineerTopics: Frontend, Accessibility, CSS, JavaScript

Even popular sites fail to implement the 11 best practices mentioned in this article, and thus have at least one mistake. Use this checklist on your next pull request review that deals with any form.

Most websites have login or sign-up forms; they're a critical part of business conversion. However, even popular sites fail to implement the 11 best practices mentioned in this article, and thus have at least one mistake. So, read this post, and then check your forms and improve your UX by using HTML technologies the way they should be used.

The Rails Tech Debt Blog 

Introduction to Rails Engines

Rails Engines are an architectural pattern that can be used to modularize a Rails application. They are self-contained applications that can be mounted within a larger Rails application. In this post, we will dive into the world of Rails Engines and explore what they are, how to create them, how to use them, when to use them, and why they are important.

What are Rails Engines?

Rails Engines are essentially mini-applications that can be plugged into a larger Rails application. They allow you to modularize your code and keep it separate from the core application. This makes it easier to maintain and update the codebase as a whole.

Engines can include models, controllers, views, and…

OmbuLabs Blog 

Design Sprint Day 5: Test

This is part of our series on design sprints. If you haven’t read our previous articles, I encourage you to read more about our design sprint process.

Day 5 of the design sprint is about testing your prototype and getting feedback on your ideas. That way, you can quickly learn what is or isn’t working about the concept. Yesterday, the interviewer spent time putting together a list of questions for the interview sessions. Earlier this week, your team recruited 5 participants for Friday’s research. Now you are ready to do the dang thing.

Design Sprint Day 5 - Test

Why do we test?

We test early with a low-fidelity prototype because it’s smart and far less expensive than waiting until…

Once a Maintainer 

Once a Maintainer: Marco Roth

Welcome to Once a Maintainer, where each week we interview an open source maintainer and tell their story. This week we’re talking to Marco Roth, maintainer of several open source projects in the Stimulus ecosystem and member of the StimulusReflex core team.

Marco lives in Basel, Switzerland and is a lively contributor to the Rails community. You can find him on Twitter @marcoroth_ and on Mastodon at @marcoroth@ruby.social.

How did you get into programming?

I was always kind of fascinated by computers since I was young and had constant exposure to them. In high school, I received my first MacBook for schoolwork and I owned an iPhone 3G. I wanted to try to create an iPhone app using Xcode, but…

Super Good Blog 

Fixing Tests: Hardcoded IDs

How many times have you heard this before? It will usually be followed by rerunning the test suite a few more times to see if the flaky tests keep flaking. If it does not; move on and forget about the flaky test till the next time you try to deploy.

Flaky tests are a big problem. A test suite is only useful when it’s fast and reliable. The problem with flaky tests is that they slow down the test suite quite a bit (causing re-runs of the build at every attempt to merge a PR sometimes), and when they fail, you won’t know immediately if the test flaked as usual, or if there’s a real bug that requires your attention.

There are a lot of ways to write bad, non-deterministic tests. This post is…

Aha! Blog 

Introducing the ServiceNow + Aha! Integration

Does your company use ServiceNow to automate IT workflows? If so, this release is for you. You can now connect ServiceNow with Aha! software consolidating requests from internal teams and customers in one place.
BigBinary Blog 

Improving the application performance by harnessing the full potential of ancestry gem

neetoTestify is a test management platformfor manual and automated QA testing. It allows us to organize test cases intological groups called test suites. A single suite can contain multiple testcases and multiple suites. The image below shows how the suites are displayed inthe UI in a hierarchical order. The arrangement in which the suites aredisplayed resembles a tree data structure.

Suites displayed with their hierarchial structure in neetoTestify

To display test suites in a tree structure, we need to store some informationabout the parent-child relationship in the database. This is whereAncestry comes in. Ancestry is a gemthat allows Rails Active Record models to be organized as a tree structure.

Normally, web applications implement pagination to show a…

Greg Molnar 

Infer name with link_to - Rails Tricks Issue 8

Hi, this week I want to tell you about an improvement coming in Rails 7.1. When you are using the link_to helper, it can infer the URL from the object you are passing to it as the second parameter:

Become a Ruby hero 

A comprehensive guide to the anonymous functions

Anonymous functions are an integral part of Ruby identity and provide flexibility for any kind and size of the codebase. This article is a deep dive into blocks, procs, and lambdas that will help you to understand how these functions differ from each other and how you can benefit from using them.

I will start by explaining each type of function, and at the end of the article, there will be time to compare them. All my notes are based on years of hands-on experience at iRonin.IT - a top software development company, where we provide custom software development and IT staff augmentation services for a wide array of technologies.

Blocks

Let's begin with some real-world and practical examples…

The Bike Shed 

385: The Boring Parts of Tech

Joël is joined by thoughtbot Software Developer and Dirt Jumper Daniel Nolan. Dirt jumping is BMX-style riding 🏍️ with really enormous dirt jumps.

But for a person who loves excitement in his spare time, for Daniel at work, it's not the new and shiny that interests him. When he dives into something, the "boring" parts of tech are what he finds most fulfilling. He wants to know the "why," and in this conversation, he explains how it sustains his career.


This episode is brought to you by Airbrake. Visit Frictionless error monitoring and performance insight for your app stack.


Transcript:

JOËL: Hello and…

Benito Serna 

Add many attachments without deleting previous ones using ActiveStorage

If you want to add many attachments to a record using just a file field, but you don’t want to remove the previous images from the record on every update, like in the following code:

<%= form_with(model: product) do |form| %>
    <%= form.label :images %>
    <%= form.file_field :images, multiple: true %>
  <%= form.submit %>
<% end %>

And instead, on every update you want to add the new images to the record, here is a simple workaround…

A virtual new_images attribute

Instead of using the :images attribute, you can add a virtual :new_images attribute, using an attr_reader and a custom writer like this:

class Product < ApplicationRecord
  attr_reader :new_images

  has_many_attached :i…
Saeloun Blog 

Integrate OpenAI API in Ruby applications

What is ChatGPT?

ChatGPT is an artificial intelligence chatbot developed by OpenAI that allow us to have human-like conversations and generate image based on the text description. It is one of the greatest leaps in natural language processing.

Integrating OpenAI API in ruby application:

We can implement all the ChatGPT features in a ruby application to make it more engaging for users by integrating OpenAI API. For this, we are using the ruby-openai gem which allows us to use various OpenAI models which we can pick based on the use case.

Install gem:

Add the ruby-openai gem to the Gemfile.

gem "ruby-openai"

Then run bundle install to install the gem.

Get access key:

We have to…

Ruby in Better Programming on Medium 

The Mysterious Time-to-DateTime Conversion: Unraveling Ruby’s Unexpected Behavior

Unexpected conversion from Time to DateTimef

I recently stumbled upon a perplexing discrepancy while converting Time to DateTime using the #to_datetime method. Intrigued by this unexpected behavior, I delved into an investigation to unravel its root cause. I’ll share my findings in this blog post with you, as I believe it’s worth your attention.

Introduction

I’m currently engaged in the challenging task of upgrading a massive Ruby on Rails monolith. This unique experience has allowed me to dive into unfamiliar territory, learn new things, and engage with numerous stakeholders.

Amid fixing a failing spec on the new Rails version, I stumbled upon the following behavior:

# ruby 2.7.7p221…
Short Ruby Newsletter 

📑 Short Ruby News - The Content Edition #43

This is just the content edition - web only. Read the Short Ruby Newsletter - edition 43 here

For just a small amount of $1.5 per week (only $6.5 a month), you can become a valued paid subscriber and actively support the thriving Ruby community we all love!

Support the newsletter for ~1.5$/week


📚 Books

📚 Noel Rappin announced that Programming Ruby 3.2 (5th Edition) is now draft-complete:

Source: @noelrap

🗞 Newsletters

🗞️ Ruby Weekly published a new edition: Ruby 3.3 makes its first appearance

🗞Vipul A M published a new edition of This Week in Rails about Rails World CFP, ActiveRecord.disconnect_all!, optimized where query and more!

🗞 Greg Molnar published a new edition of Rails Tricks about Shared…

Short Ruby Newsletter 

👋 Short Ruby News - Edition #43

You can jump directly to a section:

👐 Our Community

👉 All about Code and Ruby

🧰 Gems, Libraries, and Updates

🤝 Related (but not Ruby-specific)

More content: 📚 🗞 🎧 🎥 ✍🏾 (articles, podcasts, videos, newsletters, and books).


  1. The newsletter is now back to one single email sent. Read here more about this decision. TLDR: both the poll results and the stats from the newsletter show that the two newsletter format was not working correctly, while the majority prefers one email. Thus this edition contains the More Content section inside this edition as before. I will continue to publish the expanded content edition only on the web.

  2. All images are clickable. You can click on the image if you want to…


💸 For only $1.5 per week (just $6.5 a month), you can become a paid subscriber and contribute to the success of the flourishing Ruby community we all adore!

Support the newsletter for ~1.5$/week


👐 Our Community

👐 Friendly.Rb announced a new speaker, see friendlyrb.com for more details

👐 Dave Copeland shared reasons why Rails and…

Sou…
Short Ruby Newsletter 

Newsletter update #2

This will not come as a surprise that the choice is to receive one single email. This matches the conclusion of my previous analysis here:

What will change

  • I will return to the initial newsletter format (the one before the split that includes everything inside), with the “More content” section kept as text without expanding it to screenshots.

  • For anyone that likes the format of the content edition, I will still publish it but only on the web — not sending it via email.

Thus you will receive one single email, and if you want to read the content format, there will be a button/link in the newsletter going to the content format.

Why

I have to say that for me - having the newsletter split in two -…

Akshay's Blog 

Concerns in Rails: Everything You Need to Know

Concerns in Rails: Everything You Need to Know

P.S. I originally published this post last year, when I was just starting to learn Rails. Since then, I've learned a few more things and hence decided to edit, revise, polish, and re-publish it. Also, a ton of new subscribers have joined the email list, and I thought you all might find it helpful.

Many Rails applications, including the framework itself, make heavy use of concerns. However, if you are new to Rails, concerns can be confusing to understand. When I started learning Rails last year, concerns were one of the topics that took a really long time for me to understand.

The Rails guide on concerns mixes in unrelated concepts such as validations, migrations, and views, making it…

The Rails Tech Debt Blog 

Fixed-cost, Monthly Maintenance Services

Ever since we started offering productized Ruby and Rails upgrade services and upgrade roadmaps, we’ve been interested in helping as many people and companies as possible.

Unfortunately, in the past we’ve had to turn down companies who wanted to work with us but couldn’t secure the minimum monthly budget to work with our experts.

I’m pleased to announce that we’re now offering new opportunities for startups and small businesses to work alongside our team.

In this article, I will share a few new options to collaborate with our team of experts who specialize in technical debt remediation.

Why

Recently I had the opportunity to connect with a lot of SaaS founders at MicroConf ‘23 which…

Ruby on Rails 

Rails World CFP, ActiveRecord.disconnect_all!, optimized where query and more!

Hello Everyone!

This is Vipul, bringing you this week’s changes in the Rails codebase.

Rails World Call for Papers now open
This CFP is open until June 16, with space in the agenda for 26 talks on two tracks, and up to six workshops. Read the full announcement for more details and submit your proposal!

Introduce ActiveRecord.disconnect_all! to close all connections from pool
This change introduces a multi-db aware version of ActiveRecord::Base.connection.disconnect!.

It also avoids connecting to the database if we weren’t already connected.

This can be useful to reset state in multi-db applications after establish_connection has been used.

Optimized where query for a range where begin…

The RubyMine Blog : Intelligent Ruby and Rails IDE | The JetBrains Blog 

RubyMine 2023.2 EAP2: New UI updates, improved Rails 7 and RBS support 

The second EAP version of RubyMine 2023.2 is now available, and you can download the latest build either from our website or through the free Toolbox App

Here are some of the key improvements you’ll find. 

Rails 7

Support for turbo-rails completion

We’ve updated turbo-rails code completion and insight for models, controllers, and views, allowing you to define model-specific Turbo Stream templates that provide real-time updates to the client side when the model is created, updated, or deleted. With Turbo for Rails, you can use code completion in your models to access Turbo-Stream-specific methods. 

Import Maps support

We’ve implemented support for using importmaps…

Aha! Blog 

My Name Is José Guerrero — This Is Why I Joined Aha!

José is a software engineer on the Aha! team who works remotely from his home in Quito, Ecuador. Discover what energizes him about making software that is beautiful and usable.
Ruby Rogues 

Building Rails Application with Phlex - RUBY 595

Brad Gessler is an experienced co-founder with a demonstrated history of working in the information technology and services industry. He is also one of the authors of Fly.io. He talks about the "Phlex", its advantages, its impact, and how he uses it. 

 

On YouTube

Building Rails Application with Phlex - RUBY 595


Sponsors


Links


Socials



Advertising Inquiries: https://redcircle.com/brands

Privacy & Opt-Out: https://redcircle.com/privacy
Remote Ruby 

Railsconf Recap

On this episode of Remote Ruby, the guys discuss various topics relating to hosting options, web frameworks, open source projects, and give us a recap on RailsConf 2023.  

They dive into the pros and cons of serverless architectures like Lambda, Jason’s experience with Roda, their interests in front-end technologies and JavaScript integration in Rails, and Andrew tells us about regex for playground. We’ll hear their thoughts on RailsConf, their favorite talks, Chris’s workshop, things that could have been better, and the importance of community contributions, transparency, and the need for clearer communication. Also, if you missed this RailsConf, they mention some other conferences…

Awesome Ruby Newsletter 

💎 Issue 365 - From Ruby to Crystal? We write and distribute a CLI tool to check it out

Ruby Weekly 

Ruby 3.3 makes its first appearance

#​654 — May 18, 2023

Read on the Web

Ruby Weekly

Ruby 3.3 Preview 1 Released — Christmas Day, and the eventual release of Ruby 3.3, might be seven months away, but there’s already a preview release to sink your teeth into. It is early days though and the range of new features is limited. Updates include:

  • A new pure Ruby JIT called RJIT (x86-64 & Unix only for now).
  • Big YJIT performance improvements.
  • ext/readline retired in favor of Reline.
More additions are anticipated as we approach the eventual release.

Yui Naruse

Free eBook: Advanced Database Programming with Rails and Postgres — Learn about…

Honeybadger Developer Blog (Ruby Articles) 

DIY error monitoring for Ruby

As an indie developer, one of the most exciting achievements is when users happily sign up and start using your app. What's not exciting, however, is having to deal with the errors and exceptions your users will eventually encounter. To ensure that your app offers a good user experience, you want to be notified when exceptions are encountered that so you can deal with them as soon as possible. You can get help with this task from a professional error-monitoring solution, such as Honeybadger, which offers a generous free tier.

Using a professional error-monitoring service is recommended for production apps of all sizes, but not many users know how to get the most value from them. One of the…

Akshay's Blog 

How to Create Custom Flash Types in Rails

How to Create Custom Flash Types in Rails

Sometimes you want to store some data in the Rails Session for the next request; for example, to display an error message or notice to the user after redirecting them to another page.

You can store this message in the session using flash, and access it in the next request. The flash is cleared in the next request.

Most of the time, we want to use the flash for two reasons: to show a notice to the user, or to alert them about something. Hence, out of the box, Rails provides two accessors on the flash object, called notice and alert, which let you create and access the notice and alert messages in the controllers and views respectively.

class FlashController < ApplicationController
  def show
…
OmbuLabs Blog 

Handling Environment Variables in Ruby

Configuring your Rails application can be tricky. How do you define secrets? How do you set different values for your local development and for production? How can you make it more maintainable and easy to use?

Using environment variables to store information in the environment itself is one of the most used techniques to address some of these issues. However, if not done properly, the developer experience can deteriorate over time, making it difficult to onboard new team members. Security vulnerabilities can even be introduced if secrets are not handled with care.

In this article, we’ll talk about a few tools that we like to use at OmbuLabs and ideas to help you manage your environment…

Aha! Blog 

How To Avoid Building Software That No One Uses

Software waste is any code, feature, or functionality that the customer does not need or derive value from. Product development teams can mitigate the damage by focusing on seven core areas: value, motivations, goals, process, communication, accountability, and reality.
The Ruby on Rails Podcast 

Episode 470: A Smorgasbord of Topics (Brittany + Nick)

Brittany and Nick are back together again! Brittany talks about on boarding as an Engineering Manager at Shogun as a Shogie. The two discuss standup preferences, multi-timezone communications, bonding over incidents and Nick's latest venture: rChat.

Show Notes:

Sponsored By:

Honeybadger

As an Engineering Manager or an engineer, too much of your time gets sucked up with downtime issues, troubleshooting, and error tracking. How can you spend more time shipping code and less time putting out fires?

Honeybadger is how. It’s a suite of monitoring tools specifically for devs.

Get started today in as…

RubyGems Blog 

April 2023 RubyGems Updates

Welcome to the RubyGems monthly update! As part of our efforts at Ruby Central, 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 April.

RubyGems News

This month in RubyGems, we released RubyGems 3.4.11, 3.4.12 and Bundler 2.4.11, 2.4.12.

The following improvements and fixes are included in these releases (see the changelog for more information):

  • reduced chances of Bundler reverting to old APIs by removing a fallback to full indexes on big gemfiles in RubyGems - #6578.
  • made RubyGems less dependent on default gems by using a vendored pure-ruby YAML parser to load its own configuration - #6615.

In April, RubyGems gained 128 new commits contributed by 12 authors. There were 2,125 additions…

Ruby Magic by AppSignal 

Manage Your Ruby Logs Like a Pro

Logs are essential to any application's development. Most Ruby logs are verbose and chunky, so digging for exactly what you need can be difficult. Even though they contain useful information, you might not get as much value as you should from logs if you don't know how to use them effectively.

In this article, we'll explore:

  • The importance of logging
  • How to use Ruby's inbuilt logging utilities — puts and Logger
  • Log levels and their differences
  • Customizing your logs using JSON
  • Integrating a logging library, using Lograge as an example

Let's get started.

Prerequisites

To follow along with this tutorial, you should have the following:

  • A local installation of Ruby (we'll be using Ruby 3.2.0…
BigBinary Blog 

Shape snapping with React Konva while building neetoWireframe

Introduction

Shape snapping is a feature in software that allows shapes or objects to beautomatically aligned or adjusted to a particular grid when they are moved orresized. This feature helps to ensure that shapes are properly aligned andpositioned in relation to other shapes, making it easier to build design wherethings are properly aligned.

We needed "shape snapping" inneetoWireframe. neetoWireframe is a tool forcreating interactive wireframes and prototypes. neetoWirefame is one of thevarious tools being built by neeto.

neetoWireframe uses React Konva tobuild wireframes and prototypes. React Konva is a JavaScript library that provides a Reactcomponent interface to the Konva library, a…

Greg Molnar 

Shared examples with Minitest - Rails Tricks Issue 7

Hi, this week I will show how you can achieve a similar behavior to Rspec’s shared examples with Minitest. We will dry the minitest tests by extracting the common parts into modules.

The Rails Tech Debt Blog 

Power Home Remodeling Increases Server Speed by 40% with FastRuby.io’s Tune Report

Power Home Remodeling (Power) is the nation’s largest full-service exterior home remodeler and a top workplace.

Headquartered in Chester, Pennsylvania with offices in 18 territories across the United States, the award-winning company’s primary product line includes windows, siding, doors, roofing, solar roofing panels, and attic insulation.

In this article we will share how our Tune Report helped Power speed up their application by reducing their average page load time from 5 to 3 seconds.

Our Challenge

Power provides homeowners with top-rated customer service, and quality, energy-efficient products that help upgrade their home’s exterior. While a home remodeling company at its core,…

Evil Martians, an extraterrestrial product development consultancy 

From Ruby to Crystal? Writing and distributing a CLI tool

Authors: Valentin Kiselev, Backend Engineer, and Travis Turner, Tech EditorTopics: Backend, Full Cycle Software Development, Crystal, Ruby

We use the Crystal language to build a CLI tool, a coverage reporter for Coveralls, as a static binary and as a Homebrew tap

Crystal is a relatively young language which has been in active development since 2014. Its primary goal is providing static type-checking while providing a comfort of use similar to Ruby. In this post, I'll share my experience writing a CLI tool in Crystal that parses coverage files and sends the parsed data to Coveralls, and distributing it as a static binary and Homebrew tap. The question: is it worth writing these kinds of tools…

Become a Ruby hero 

Unraveling the mystery of the super keyword

It seems that the super keyword in Ruby is a straightforward thing; it simply calls the same method from a parent. However, many developers are still not aware of all the features that the super keyword provides.

This article is not a long one, but I provide essential information about the super keyword, including more advanced tips that may surprise you.

All my notes are based on years of hands-on experience at iRonin.IT - a top software development company, where we provide custom software development and IT staff augmentation services for a wide array of technologies.

Brackets versus non-brackets version

I usually ask the following question during the technical interview for the Ruby…

The Bike Shed 

384: Not All Numbers Are Numbers

Joël gives a recap after attending RailsConf 2023 in Atlanta, Georgia (and yes, there was karaoke! 🎤 🎶). Stephanie plugs the The Tightly Coupled Book Club Podcast from friends and fellow thoughtboters Aji and Mina Slater where they're reading The Rails Guides from cover to cover and treating it like a book club and having a discussions about the documentation as they read it together.

Stemming from a Twitter thread by Joël, their main topic focuses on not all numbers being numbers. So: if someone is submitting a phone number through a form:

  • How would you store that in the database?
  • Would you store it as a string? Because sometimes it comes with some extra formatting.
  • Would…

Thoughts, Dear Listener?


This episode is brought…

Once a Maintainer 

Once a Maintainer: Matt Wynne

Welcome to Once a Maintainer, where each week we interview an open source maintainer and tell their story. This week we’re talking to Matt Wynne.

Matt has been a programmer since the late 90’s and contributing to open source since 2008, when he joined the Cucumber project, created by Aslak Hellesøy. Cucumber is a tool for running automated tests, written in plain language. Matt worked as lead of the Cucumber open source project until February 2023, where he fostered a welcoming environment and encouraged new contributors, especially those who have been historically under-represented in open source.

Originally from northwest England, he now lives in the mountain town of Nelson, BC in Canada…

The Rails Tech Debt Blog 

How to Fix Rails 6.1 Relation `merge` Deprecation

Recently, while working on a Rails 6.1 to 7.0 upgrade, we encountered the following deprecation warning regarding changes made to ActiveRecord::Relation’s merge method:

"Merging (#{node.to_sql}) and (#{ref.to_sql}) no longer maintains both conditions, and will be replaced by the latter in Rails 7.0. To migrate to Rails 7.0's behavior, use relation.merge(other, rewhere: true)."

In this article, we will talk about the expected behavior of merge, how it has changed and what to do in order to use the new behavior if you find yourself looking at this deprecation.

What is merge?

Let’s first take a look at the expected behavior of merge.

Using merge is actually pretty useful for when you…

Test Double 

Not everything’s about technology, and why that matters

Even before the pandemic there was a shift in how people connected around things they care about. But let’s look even further back in the wee days of the internet, circa 2000.

Robert Putnam wrote an essay, Bowling Alone, in 1995 and then parlayed it into a book in 2000. Putnam pointed towards a pattern shift in how Americans spend their free time. The author worried that people didn’t belong to organizations or socialize the way they used to.

Widespread adoption of the internet and the rapid emergence of social media changed things. As with most things, these changes were both good and bad. And what you consider good and bad depends a lot on your perspective. Let’s focus on what my…

GoRails Screencasts 

The difference between Link_to vs Button_to in Ruby on Rails

A lot of developers use link_to and button_to interchangeably. In this lesson, we'll explore when you should use link_to and when to use button_to and the differences between them.
The RubyMine Blog : Intelligent Ruby and Rails IDE | The JetBrains Blog 

RubyMine 2023.2 EAP Is Open!

The first early access program (EAP) version of RubyMine 2023.2 is now available, and you can download the latest build either from our website or through the free Toolbox App

We’ll be outlining some of the key improvements in this post. 

Fast and smart code editing with updated lexer

We are committed to improving RubyMine’s performance to provide you with a better experience when editing, debugging, refactoring, and so on. In the first 2023.2 EAP release, we gave the RubyMine lexer a major overhaul, which dramatically increased the lexing and parsing speed. 

Ruby code editing has become notably faster with the introduction of the following improvements:

  • RubyMine now makes…
Building & Sharing with Unathi 

Ruby Method Lookup Demystified: Inheritance, Mixins, and Super

If youve worked on Ruby projects for a while, you would have encountered times when you were digging to find out how and why a certain method behaved the way it did, because it didnt seem to use the code in the method definition youre looking at. And what happens when there are multiple methods with the same name?

This can seem confusing, but Ruby does have a specific way or path that is used to determine what methods to actually call. This process is called method lookup. In this guide we will delve into the details of method lookup, covering inheritance, mixins using include, prepend, and extend, as well as the super method. With clear examples and explanations, this article will help you…

Short Ruby Newsletter 

📑 Short Ruby News - The Content Edition #42

You can jump directly to a section:

📚 Books

🗞 Newsletters

🎧 Podcasts

🎥 Videos: Talks and Screencasts

🗒️ RubyKaigi Slides

✍🏾 Articles containing What's New, How-Tos, Deep Dives, and Related

Consider reading also the complementary Code Edition.

For just a small amount of $1.5 per week (only $6.5 a month), you can become a valued paid subscriber and actively support the thriving Ruby community we all love!

Support the newsletter for ~1.5$/week


👋 dear readers

I want to know your feedback about the two newsletter formats.

Do you like them and find it valuable to receive two emails? Please let me know by choosing the option below:

📚 Books

I am happy to announce that I am co-authoring a book with Stanislav…

Short Ruby Newsletter 

💻 Short Ruby News - The Code Edition #42

You can jump directly to a section:

👐 Our Community

👉 All about Code and Ruby

🧰 Gems, Libraries, and Updates

🤝 Related (but not Ruby-specific)


💸 For only $1.5 per week (just $6.5 a month), you can become a paid subscriber and contribute to the success of the flourishing Ruby community we all adore!

Support the newsletter for ~1.5$/week


👋 dear readers

I want to know your feedback about the two newsletter formats.

Do you like them and find it valuable to receive two emails? Please let me know by choosing the option below:

👐 Our Community

👐 Friendly.rb has recently announced their first speaker for the upcoming September conference. There is an affordable Community Sponsorship

Max Chernyak 

Adventures in Ruby-esque type enforcement

In Ruby you can kinda pretend that you have type enforcement at runtime, because Ruby is very flexible. This could be a useful-enough thing to do to organize and formalize the guarding” of your data. As a disclaimer, I’m not actually a huge fan of this practice, because I think that if you’re going to enforce types at runtime, you may as well achieve the same result via learning how to write good constructors and immutable objects. I believe the focus should be on controlling the flow of data from source to destination, not declaring types to guard against every generic use case. Nevertheless, for many existing codebases out there, runtime-level types might be the right way to improve…

Akshay's Blog 

Inline Routes in Rails

Inline Routes in Rails

One thing I really like about Sinatra is the incredibly simple router.

# app.rb

get '/' do
  # show something 
end

post '/' do
  # create something
end

Did you know you can do something similar in Rails?

Simply map an incoming request to a Rack endpoint, which is a fancy way to say an object responding to the call method that accepts the request environment and returns an array containing the status, headers, and response body.

Or a lambda.

# config/routes.rb

get 'rack', to: ->(env) {
  response = 'hello world'
  
  [200, {}, [response]] 
}

Agreed, not as elegant as Sinatra, but still useful when you quickly want to try some Rails feature in the browser, and don't want to spin up a whole…

Posts on Kevin Murphy 

Flog-Driven Development

Anyone Can Play Guitar Series 🔗

  1. Enumerating Musical Notes
  2. Revisiting Calling Sonic Pi From Ruby
  3. Programming Guitar Greatness
  4. Composing Our Own Guitar Amps From Inherited Gear
  5. Flog-Driven Development

Remembering Refactoring 🔗

In a prior post, we extracted the details of how to tune a guitar out of the Guitar class. We moved it to a separate Tuner class. In that telling, we did so because it spoke to our sensibilities. It afforded us more space in the Guitar class to focus on other responsibilities. It gave a central location to focus on tuning.

What if those justifications weren’t enough? What if we needed metrics to give an explanation for our refactoring? Let’s use the guidance from a tool called

Akshay's Blog 

Simplifying My Blogging Workflow with Ruby

Simplifying My Blogging Workflow with Ruby

If you've been a reader of this blog for a while, you know that I love writing, especially writing online and blogging, something I've been doing for over a decade now.

In addition to this blog on Ruby and Rails, I have three other blogs on the Internet where I write regularly: one to keep track of my reading and taking notes, a family blog as a travel journal and sharing photos, and a new blog I started a few weeks ago to teach Ruby to a group of friends in India (the time difference between Canada and India is just too much to do this over Zoom).

Except for this blog where you're reading this post, all my blogs are powered by Jekyll and hosted on Cloudflare. I've been using Jekyll for…

Ruby on Rails 

Rails World CFP, picture_tag helper and more!

Hi, this is Greg, bringing you this week’s changes in the Rails codebase.

Rails World Call for Papers now open
This CFP is open until June 16, with space in the agenda for 26 talks on two tracks, and up to six workshops. Read the full announcement for more details and submit your proposal!

Prevent duplicate filters for encrypted attributes
When an Active Record encrypted attribute is declared, a filter for it is automatically added to config.filter_parameters. Prior to this pull request, the filter would be re-added every time the model was reloaded. This change ensures filters are only added once so that config.filter_parameters does not grow unbounded.

Prevent non-anonymous modules…

Julia Evans 

Introducing "Implement DNS in a Weekend"

Hello! I’m excited to announce a project I’ve been working on for a long time: a free guide to implementing your own DNS resolver in a weekend.

The whole thing is about 200 lines of Python, including implementing all of the binary DNS parsing from scratch. Here’s the link:

This project is a fun way to learn:

  • How to parse a binary network protocol like DNS
  • How DNS works behind the scenes (what’s actually happening when you make a DNS query?)

The testers have reported that it takes around 2-4 hours to do in Python.

what’s a DNS resolver?

A DNS resolver is a program that knows how to figure out what the IP address for a domain is. Here’s what the…

Ruby News 

Ruby 3.3.0-preview1 Released

We are pleased to announce the release of Ruby 3.3.0-preview1. Ruby 3.3 adds a new pure-Ruby JIT compiler named RJIT, uses Lrama as a parser generator, and many performance improvements especially YJIT.

RJIT

  • Introduced a pure-Ruby JIT compiler RJIT and replaced MJIT.
    • RJIT supports only x86_64 architecture on Unix platforms.
    • Unlike MJIT, it doesn’t require a C compiler at runtime.
  • RJIT exists only for experimental purposes.
    • You should keep using YJIT in production.
  • If you are interested in developing JIT for Ruby, please check out k0kubun’s presentation on Day 3 of RubyKaigi.

Use Lrama instead of Bison

Hanami Mastery newest episodes! 

#45 Github integration with Hanami

If you're a developer, you know GitHub. And if you don't know Hanami, you definitely should. In this episode, I'll show you how to make them both to know each other.
Awesome Ruby Newsletter 

💎 Issue 364 - Programming types and mindsets

Aha! Blog 

6 New Whiteboard Templates for Business Planning

Choose from six whiteboard templates in Aha! Create to visualize your business plans
Ruby Weekly 

When Google said RubyGems was bad news

#​653 — May 11, 2023

Read on the Web

From the editor:

This is a re-send of yesterday's issue of Ruby Weekly. 'Google Safe Browsing' flagged RubyGems․org as a malware site in error and, because we linked to it, they decided our email was a problem too.

Many thanks to everyone who sent us notifications about yesterday's issue being tagged as malware or being sent to spam, but everything seems to be okay now. Maciej Mensfeld tweeted about the problem initially and it was resolved several hours ago. This issue also broke the entire use of RubyGems for numerous users using DNS systems protected by Google Safe…

Saeloun Blog 

Writing re-usable code with React Composition

In software development, code reusability is a key factor that can save developers a lot of time and effort. With reusable code, developers can easily reuse code blocks and components across multiple projects, which allows us to focus on other important tasks.

Let’s see, how React Composition can help us achieve code reusability.

What is React Composition?

React Composition is a technique that involves building complex components by combining smaller, reusable components.

Imagine that we have a pile of Lego blocks in front of us and we want to build a house. Instead of starting with a single large block, we would start by combining smaller blocks to create the different parts of the…

DEV Community: Brandon Weaver 

Beyond Senior - Fire! Fire!

After a number of conversations over the past few years with several other engineers who have moved beyond senior levels into staff and principal positions I've come away with a lot of insights, many of which have seen their way to Twitter or other conversations first, but now it's time to start collecting some of those stories into this new series: Beyond Senior.

What does it mean to go beyond the senior level in an engineering organization?

That's the question we're going to be looking at throughout this series.

Fire! Fire!

Every now and then when trying to explain a concept I land upon a metaphor, and that metaphor starts to grow as I talk to more folks about it. This time…

Ruby Rogues 

All Things Machine Learning - RUBY 594

Host from the Adventures in ML podcast, Ben Wilson and Michael Berk join Dave for this week's crossover episode. They discuss applying machine learning, deep learning, and algorithm. They also dive into how artificial intelligence changes the future.


Sponsors


Socials



Advertising Inquiries: https://redcircle.com/brands

Privacy & Opt-Out: https://redcircle.com/privacy
OmbuLabs Blog 

Quickstart: Preparing Your Organization To Work with an Agency

You’ve signed a contract with an agency, awesome! At this point you already know that agencies like ours offer expertise and resources that can help you overcome challenges, increase efficiency, and achieve your goals.

Now that the executives, sales team, and lawyers have signed off on the project, how do you get off to a quick start to accomplish your business goals?

Access Provisioning

Provide access for the external agency before the project kick-off call.

Access provisioning can take anywhere from 1-7 days in best case scenarios. Our projects are a fixed retainer, and we begin billing from the project start date, whether we have working accesses or not.

Be sure to select your…

The Rails Tech Debt Blog 

4 Essential Security Tools To Level Up Your Rails Security

At FastRuby.io we love Ruby on Rails because it is so powerful: You can quickly create an application that is feature complete, stable, and secure

Unfortunately, maintaining a Rails application up to date and secure takes some effort.

In this blog post, we will cover a few Ruby gems and best practices that you can use to stay on top of your security, reliability, and stability needs.

Before we dive into 4 different Ruby gems you can use to improve your security support, let’s start with some of the security goodies that already come with Rails.

Rails’ Native Security Features

The good news is that Rails comes with a ton of security support, here are a few features that you are…

Saeloun Blog 

Deploy Jekyll blog to AWS Amplify

What is Amplify?

AWS Amplify is a full-fledged solution that lets us build, ship, and host full-stack applications on AWS using AWS services.

By using Amplify we can also host static sites and it has a fully managed CI/CD workflow which is super easy to set up it is as simple as connecting the git branch and setting up the domain.

Why we switched to Amplify?

Previously we hosted this blog on Netlify but the problem is we are a large team and we want to add multiple users as team members to handle the build, and deployment of our blog. As Netlify charges $19/month per member(at the time of writing) we have to spend hundreds of dollars to run this blog.

We then migrated the blog to AWS…

Remote Ruby 

Remote Ruby RailsConf 2023 Panel

This is a special episode from RailsConf 2023 Atlanta, where we’re having a Ruby Community Podcast LIVE!  Today, we have on the panel Brittany Martin, Co-host of The Ruby on Rails Podcast, our very own Jason Charnes, and Paul Bahr, Audio Editor from Peachtree Sound, who edits over a dozen tech podcasts. We also have some great guests joining us: Aaron “tenderlove” Patterson, Irina Nazarova, Justin Searls, and Britni Alexander, who was selected by the audience to be our fourth guest. Today, our guests share some stories about who they are and what they do, give shout-outs, and answer questions from our audience.  Hit download now to hear more! 

[00:04:30] We start with Aaron…

The Ruby on Rails Podcast 

Episode 469: Railsconf 2023: A Ruby Community Podcast Live!

Listen to Brittany Martin (The Ruby on Rails Podcast), Jason Charnes (Remote Ruby) and Paul Bahr (Peachtree Sound) as they interview guests from the community on a live podcast at Railsconf 2023 in Atlanta, GA.

Guest #1: Aaron Patterson, Senior Staff Engineer at Shopify
Guest #2: Irina Nazarova, CEO of Evil Martians
Guest #3: Voted on by the community in an online poll: Justin Searls, Meta Programmer at Test Double
Guest #4: Voted on by the community live at this session: Britni Alexander, Senior Software Engineer

Our Vanna White of Guest Selection: Danielle Greaves, Lead Web Developer, Pittsburgh Cultural Trust

Show Notes:

Ruby Magic by AppSignal 

Organize Business Logic in Your Ruby on Rails Application

With its strong emphasis on convention over configuration, Ruby on Rails has counteracted many architectural considerations that caused bikeshedding when building web applications.

Still, one area that has continuously piqued developers' interest is how to handle business logic, i.e., code that epitomizes "what an app does." Another way to phrase this question is: Where do we put all the transactional code?

In this first part of a two-part series, we'll explore the most well-known methods to organize your business logic in a Ruby on Rails application.

Let's get going!

Where to Put Transactional Code in Rails

There has been an ongoing debate about this topic in the Rails community, with two…

RubyGems Blog 

3.4.13 Released

RubyGems 3.4.13 includes enhancements.

To update to the latest RubyGems you can run:

gem update --system

To install RubyGems by hand see the Download RubyGems page.

## Enhancements:

  • Installs bundler 2.4.13 as a default gem.

SHA256 Checksums:

  • rubygems-3.4.13.tgz
    b3feca09b7f4ef37b3b80480ec4d37b7cdd40d8e96fdf170f5b9633a9ad75a5b
  • rubygems-3.4.13.zip
    bd5ee7126a6bf18836a37be6b3d99290fe2c9f7a18aaad2ec7379292a23e7ebb
  • rubygems-update-3.4.13.gem
    d6d5e256666a5c515e4abfb5e9cf04e70f0d5a3d28cc1fb5aceeeca9e0eb25d6
Short Ruby Newsletter 

Analysis of the two newsletters format

Starting on 10 April 2023, I changed the format of the newsletter and split it in two:

  • The Code Edition - containing Community, All about Code and Ruby and Related

  • The Content Edition - containing newsletters, articles, videos, podcasts and everything else

I talked about the why in an announcement I called “Updating the newsletter”. One reason was that it was hard for me to create one single long newsletter and another one was:

I also feel that there are a lot of good articles written, and putting them at the end of a very long article is somehow taking a bit of their light or inspiration. Moving them into their section/email, I can maybe put them more into the spotlight or summarise some of…

Akshay's Blog 

Did You Know that You Can Catch and Throw Stuff in Ruby?

While the exception mechanism of raise and rescue is great for abandoning execution when things go wrong, it's sometimes nice to be able to jump out of some deeply nested construct during normal processing. This is where catch and throw come in handy.

- Pragmatic Programmers, 2001
Did You Know that You Can Catch and Throw Stuff in Ruby?

If like me, you're coming to Ruby from traditional programming languages, the throw and catch methods might surprise you.

No, they're not used for throwing and handling errors (although you can use them for that). Instead, they manage the control flow of your Ruby code, by allowing you to terminate execution early and escape deeply nested control flows, without having to use break, return, or raise-rescue.

In this…

Become a Ruby hero 

Simple Rails Design Patterns with Significant Impact

Especially in larger legacy Rails applications, its harder to make a meaningful refactoring without changing a lot of code. If you dont have time for that or introducing more significant changes its not an option in your case, then you can try implementing smaller but yet powerful design patterns that dont require any external gems or changing many classes at once.

All my notes are based on years of hands-on experience at iRonin.IT - a top software development company, where we provide custom software development and IT staff augmentation services for a wide array of technologies.

Variable pattern

This one may sound obvious to you as variables are the unchanging part of every application.…

Aha! Blog 

Greater Proxy Voting Visibility on Ideas

Customer-facing teams can now see all proxy votes for an idea and all proxy votes by organization in Aha! Ideas Advanced.
Hanami Mastery newest episodes! 

#44 Let's make a blog with Bridgetown

Bridgetown is the best static site generator for Ruby, and here is why.
The Rails Tech Debt Blog 

The AAA Pattern: Writing Robust Tests for Any Project with Confidence

Are you looking for a reliable way to test your applications? Look no further than the AAA pattern.

The AAA pattern stands for:

  1. Arrange
  2. Act
  3. Assert

This pattern helps you structure your tests in a clear consistent manner, and it is not tied to a particular programming language or testing tool, making it a versatile and effective approach to testing.

Following this pattern and structuring your tests into three distinct sections, you can easily set up the necessary conditions, perform the actions you want to test, and then verify the expected results.

In simple terms, a test is a self-explanatory piece of code that checks whether your application is functioning as intended.

Aut…

Ruby on Rails 

Rails World Call for Papers now open

We are pleased to announce the Call for Papers (CFP) for Rails World 2023.

Rails World is the first conference hosted by the Rails Foundation, and coincides with the 20th anniversary of the Ruby on Rails framework. It will take place on October 5 & 6, 2023 in the Beurs van Berlage in Amsterdam, Netherlands.

There is space in the agenda for 26 talks on two tracks, and up to six workshops. Talks will be recorded for later publishing on the Rails YouTube channel and event website, and we are currently exploring the idea of a livestream during the event. This first edition will welcome 650 attendees.

Submit your proposal here.

This CFP is open until June 16, and we are aiming to inform all…

Greg Molnar 

How to use a specific version of Rails - Rails Tricks Issue 6

Hi, this week I will cover how you can use a specific version of Rails should you need it.

Test Double 

Change through consensus

The most difficult thing about making large changes to a code field and the processes around it is building consensus on your team.

We’d like to talk to you today about the process of making such a change in the context of implementing RuboCop on a fully un-linted codebase. Thankfully there are some great blog resources available for how you might do this from a technical standpoint, one of which that we have found particularly helpful is: Evil Martians’ RuboCopping with Legacy Code. On top of that, the tools themselves have great functionality built in to allow for progressive changes, like Rubocop’s todo file and the ability to inherit configurations.

Given that, we’d like to focus…

Rails, PostgreSQL Performance Audit and Tuning Consultant for Hire 

Five Easy to Miss Performance Fixes for Rails Apps

Improving the performance of a Rails application can be a challenging and time-consuming task. However, there are some config tweaks that are often overlooked but can make a significant difference in response times. In this tutorial, I will focus on a few “quick & easy” fixes that can have an immediate impact on the speed of your Rails app.

Eliminate request queue time

Request queue time means that your web servers don’t have enough capacity to process the incoming traffic. Unless you’re using a PAAS platform like Heroku, you have to add an extra NGINX header to enable request queuing data in the logs:

proxy_set_header X-Request-Start "t=${msec}";

This config will enable any popular APM…

BigBinary Blog 

Rails 7.1 adds ActiveRecord::Base::normalizes

Rails 7.1 has introduced a new method in Active Record that can be used todeclare normalizations for attribute values. This can be especially useful forsanitizing user input, ensuring consistent formatting, or cleaning up data fromexternal sources.

Before Rails 7.1, you could normalize attributes using before_save callback.

model User < ApplicationRecord  before_save :downcase_email, if :email_present?  private    def email_present?      email.present?    end    def downcase_email      email.downcase!    endend

In Rails 7.1, you can refactor the above to the below code.

model User < ApplicationRecord  normalizes :email, with: -> email { email.downcase }end

The normalization is applied when the…

The Bike Shed 

383: Code as Storytelling with Nicole Zhu

Engineering manager at Vox Media and author Nicole Zhu joins Stephanie on today's episode to discuss her writing practice.

nicoledonut is a biweekly newsletter about the writing process and sustaining a creative life that features creative resources, occasional interviews with creative folks, short essays on writing and creativity, farm-to-table memes and TikToks, and features on what Nicole is currently writing, reading, and watching.


This episode is brought to you by Airbrake. Visit Frictionless error monitoring and performance insight for your app stack.


Transcript:

STEPHANIE: Hello and welcome to…

Giant Robots Smashing Into Other Giant Robots 

This week in #dev (Apr 28, 2023)

Welcome to another edition of This Week in #dev, a series of posts where we bring some of the most interesting Slack conversations to the public. This is the Today I Learned edition.

Active Record’s rewhere

Matheus Sales learned about the rewhere method in Active Record. It’s a query method that allows you to change a previously set where condition for a given attribute instead of appending to that condition.

Post.where(published: true).rewhere(published: false) # => WHERE `published` = 0

It can be handy for overriding a default_scope or when building an index page with a couple of filters, and one of those must override previous ones applied.

There’s also reorder and reselect

Gusto Engineering - Medium 

Singed, a Profiler Front-End for Ruby and Rails Applications

Have you ever found yourself wanting to understand why a block of Ruby code, a particular web request, or a certain controller action was running so slowly? Maybe you’ve used some profiling tools like speedscope in the past, but found it cumbersome, or you’ve tried but failed to figure out how to use them.

flamegraph: Anything… and that’s it!

Introducing Singed, a new profiling frontend from Gusto written by Josh Nichols (aka @technicalpickles). Singed was built to be a swiss-army-knife frontend to several tools (stackprof, rbspy, and speedscope), helping you to easily capture and view flamegraphs, where before you had to write a bunch of boilerplate or temporary code just to get started.

Why…

Hanami Mastery newest episodes! 

Open Source Heroes - A Poem of Appreciation.

Working with open source for a long time is tremendous work, often unappreciated. Join me with a moment of sharing a word of appreciation to one of OSS heroes you know!
Julia Evans 

New talk: Learning DNS in 10 years

Here’s a keynote I gave at RubyConf Mini last year: Learning DNS in 10 years. It’s about strategies I use to learn hard things. I just noticed that they’d released the video the other day, so I’m just posting it now even though I gave the talk 6 months ago.

Here’s the video, as well as the slides and a transcript of (roughly) what I said in the talk.

the video

the transcript

.container{ display:flex; } .slide { width:40%; border-bottom: 2px #ccc dashed; padding: 10px 0px; } .slide img { width: 100%; } .content{ width:60%; align-items:center; padding:20px; } @media (max-width: 480px) { .container{ display:block; } .slide, .content { width:100%; } } …
Mike Perham 

Scaling Huge Transactional Datasets with Redis Cluster

Recently I made some minor changes to Sidekiq Enterprise 7.1 in order to greatly increase the scalability of the Rate Limiter feature. Redis has a little-known feature which allows you to safely use MULTI transactions with multiple keys in a cluster. This was a real learning experience for me so I thought other people might find this interesting.

Once a Maintainer 

Once a Maintainer: Maciej Mensfeld

Welcome to Once a Maintainer, where each week we highlight an OSS maintainer doing great work in the community and tell their story. This week we’re talking to Maciej Mensfeld, creator of the karafka gem and contributor to dry-rb and other Ruby projects. Karafka is a Ruby and Rails multi-threaded Kafka processing framework.

I first met Maciej in the Bundler Slack group, where he is a friendly and active community member. He dialed in for our chat from Kraków, Poland, where he lives and works.

How did you get into programming?

I think my story is quite similar to other people 20-25 years ago. I was just a kiddo. I think I was around 10 or 12 when we got a Famicon clone. It was called something…

Saeloun Blog 

Connecting AWS RDS with an EC2 instance

Amazon Web Services(AWS) provides a range of cloud-based services, and two of the most popular are Amazon Elastic Compute Cloud(EC2) and Amazon Relational Database Service (RDS). EC2 is a virtual server running in the cloud that can be scaled up or down as per the needs of a user, while RDS is a service that enables us to setup, operate and scale a relational database in the AWS cloud.

In this blog, we will go through the steps to launch an EC2 instance, launch an RDS instance, and connect RDS from the EC2 instance.

Configuring an EC2 instance

1. Sign in to the AWS Management Console and navigate to the EC2 service.

2. Click on the “Launch Instance”

3.…

Aha! Blog 

Product All-Star: 6 Questions With Amanda Spina

Amanda Spina is a product manager at ClearlyAgile. She is a consultant, problem-solver, and advocate for Aha! software.
Short Ruby Newsletter 

📑 Short Ruby News - The Content Edition #41

You can jump directly to a section:

🗞 Newsletters

🎧 Podcasts

🎥 Videos: Talks and Screencasts

✍🏾 Articles containing What's New, How-Tos, Deep Dives and Related

Consider reading also the complementary Code Edition.

For just a small amount of $1.5 per week (only $6.5 a month), you can become a valued paid subscriber and actively support the thriving Ruby community we all love!

Support the newsletter for ~1.5$/week


🗞 Newsletters

🗞️ Ruby Weekly published a new edition: Faraday keeps us in the loop

🗞️ Greg Molnar published a new edition of Active Record where tricks - Rails Tricks Issue 5

🗞️ Greg Molnar published a new edition of This Week in Rails: Rails World tickets waiting list, caching improvements

🗞…

Short Ruby Newsletter 

💻 Short Ruby News - The Code Edition #41

You can jump directly to a section:

👐 Our Community

👉 All about Code and Ruby

🧰 Gems, Libraries, and Updates

🤝 Related (but not Ruby-specific)


For just a small amount of $1.5 per week (only $6.5 a month), you can become a valued paid subscriber and actively support the thriving Ruby community we all love!

Support the newsletter for ~1.5$/week


👐 Our Community

Just a reminder that Friendly.rb conference launched a new sponsorship tier: Community sponsorship at only $1250:

(disclaimer Short Ruby is a production sponsor at Friendly.rb, and I am one of the co-organizers)


👐 Adarsh announced that Ruby Central is inviting people to contribute in multiple ways. Check ru…

Drifting Ruby Screencasts 

Session Hijacking

In this episode, we explore session hijacking and an approach that we can take to limit the risk. There are some user experience and functionality caveats to this approach so they must be taken into consideration as well.
Sandip Mane 

React hook for JavaScript debounce

Create a JavaScript Debounce hook that works with React state.

The hook

This is as simple as it gets, create the following file in your codebase.

Use case 1

A simple use case when we want to listen to changes in a state.

const [username, setUsername] = useState("");
const debouncedUsername = useDebounce(username, 800);

useEffect(() => {
  // do the thing...
}, [debouncedUsername]);

Use case 2

This also works with complex form structures, get callbacks when anything or specific attributes change in the state.

const [formValues, setFormValues] = useState({
  email: "",
  address: { city: "" }
});

// Updates when anything in the form changes
const debouncedFormValues = useDebounce(
zverok's space 

A few words on Ruby's type annotations state

…that were written in a military training camp and accidentally grew to 5k words.

I am writing this on my phone, in a barrack that houses some 200+ of my brothers-in-arms in the Ukrainian army’s training camp; I use short periods of rest between training, mostly at night and on Sundays. TBH, since joining the army, I didn’t expect to have time or inspiration to write about Ruby, and yet, here we are.

Recently, there was a long and quite interesting discussion in /r/ruby, which started with an article about one of Ruby’s type annotation tools, Sorbet—or rather, the reason somebody would abandon attempts of using it.

The discussion quickly turned into a generic argument about typing,…