From 94a95db2f5cf48b63d1bd08d849790156572a1f5 Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Mon, 28 May 2018 17:43:08 +0200 Subject: [PATCH] Lazy initialization of rich text model --- lib/action_text/attribute.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/action_text/attribute.rb b/lib/action_text/attribute.rb index bd76999167..3b855901e8 100644 --- a/lib/action_text/attribute.rb +++ b/lib/action_text/attribute.rb @@ -6,7 +6,7 @@ module ActionText def has_rich_text(name) class_eval <<-CODE, __FILE__, __LINE__ + 1 def #{name} - rich_text_#{name} + self.rich_text_#{name} ||= ActionText::RichText.new(name: "#{name}", record: self) end def #{name}=(body)