Ruby on Rails
-
Prevent Mastodon and Bluesky from Generating POSSE Link Previews
Yesterday I posted that I’d resolved my new microblog POSSE1 posts from generating link previews on Mastodon and Bluesky. Today, I want to briefly run through how I managed that.
-
Oxtail, and more Cooklang Exploration
After yesterday’s post, it was time to finally try to handle a blog post and Cooklang recipe in one file. The solution to how to format things was simple: inline the recipe in a Markdown code fence and pre-process it.
-
Decryption/CypherError on Rails 7.1 Apps with Encrypted Columns After Upgrading from Previous Versions
When upgrading to Rails 7.1 with any models using the
encryptsmacro fromActiveRecord::Encryption, be wary of upgrading theconfig.load_defaultsinconfig/application.rbfrom7.0to7.1. The 7.1 defaults forActiveRecord::Encryptioninclude a combination of settings that can lead to your app... -
Reading JSON from a Rails API in Swift
Code dive into parsing dates and times with Swift’s Decodable as formatted by Rails APIs
-
Reduce Rails' Boot Memory by Removing Mail
Rail’s
actionmailboxand Ruby’smail(used by bothactionmailboxandactionmailer) gems create a lot of memory bloat in applications, and they’re often not required for your app. -
Undo in assets:clobber What You Do in assets:precompile
As a best practice, when you enhance your Rails app’s
assets:precompiletask to build static assets that can be served faster than if they needed to be compiled at runtime, you should also enhanceassets:clobberto remove the artifacts you create. -
I Built a Linklog
In the spirit of Daring Fireball and to fill a space between a social post or boost and a full blog post, I’ve created a new feature for Hearthside that allows me to share a link to a web page that I want to share along with some brief notes and, usually, a quote. It’s similar to social...
-
/now Hear This
/now answers “what are you up to recently?” and you should have one.
-
Running a Single-User Mastodon Instance
How I use my domain in my Mastodon username, settings I recommend for single-user servers, and migrating to a new instance.
-
This Gem is Mentionable
Mentionable is a gem that provides support for inbound Webmentions and microformats in Rails apps.
-
has_few :god_objects
We can achieve better object design and smaller interfaces by defining associations in one direction only.
-
Flowing Text Around Images
Magazines, books, and other print layouts sometimes use images that overlap with the text, and have that text wrap around the shape of the image. It can make for an interesting effect, bringing a feeling of motion into a static medium. Done right, the text and image become conceptually closer in...
-
A Site Reborn
I’ve moved my Jekyll site into a Rails app, and I’ve done just enough work to have every post render without errors and added just enough style to make things readable. Some of the site still looks pretty bad, and none of it looks good yet. But that’s ok, because my plan is to rebuild and...
-
CSS-only Submenu Navigation with Post Tags
Our posts have categories, which I’ve used as a “collection” or “series” of posts that are on related topics. Recently, I’ve been writing up campaign notes for my D&D session as the characters themselves in a category simply called Campaign Logs. I’m also hoping to continue to write this type...
-
Need a Slug?
Rails provides its own slug generator, so you may not need another gem.
-
Multi-table Full Text Search in Postgres
Easily searching across an application’s data is a pervasive need. If you are lucky, you can get away with simple sorting or searching on a single column, but it is more likely that you need full text search across multiple models, all from a single search
<input>.Thanks to the power of ...
-
Not Invented Here
Rails is a mixture of design patterns, practices, and magic. In this talk, we’ll explore how Rails embraces ideas from other frameworks and projects.
Active Record was born of Martin Fowler. MVC was the brainchild of Trygve Reenskaug. Rails 3 completely absorbed the Merb project, gaining...
-
Store Page Titles in I18n
While the title element is one of the only required tags in HTML, it is often overlooked by developers and designers alike until the end of the development process.
-
Strong Parameters as Documentation
Besides moving attribute whitelisting to the controller rather than the model, Rails 4’s move to Strong Parameters over
attr_accessibleprovides great documentation about the data with which records are being created.