lib/avo/fields/belongs_to_field.rb in avo-2.1.2.pre2 vs lib/avo/fields/belongs_to_field.rb in avo-2.2.0
- old
+ new
@@ -59,19 +59,21 @@
class BelongsToField < BaseField
attr_reader :polymorphic_as
attr_reader :relation_method
attr_reader :types # for Polymorphic associations
+ attr_reader :allow_via_detaching
def initialize(id, **args, &block)
args[:placeholder] ||= I18n.t("avo.choose_an_option")
super(id, **args, &block)
@searchable = args[:searchable] == true
@polymorphic_as = args[:polymorphic_as]
@types = args[:types]
@relation_method = id.to_s.parameterize.underscore
+ @allow_via_detaching = args[:allow_via_detaching] == true
end
def searchable
@searchable && ::Avo::App.license.has_with_trial(:searchable_associations)
end