Polymorphic Relationships in ActiveRecord - dick.codes
Full-stack Ruby on Rails engineer. Blogs about programming topics.
https://dick.codes/2023/07/10/polymorphic-relationships.html
What is the difference between Turbo and Stimulus, and what exactly is Hotwire?
I’m going to try to help out by giving you a quick overview of what these things are, and where they fit in to the bigger picture. I’ll assume you’re familiar with the “basic” Rails stack - DB -> Models -> Controllers -> Views. Then, I’ll point you to some resources which you can use to dive deeper.
Testing Inherited Behavior
This post describes different ways of testing inherited behavior, including duplicating the tests, not testing the inherited behavior, and using a shared example.
Beware of <%== in your erb files
The danger of an extra equals
Rails 7.1 introduces deliver callbacks for ActionMailer
Rails 7.1 adds before_deliver and after_deliver callbacks to ActionMailer to hook into the lifecycle events of the mail delivery.
https://www.shakacode.com/blog/rails_add_deliver_callbacks_to_action_mailer/
Building Value Objects in Rails with composed_of
Learn how to improve the interface of your existing Active Record Models with this underutilized API.
Fix n+1 queries by caching computed values
N+1 queries are not always a problem, but I have seen that most of the n+1 queries that are really a problem are when we need to fetch data to compute something.
Here I will try to share some examples of posible expensive computations candidates to...
https://bhserna.com/fix-n+1-queries-by-caching-computed-values.html
Computed columns with the find_by_sql method in a Rails application
Introduction Ruby is a beautiful expressive programming language. Like many other...
https://dev.to/wpickeral/computed-columns-with-the-findbysql-method-in-a-rails-application-48ni
Are you absolutely sure your Rails caching strategy isn't leaking sensitive information?
Rails writes a new cache entry based on the first request. But what happens when that request is from an admin?
Where can I find good documentation about the #Mastodon architecture & the #ActivityPub protocol? I am curious how it works. The tech stack should feel familiar to most of us: #Ruby, #Ruby_on_Rails, #Redux, #React, #Redis and #Sidekiq. As I understand the article from @aral Sidekiq is used heavily. For every post or reply you write Mastodon creates automatically background jobs which send the post to all your followers on other instances via ActivityPub protocol. Correct?
https://ar.al/2022/11/09/is-the-fediverse-about-to-get-fryed-or-why-every-toot-is-also-a-potential-denial-of-service-attack/
#mastodon #activitypub #ruby #Ruby_on_Rails #redux #react #redis #sidekiq