lib/avo/base_resource.rb in avo-3.2.3 vs lib/avo/base_resource.rb in avo-3.3.0

- old
+ new

@@ -306,11 +306,16 @@ # def get_actions / def get_filters / def get_scopes define_method "get_#{plural_entity}" do return entity_loader(entity).bag if entity_loader(entity).present? - instance_variable_set("@#{plural_entity}_loader", Avo::Loaders::Loader.new) + # ex: @actions_loader = Avo::Loaders::ActionsLoader.new + instance_variable_set( + "@#{plural_entity}_loader", + "Avo::Loaders::#{plural_entity.humanize}Loader".constantize.new + ) + send plural_entity entity_loader(entity).bag end @@ -558,11 +563,9 @@ view: view, resource: self, record: record } end - - private def entity_loader(entity) instance_variable_get("@#{entity.to_s.pluralize}_loader") end end