Ruby articles by Ruby developers

Ruby is our favourite programming language and more importantly programming community.

Even though we have been using Ruby for several years now we love to learn more about the language, the following posts are us sharing our learnings with you.

There is also a category dedicated to Ruby on Rails, if that is more your thing.

How to speed up Rubocop

How to speed up Rubocop

A small bit of config that could speed up your Rubocop runs

Irreversible Rails Migrations

Irreversible Rails Migrations

What are irreversible migrations and how might we use them to our advantage?

The best way to test model scopes in Rails

The best way to test model scopes in Rails

Learn about Rails scopes and how to best test them with both Rspec and Minitest

Finding out what called a Ruby method

Finding out what called a Ruby method

A quick way to understand what is calling your code using the caller method

Forcing a Rails database column to be not null

Forcing a Rails database column to be not null

How you can force a table column to always have something in it with Rails

Database Consistency Gem

Database Consistency Gem

The database consistency gem was new to me but it is fast becoming a must-install tool

What are Rails Migrations

What are Rails Migrations

A beginner friendly guide to Ruby on Rails migrations. What they are and why they are awesome, complete with examples and explanations.

Iterate over indexed params in Rails

Iterate over indexed params in Rails

When your API isn't Rails-shaped, sometimes you need to handle input differently

Creating a product file for Merchant Center in Rails

Creating a product file for Merchant Center in Rails

How to create a product file for Google's Merchant Center in Rails, without any additional gems

Rails route to catch non-GET requests to root path

Rails route to catch non-GET requests to root path

We needed to add a specific line into our routes.rb file to cover non-GET requests going to the root path.

Pros and cons of hiring freelance ruby developers

Pros and cons of hiring freelance ruby developers

The decision to go with hiring an employee, hiring a freelancer, or going with an agency is a hard one, we talk through some pros and cons for each

Upgrading Ruby - Steps to follow

Upgrading Ruby - Steps to follow

Here are the steps you should follow to upgrade Ruby as stress free as possible

Fixing Issues with GitHub Actions and Rails

Fixing Issues with GitHub Actions and Rails

How I went about fixing some issues with a first push of GitHub Actions on a Rails project

Replacing Sidekiq with GoodJob

Replacing Sidekiq with GoodJob

We recently moved a client to GoodJob, and would do it again!

Use to_sql without slashes

Use to_sql without slashes

Do you hate slashes in your to_sql output? Then this post is for you!

Using the paranoia gem when joining tables

Using the paranoia gem when joining tables

Something I learned today about joining two tables that both use acts_as_paranoid

Setting up a dedicated Sidekiq queue

Setting up a dedicated Sidekiq queue

If you want one type of queue to always be processed, a dedicated Sidekiq process is the answer

Changing colours in Rails Admin

Changing colours in Rails Admin

How to change up the colours in Rails Admin

Adding timestamps to join tables in Rails

Adding timestamps to join tables in Rails

How to go about adding timestamps to your Rails join tables

Ignore empty nested attributes when using Rails Admin

Ignore empty nested attributes when using Rails Admin

How to resolve issues that arise with saving models if you have empty nested attributes using reject_if

Git commands we use most often

Git commands we use most often

Some basic Git commands that we frequently use here at Tosbourn Ltd.

Auto reloading Rails Admin

Auto reloading Rails Admin

How to avoid restarting your server when making Rails Admin changes

Getting sign out link_tos to work with Rails 7

Getting sign out link_tos to work with Rails 7

How to get your sign out link_tos to work with Rails 7

Getting vips to work with Rails on Heroku

Getting vips to work with Rails on Heroku

As of Rails 7, vips is the default way to manipulate images. This is how we got vips working on Heroku

What are the square brackets in my Rails migrations?

What are the square brackets in my Rails migrations?

Let's look at what these little square brackets are doing in our Rails migration files

Setting up Permissions Policy with Rails

Setting up Permissions Policy with Rails

How to set up Permissions Policy HTTP header in your Rails app

Basic guide to Content Security Policy with Rails

Basic guide to Content Security Policy with Rails

The basics of setting up CSP with your Rails app

Postico: How to install and use Postico to connect to a database

Postico: How to install and use Postico to connect to a database

The basics of using Postico

Rails migrations - add default value to existing column

Rails migrations - add default value to existing column

Here's how to update an existing column to use a default value

Create or remove columns or tables with Rails migrations

Create or remove columns or tables with Rails migrations

Here's how to go about creating or removing a column optionally using Rails migrations

Using Faker with Rails

Using Faker with Rails

A guide to setting up Faker to work within Rails and why you'd want to

Using Shoulda Matchers with RSpec

Using Shoulda Matchers with RSpec

A guide to setting up Shoulda Matchers to work with RSpec

Testing Routes with RSpec

Testing Routes with RSpec

Testing routes can give you more confidence and help drive application development; here is how to do it with RSpec

How to ignore Bullet in RSpec tests

How to ignore Bullet in RSpec tests

Using Bullet during a test can pick up mistakes but also has false negatives; here is an easy way to ignore them

How we used Nokogiri to fix a sizing issue in YouTube's oEmbed

How we used Nokogiri to fix a sizing issue in YouTube's oEmbed

At some point, one of our calls to YouTube's oEmbed endpoint was returning videos way too small; we fixed in in our Rails application by using Nokogiri

How to comment Rails migrations

How to comment Rails migrations

We recently learned how you could apply comments to your migrations in Rails

Action Text Sanitizer update to more inclusive language

Action Text Sanitizer update to more inclusive language

How I went about updating my Action Text allowed tags/attributes

SEO for Ruby on Rails projects

SEO for Ruby on Rails projects

How to do technical SEO with your Ruby on Rails application

Converting images to use Google's webp format

Converting images to use Google's webp format

A quick guide to using Google's command line tool to convert images to webp format

Speed up pasting text into Rails console

Speed up pasting text into Rails console

Recently we had to copy and paste large amounts of text into a ruby console and we found a pretty quick way to do it

A quick tip to speed up bundle installs

A quick tip to speed up bundle installs

Use more computing power to install gems faster

Removing fields with a Rails migration

Removing fields with a Rails migration

Ruby on Rails gives you powerful tools to make removing old fields easy, lets walk through how we can do this

Testing Arrays In RSpec

Testing Arrays In RSpec

Three patterns for testing ruby arrays in RSpec, pick the one most appropriate for your use case

Using RSpec to test meta descriptions

Using RSpec to test meta descriptions

A little code snippet to show you how to test meta descriptions in RSpec

Rails Admin - only display field on edit

Rails Admin - only display field on edit

Conditionally displaying fields only if they are present in the database

Generating Open Graph social media images

Generating Open Graph social media images

A Ruby Open Graph image generator using Tinify and RMagick

Fixing an issue with Sprockets and feature tests

Fixing an issue with Sprockets and feature tests

A fix we found for issues with the asset pipeline on CircleCI

Removing unused Trix Editor buttons

Removing unused Trix Editor buttons

How to quickly remove unused Trix Editor buttons from your site

Quick and dirty initial avatars

Quick and dirty initial avatars

A quick guide to adding initial avatars using the Avatarly gem

Creating a SagePay Encryption in Ruby

Creating a SagePay Encryption in Ruby

A SagePay encryption for Ruby that some folk might find useful

Active Storage - resizing images on upload

Active Storage - resizing images on upload

Our fix for app timeouts due to upload of large images when Active Storage was used

Making your Trix toolbar sticky

Making your Trix toolbar sticky

Editing long sections of text can be cumbersome with the Trix editor. Let's make it better

Testing ActionText without JavaScript

Testing ActionText without JavaScript

I needed JS to get out of the way so I could do basic testing

How to install a beta version of Rails

How to install a beta version of Rails

This article will show you how using the gem command you can install beta versions of Rails

How to fix problem installing Charlock Holmes Gem

How to fix problem installing Charlock Holmes Gem

My fix for installing 0.7.6 of the Charlock Holmes gem on macOS

Rubocop CircleCI Config

Rubocop CircleCI Config

How to fix issues with Rubocop running on your entire code base

Using the 'it' Gem to add links to translations

Using the 'it' Gem to add links to translations

How to can use the 'it' Gem to add links to your translations

Setting up Rails to use PostgreSQL

Setting up Rails to use PostgreSQL

A short guide to setting up your Rails project to use the PostgreSQL database

How to change the column type with Rails migrate

How to change the column type with Rails migrate

How to change the column type with a Rails migration. Lets find out how to do this common Rails task

When to include irb in Ruby 2.4.0

When to include irb in Ruby 2.4.0

When should you include irb into your scripts and when you don't need to in Ruby 2.4.0

ActiveJob Vs ApplicationJob

ActiveJob Vs ApplicationJob

A very quick clarification on ActiveJob and ApplicationJob

Spring and Foreman complaining about secret_key not being set

Spring and Foreman complaining about secret_key not being set

Spring and Foreman when freshly set up can complain about secret_key not being set when it is, I will show you how to fix this

LRUG (London Ruby User Group) writeup from July 2016's meetup

LRUG (London Ruby User Group) writeup from July 2016's meetup

My writeup of the July 2016 LRUG, a monthly Ruby User Group meetup in London, England

Brighton Ruby 2016

Brighton Ruby 2016

My writeup of Brighton Ruby 2016, an annual Ruby conference in Brighton, England

Fixing No Default Alternative Specified error in rails

Fixing No Default Alternative Specified error in rails

If you spot an error saying No default alternative specified when starting up rails, we can fix that

Loading a specific file into Dotenv

Loading a specific file into Dotenv

Loading a specific file into Dotenv. A quick guide for when you want to run Ruby files from outside of a document root

How does Capistrano work?

How does Capistrano work?

How does Capistrano work? There is nothing magic, there is nothing to be scared of

My notes from November 2015's LRUG

My notes from November 2015's LRUG

My notes from the London Ruby User Group that happened in November 2015

Pictures from LRUG Nov ‘15

Pictures from LRUG Nov ‘15

Some pictures from November 2015’s London Ruby User Group

What is a Gemfile

What is a Gemfile

What is a Gemfile? Here is my detailed explanation of what a Gemfile is and what it does, enjoy

Adding skip_after_filter to Rails Admin

Adding skip_after_filter to Rails Admin

How I added a skip_after_filter to rails_admin, which is something I recently had to do to extend the functionality of Rails Admin

Uploading files with Capybara in RSpec tests

Uploading files with Capybara in RSpec tests

You can easily upload files with Capybara when testing with RSpec

The difference between Render and Redirect in Rails

The difference between Render and Redirect in Rails

Find out the difference between Render and Redirect in Rails

What is a Proc?

What is a Proc?

Here I explain what a proc is in Ruby and some of the nuances

Deleting Attachments with rails_admin

Deleting Attachments with rails_admin

How you can go about deleting attachments using Rails Admin

Updating a Slug on a live Rails System

Updating a Slug on a live Rails System

How you can go about updating slugs and dealing with redirects

Ruby’s Partition for Enumerables

Ruby’s Partition for Enumerables

Something new I learned about partitioning on enumerables in Ruby

POODIR On Testing

POODIR On Testing

I've been re-reading Sandi Metz' POODIR and here are my thoughts on testing

Rails Migrations for Beginners

Rails Migrations for Beginners

An overview of Rails migrations, what they are and how to use them

Set Intersection in Ruby

Set Intersection in Ruby

How to see commonalities between two data sets using Ruby

Some notes and links on WebSockets with Rails

Some notes and links on WebSockets with Rails

Here's some useful points on using WebSockets with Rails

Nokogiri won't install? Check that you have accepted Xcode's EULA

Nokogiri won't install? Check that you have accepted Xcode's EULA

An non obvious reason for being unable to install updates to Nokogiri

Converting numbers to hex using to_s in Ruby

Converting numbers to hex using to_s in Ruby

How you can use the Ruby to_s method to convert numbers to hex

Get the name of a Ruby class

Get the name of a Ruby class

Here's how you can go about getting the name of a class in Ruby

Programmatically finding the size of the retry queue with Sidekiq

Programmatically finding the size of the retry queue with Sidekiq

How to use Sidekiq's API for querying the state of queues

Using Ruby to get access to Google Keywords

Using Ruby to get access to Google Keywords

Here's a guide on how you can use Ruby to get access to Google Keywords

Generating migrations with couchrest_model

Generating migrations with couchrest_model

How you can go about generating migrations with couchrest_model

CouchRest Rails Setup - Blank username/password issues

CouchRest Rails Setup - Blank username/password issues

Setting a blank username/password is not the same as not setting a username/password

An introduction to Ruby/Rails/Git - Belfast Ruby

An introduction to Ruby/Rails/Git - Belfast Ruby

Here's a writeup of an event that I attended in Belfast

When testing the datasift ruby gem locally be sure to turn SSL off

When testing the datasift ruby gem locally be sure to turn SSL off

Here's how to go about not getting caught out with this

Belfast Ruby: Talks on Elixir, Tmux and Jekyll

Belfast Ruby: Talks on Elixir, Tmux and Jekyll

A quick write up on a few different talks given at Belfast Ruby

Using Devise to verify an email address and password

Using Devise to verify an email address and password

How to go about using Devise to do verification on user credentials

Barry Gordon talks about Vagrant - Belfast Ruby

Barry Gordon talks about Vagrant - Belfast Ruby

A short writeup on a talk given at Belfast Ruby by Barry Gordon

Getting the flot-rails gem to play nicely with IE8

Getting the flot-rails gem to play nicely with IE8

How to go about getting this Gem working nicely with IE8

Rspec's be_an_instance_of is pretty useful

Rspec's be_an_instance_of is pretty useful

A handy little method I found when testing my application with RSpec

Passing a day of the week into Ruby's Date.parse

Passing a day of the week into Ruby's Date.parse

How you can go about passing a day into Ruby's Date.parse

Some things I have learned about Ruby's fetch method

Some things I have learned about Ruby's fetch method

Here are some things that I have learned about 'fetch' that you may find useful

The quickest way to get from nothing to Ruby and Rails

The quickest way to get from nothing to Ruby and Rails

How to get Ruby on Rails set up easily and quickly on your Mac

Stopping all instances of Ruby on Rails running on a certain port

Stopping all instances of Ruby on Rails running on a certain port

How to find and stop all instances of Rails running on a specific port

Using Dropdowns in Watir Webdriver

Using Dropdowns in Watir Webdriver

How you can go about using dropdowns using the Watir Webdriver

Controlling a jQuery datepicker with Watir

Controlling a jQuery datepicker with Watir

Using a jQuery datepicker with the Watir Webdriver - example code

Write simple rspec tests on one line for fun and profit

Write simple rspec tests on one line for fun and profit

How you can change your simple RSpec tests to one liners

Adding Data Attributes using haml_tag

Adding Data Attributes using haml_tag

A guide to using haml_tag to add data attributes - dealing with hyphens

Getting the rmagick 2.12.2 gem working on Mac OS X

Getting the rmagick 2.12.2 gem working on Mac OS X

How you can go about getting RMagick working on Mac OSx

Validation Helpers

Validation Helpers

Here are some of the common validation helpers in Ruby on Rails

Secure your Redmine install by patching Ruby on Rails

Secure your Redmine install by patching Ruby on Rails

How to go about securing your Redmine install on Ruby on Rails

What is the RAILS_GEM_VERSION

What is the RAILS_GEM_VERSION

Where to find it and what it actually does in your application

Ruby Fizz Buzz Solution

Ruby Fizz Buzz Solution

My Ruby Fizz Buzz solution - I've been trying to get to know the language better

Ruby Testing and Documenting best practice

Ruby Testing and Documenting best practice

A little learning project with Ruby and how it manages testing

Recent posts View all

Web DevProductivity

Keeping on top of website updates

Learn what website updates are, what they entail, why they are important, and how we can help

Freelancing

Getting the most out of your agency

Here are some tips based on years of working with, for, and as an agency on how to get the most out of any work you do.