Skip to content

Commit

Permalink
fix attach_fields on has one
Browse files Browse the repository at this point in the history
  • Loading branch information
Paul-Bob committed Jan 17, 2025
1 parent 8d7f82d commit 3a9c32a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
3 changes: 1 addition & 2 deletions lib/avo/fields/belongs_to_field.rb
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ class BelongsToField < BaseField
attr_accessor :target

attr_reader :polymorphic_as
attr_reader :relation_method
attr_reader :types # for Polymorphic associations
attr_reader :allow_via_detaching
attr_reader :attach_scope
Expand Down Expand Up @@ -96,7 +95,7 @@ def value
super(polymorphic_as)
else
# Get the value from the pre-filled association record
super(relation_method)
super(@relation_method)
end
end

Expand Down
5 changes: 2 additions & 3 deletions lib/avo/fields/has_one_field.rb
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
module Avo
module Fields
class HasOneField < FrameBaseField
attr_accessor :relation_method
attr_reader :attach_fields

def initialize(id, **args, &block)
hide_on :forms

super(id, **args, &block)

@placeholder ||= I18n.t "avo.choose_an_option"

@relation_method = name.to_s.parameterize.underscore
@attach_fields = args[:attach_fields]
end

def label
Expand Down

0 comments on commit 3a9c32a

Please sign in to comment.