From d1e3a5ba8562d2aad58029115af9d64861fe2ea4 Mon Sep 17 00:00:00 2001 From: Kasper Timm Hansen Date: Tue, 10 Dec 2024 15:11:38 +0100 Subject: [PATCH] Prep some docs --- README.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/README.md b/README.md index 816bf7c..4725731 100644 --- a/README.md +++ b/README.md @@ -96,6 +96,17 @@ You can see real life examples in these blog posts: If your team is using Associated Objects, we're more than happy to feature any write ups here. +### Setting up an `ApplicationRecord::AssociatedObject` + +In case you need to define default logic exclusive to your Associated Objects you can set up a common base class in `app/models/application_record/associated_object.rb`. + +```ruby +class ApplicationRecord::AssociatedObject < ActiveRecord::AssociatedObject +end +``` + +We'll set this up when you run the generator below too. + ### Use the generator to help write Associated Objects To set up the `Post::Publisher` from above, you can call `bin/rails generate associated Post::Publisher`.