From bcb727fed855798aaca304c330b680bca72791ae Mon Sep 17 00:00:00 2001
From: Zeke Gabrielse <ezekg@yahoo.com>
Date: Thu, 15 Aug 2024 14:08:05 -0500
Subject: [PATCH] update example

---
 README.md | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/README.md b/README.md
index 216a333..bed29f6 100644
--- a/README.md
+++ b/README.md
@@ -50,16 +50,33 @@ the association is nil, the null object will be returned instead.
 class NullPlan
   include Singleton
 
+  def name  = 'Free'
   def free? = true
   def pro?  = false
   def ent?  = false
 end
+```
 
+```ruby
 class Account
   belongs_to :plan, optional: true, null_object: NullPlan.instance
 end
 ```
 
+```ruby
+account = Account.create
+
+puts account.plan       # => #<NullPlan name="Free">
+puts account.plan.free? # => true
+puts account.plan.ent?  # => false
+
+account.update(plan: Plan.new(name: 'Ent', ent: true))
+
+puts account.plan       # => #<Plan id=1 name="Ent">
+puts account.plan.free? # => false
+puts account.plan.ent?  # => true
+```
+
 ## Supported Rubies
 
 **`null_association` supports Ruby 3.1 and above.** We encourage you to upgrade