Skip to content

Commit

Permalink
association options
Browse files Browse the repository at this point in the history
  • Loading branch information
waymondo committed Oct 11, 2024
1 parent ccd7f21 commit 8fcae6a
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/hoardable/has_one.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@ 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$/))
has_one_options = super(*args, **options)[name]&.options
unless hoardable || (has_one_options && has_one_options[:class_name].match?(/RichText$/))
return
end

class_eval <<-RUBY, __FILE__, __LINE__ + 1
def #{name}
Expand Down

0 comments on commit 8fcae6a

Please sign in to comment.