One Ruby Thing

An email newsletter, with one Ruby/Rails technique delivered with a ‘why?’ and a ‘how?’ every two weeks. It’s deliberately brief, focussed & opinionated.

  1. Further Performance Testing Enumerable’s Loveliness May 29th, 2025
  2. Performance Testing Enumerable’s Loveliness May 26th, 2025
  3. Enumerable’s loveliness May 26th, 2025
  4. What’s the difference between Rails’s try and the safe navigation (&.) operator? April 28th, 2025
  5. Using Deep Duplication to Avoid Surprises March 13th, 2025
  6. Ordinal Numbers in Rails: 1st, 2nd, 3rd, 4th February 5th, 2025
  7. Use blank? and present? in Rails November 11th, 2024
  8. Launching UsingRails: A Directory of Rails-Based Organisations October 16th, 2024
  9. Compress Your Images June 5th, 2024
  10. Railsconf Detroit 2024: A Co-chair’s Perspective May 19th, 2024
  11. Validate Email Addresses February 26th, 2024
  12. Read the .ruby-version into your Gemfile February 7th, 2024
  13. Why go to a Ruby or Rails conference? February 2nd, 2024
  14. Find definitions of Rails methods using source_location and bundle open December 4th, 2023
  15. For clarity merging hashes use with_defaults November 20th, 2023
  16. Customize and abbreviate number_to_human October 16th, 2023
  17. Express yourself clearly with positive? and negative? for numbers September 11th, 2023
  18. Play in a sandbox in production August 14th, 2023
  19. Beware of <%== in your erb files July 17th, 2023
  20. Really, Really, Really Don’t Interpolate Strings into Active Record Methods May 29th, 2023
  21. Assign a default value to an attribute in Active Record March 13th, 2023
  22. Consider find_each for looping through Active Record associations February 27th, 2023
  23. Try not to loop through associations inside jobs February 13th, 2023
  24. Only use locals in view partials January 22nd, 2023
  25. Find out what callbacks are defined on an Active Record model in the console December 5th, 2022
  26. Safely Remove a Column from an Active Record Model November 14th, 2022
  27. Use zero? for comparison of numerics like Integer, Float and BigDecimal October 31st, 2022
  28. Time Ranges are Clearer When Querying Databases October 17th, 2022
  29. Time extensions are an unsung hero of Active Support October 3rd, 2022
  30. Use before? and after? Methods When Comparing Dates and Times in Rails September 19th, 2022
  31. The Mrs Triggs Problem May 16th, 2022
  32. Know what your scopes are doing: where.first vs find_by March 14th, 2022
  33. Software & Infrastructure we use to Run Our SaaS January 31st, 2022
  34. Enqueue Jobs Quickly with Sidekiq’s Bulk Features January 24th, 2022
  35. Tidy Up Your Routes with Only December 6th, 2021
  36. Don't Use Floats and Use the Ruby Money Gem to Represent Currencies November 15th, 2021
  37. Use Sidekiq Directly, Not Through Active Job October 4th, 2021
  38. Use compact_blank to remove empty strings from Arrays and Hashes September 20th, 2021
  39. Compress Your HTML Responses August 30th, 2021
  40. Don’t call a new version of something ”new” when refactoring August 2nd, 2021
  41. Calculate the standard deviation of a Ruby array June 28th, 2021
  42. Calculate the mode & median averages of a Ruby array June 21st, 2021
  43. Opt out of Google’s FLoC User Tracking on Netlify May 24th, 2021
  44. Opt out of Google’s FLoC User Tracking in Rails May 24th, 2021
  45. Wrap your environment variables in a settings object May 10th, 2021
  46. Order by created_at and updated_at with scopes and a concern April 26th, 2021
  47. Do not use .all without pagination or a .limit April 12th, 2021
  48. Be specific when defining your routes March 22nd, 2021
  49. Turn off the bits of Rails you don't use March 8th, 2021
  50. Use Rails URL helpers outside views and controllers February 22nd, 2021
  51. Use Enhanced Memoization for false/nil with defined? February 8th, 2021
  52. Convert a two character ISO country code to an emoji flag February 1st, 2021
  53. Memoize Expensive Code January 25th, 2021
  54. Alt:BrightonRuby: An Online Ruby Conference — June/July 2020 April 26th, 2020
  55. ‘Fix’ first & last by explicitly setting implicit ordering March 1st, 2020
  56. All Your Mailer Views in One Place February 16th, 2020
  57. Calculate a mean average from a Ruby array February 2nd, 2020
  58. Be Suspicious of Join Tables January 20th, 2020
  59. Use Loose Ruby Versioning in Your Gemfile December 15th, 2019
  60. Ensure you correctly build your caching keys December 1st, 2019
  61. Write One Test November 17th, 2019
  62. Use GitHub Actions for Rails CI with Postgres November 3rd, 2019
  63. Use Active Support in Rails for deprecation messages October 20th, 2019
  64. A Active Model validator for Stripe Ids September 22nd, 2019
  65. Use a custom validator September 8th, 2019
  66. Clamp for min/max values August 11th, 2019
  67. Consider Value Objects July 28th, 2019
  68. Using strftime in a Rails view is probably a mistake July 14th, 2019
  69. Don’t Email From Active Record Callbacks June 2nd, 2019
  70. Watch Out For nil in Ranges May 19th, 2019
  71. Be Aware of nil values when using where.not() April 28th, 2019
  72. Prevent Links in Text Fields to Foil Spammers April 14th, 2019
  73. Protect your sign up form with Rack::Attack March 24th, 2019
  74. Clean up broken .dev domains March 13th, 2019
  75. Don't use instance variables in partials March 10th, 2019
  76. Secure Your Rails Staging Environment with HTTP Basic Authentication February 24th, 2019
  77. Be Careful Assigning to has_one Relations February 10th, 2019
  78. Replace Timecop With Rails’ Time Helpers in RSpec January 27th, 2019
  79. Use Multiple Migrations When Adding Database Constraints January 13th, 2019
  80. Always Force Booleans to be True or False December 17th, 2018
  81. Write long strings with wiggly HEREDOCs December 2nd, 2018
  82. A scope should return a scope October 14th, 2018
  83. Don’t Loop & Do Work in Jobs September 30th, 2018
  84. Using pluck can save a bunch of memory September 16th, 2018
  85. Careful with present? when using ActiveRecord scopes September 2nd, 2018
  86. Use the presence method August 19th, 2018
  87. Delegate to simplify your code August 5th, 2018
  88. Ignore PHP bots with Rack::Attack June 24th, 2018
  89. Use beginning and end of string in regular expressions June 10th, 2018
  90. Active Record’s first and last may not mean what you think May 27th, 2018
  91. A job should know whether to run itself May 13th, 2018
  92. Use Hash#fetch when using Rails params in controllers April 29th, 2018
  93. Stop robots and crawlers causing errors in your Rails application April 15th, 2018
  94. Check Your Database Indexes For ActiveRecord Scopes March 18th, 2018
  95. Only use named scopes outside models March 4th, 2018
  96. Avoid Writing SQL When Using ActiveRelation February 18th, 2018
  97. Enumerable avoids using temporary variables when looping February 5th, 2018
  98. Extract conditionals into well-named methods January 21st, 2018
  99. Be sparing when using unless January 7th, 2018
  100. Truthiness in Conditionals December 31st, 2017
  101. Set your page title in the view template using content_for December 11th, 2017
  102. Choose UUIDs for model IDs in Rails November 26th, 2017
  103. Use a pull request template November 12th, 2017
  104. Use simplecov in your Rails test suite October 29th, 2017
  105. Rescue specific errors. Avoid rescuing StandardError. Don’t rescue Exception. October 15th, 2017
  106. Don’t use default_scope. Ever. October 1st, 2017
  107. Use Rails’ naming conventions for dates & times September 29th, 2017
  108. Rails Naming Cringes October 13th, 2016
  109. AMP Project Pages on Ruby on Rails September 24th, 2016
  110. Simple Ruby/Rails Setup on macOS May 5th, 2016
  111. Benchmarking each_with_object Against inject when building Hashes from Arrays October 21st, 2014
  112. Serving a Jekyll Blog using Heroku January 19th, 2014
  113. Web Services used at ImpulseFlyer June 8th, 2012
  114. RedDotRubyConf 2012: Wrap up May 22nd, 2012