lib/avo/fields/belongs_to_field.rb in avo-2.5.2.pre.6 vs lib/avo/fields/belongs_to_field.rb in avo-2.5.2.pre.7

- old
+ new

@@ -60,11 +60,11 @@ class BelongsToField < BaseField attr_reader :polymorphic_as attr_reader :relation_method attr_reader :types # for Polymorphic associations attr_reader :allow_via_detaching - attr_reader :attach_scope + attr_reader :scope attr_reader :polymorphic_help def initialize(id, **args, &block) args[:placeholder] ||= I18n.t("avo.choose_an_option") @@ -73,11 +73,11 @@ @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 - @attach_scope = args[:attach_scope] + @scope = args[:scope] @polymorphic_help = args[:polymorphic_help] end def searchable @searchable && ::Avo::App.license.has_with_trial(:searchable_associations) @@ -115,11 +115,11 @@ resource = target_resource resource = App.get_resource_by_model_name model if model.present? query = Avo::Services::AuthorizationService.apply_policy(user, resource.class.query_scope) - if attach_scope.present? - query = Avo::Hosts::AssociationScopeHost.new(block: attach_scope, query: query, parent: get_model).handle + if scope.present? + query = Avo::Hosts::AssociationScopeHost.new(block: scope, query: query, parent: get_model).handle end query.all.map do |model| [model.send(resource.class.title), model.id] end