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
A small bit of config that could speed up your Rubocop runs
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
Learn about Rails scopes and how to best test them with both Rspec and Minitest
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
How you can force a table column to always have something in it with Rails
Database Consistency Gem
The database consistency gem was new to me but it is fast becoming a must-install tool
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
When your API isn't Rails-shaped, sometimes you need to handle input differently
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
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
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
Here are the steps you should follow to upgrade Ruby as stress free as possible
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
We recently moved a client to GoodJob, and would do it again!
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
Something I learned today about joining two tables that both use acts_as_paranoid
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
How to change up the colours in Rails Admin
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
How to resolve issues that arise with saving models if you have empty nested attributes using reject_if
Git commands we use most often
Some basic Git commands that we frequently use here at Tosbourn Ltd.
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
How to get your sign out link_tos to work with Rails 7
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?
Let's look at what these little square brackets are doing in our Rails migration files
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
The basics of setting up CSP with your Rails app
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
Here's how to update an existing column to use a default value
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
A guide to setting up Faker to work within Rails and why you'd want to
Using Shoulda Matchers with RSpec
A guide to setting up Shoulda Matchers to work 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
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
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
We recently learned how you could apply comments to your migrations in Rails
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
How to do technical SEO with your Ruby on Rails application
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
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
Use more computing power to install gems faster
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
Three patterns for testing ruby arrays in RSpec, pick the one most appropriate for your use case
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
Conditionally displaying fields only if they are present in the database
Generating Open Graph social media images
A Ruby Open Graph image generator using Tinify and RMagick
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
How to quickly remove unused Trix Editor buttons from your site
Quick and dirty initial avatars
A quick guide to adding initial avatars using the Avatarly gem
Creating a SagePay Encryption in Ruby
A SagePay encryption for Ruby that some folk might find useful
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
Editing long sections of text can be cumbersome with the Trix editor. Let's make it better
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
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
My fix for installing 0.7.6 of the Charlock Holmes gem on macOS
Rubocop CircleCI Config
How to fix issues with Rubocop running on your entire code base
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
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 a Rails migration. Lets find out how to do this common Rails task
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
A very quick clarification on ActiveJob and ApplicationJob
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
My writeup of the July 2016 LRUG, a monthly Ruby User Group meetup in London, England
Brighton Ruby 2016
My writeup of Brighton Ruby 2016, an annual Ruby conference in Brighton, England
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. 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? There is nothing magic, there is nothing to be scared of
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
Some pictures from November 2015’s London Ruby User Group
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
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
You can easily upload files with Capybara when testing with RSpec
The difference between Render and Redirect in Rails
Find out the difference between Render and Redirect in Rails
What is a Proc?
Here I explain what a proc is in Ruby and some of the nuances
Deleting Attachments with rails_admin
How you can go about deleting attachments using Rails Admin
Updating a Slug on a live Rails System
How you can go about updating slugs and dealing with redirects
Ruby’s Partition for Enumerables
Something new I learned about partitioning on enumerables in Ruby
POODIR On Testing
I've been re-reading Sandi Metz' POODIR and here are my thoughts on testing
Rails Migrations for Beginners
An overview of Rails migrations, what they are and how to use them
Set Intersection in Ruby
How to see commonalities between two data sets using Ruby
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
An non obvious reason for being unable to install updates to Nokogiri
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
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
How to use Sidekiq's API for querying the state of queues
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
How you can go about generating migrations with couchrest_model
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
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
Here's how to go about not getting caught out with this
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
How to go about using Devise to do verification on user credentials
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
How to go about getting this Gem working nicely with IE8
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
How you can go about passing a day into Ruby's Date.parse
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
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
How to find and stop all instances of Rails running on a specific port
Using Dropdowns in Watir Webdriver
How you can go about using dropdowns using the Watir Webdriver
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
How you can change your simple RSpec tests to one liners
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
How you can go about getting RMagick working on Mac OSx
Validation Helpers
Here are some of the common validation helpers in 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
Where to find it and what it actually does in your application
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
A little learning project with Ruby and how it manages testing