1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Lazy initialization of rich text model

This commit is contained in:
David Heinemeier Hansson 2018-05-28 17:43:08 +02:00
parent aa42bf2027
commit 94a95db2f5

View file

@ -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)