lib/avo/base_resource.rb in avo-3.0.1.beta2 vs lib/avo/base_resource.rb in avo-3.0.1.beta3
- old
+ new
@@ -63,10 +63,11 @@
class_attribute :record_selector, default: true
class_attribute :keep_filters_panel_open, default: false
class_attribute :extra_params
class_attribute :link_to_child_resource, default: false
class_attribute :map_view
+ class_attribute :components, default: {}
# EXTRACT:
class_attribute :ordering
class << self
@@ -291,10 +292,14 @@
entity_loader(entity).bag
end
# def get_action_arguments / def get_filter_arguments / def get_scope_arguments
define_method "get_#{entity}_arguments" do |entity_class|
- send("get_#{plural_entity}").find { |entity| entity[:class].to_s == entity_class.to_s }[:arguments]
+ klass = send("get_#{plural_entity}").find { |entity| entity[:class].to_s == entity_class.to_s }
+
+ raise "Couldn't find '#{entity_class}' in the 'def #{plural_entity}' method on your '#{self.class}' resource." if klass.nil?
+
+ klass[:arguments]
end
end
def hydrate(record: nil, view: nil, user: nil, params: nil)
@view = view if view.present?