From 0f5955f4c3cfcf68c66f11a0a0fc55aa38b535cf Mon Sep 17 00:00:00 2001 From: justin talbott Date: Thu, 10 Oct 2024 23:14:22 -0400 Subject: [PATCH] association options --- lib/hoardable/has_one.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/hoardable/has_one.rb b/lib/hoardable/has_one.rb index 0e534cf..1bf8d7c 100644 --- a/lib/hoardable/has_one.rb +++ b/lib/hoardable/has_one.rb @@ -10,8 +10,8 @@ def has_one(*args) options = args.extract_options! hoardable = options.delete(:hoardable) name = args.first - association = super(*args, **options)[name] - return unless hoardable || (association&.options[:class_name].match?(/RichText$/)) + association_options = super(*args, **options)[name]&.options + return unless hoardable || (association_options && association_options[:class_name].match?(/RichText$/)) class_eval <<-RUBY, __FILE__, __LINE__ + 1 def #{name}