-
Error on an M1 Mac loading Rails: node-sass refusing to compile.
Fixing an error with a stale Rails project erroring while starting up on an M1 Mac
-
Getting a Count of Occurrences of Items in a Ruby Array (and a Caveat for Rails)
I feel like I’m often wanting to count occurrences of items in an array (Rails has its own special case as well), and I’m always trying to do it the “long way.” I finally stumbled upon this answer on StackOverflow that details the version-by-version options: Ruby 2.7+ use .tally directly on the array: Ruby 2.4+…
-
Use find_each vs. select or each when needing to process each record via Ruby
The problem: This scenario is a much more practical case of a similar concept with Rails / ActiveRecord count, size, and length. In this case, you’re needing to run ruby code off of either every value from a where method result or a subset that is determined by ruby code. For example, assume that a…