lib/scrivito/basic_obj.rb in scrivito_sdk-0.60.0.rc1 vs lib/scrivito/basic_obj.rb in scrivito_sdk-0.60.0.rc2
- old
+ new
@@ -10,12 +10,10 @@
# as it is intended as an abstract class.
# Always use {Obj} or a subclass of {Obj}.
# @api public
#
class BasicObj
- # @!parse extend Scrivito::AttributeContent::ClassMethods
-
PublicSystemAttributeDefinition = Class.new(AttributeDefinition)
SYSTEM_ATTRIBUTES = AttributeDefinitionCollection.new(
'_id' => PublicSystemAttributeDefinition.new(:_id, :string),
'_last_changed' => PublicSystemAttributeDefinition.new(:_last_changed, :date),
@@ -41,10 +39,11 @@
_obj_type
_text_links
].freeze
extend ActiveModel::Naming
+ extend AttributeContent::ClassMethods
include AttributeContent
include ModelIdentity
def self.type_computer
@@ -285,9 +284,21 @@
#
# @param [String] parent_path Path of the parent obj
# @return [NilClass, Array<Symbol, String>]
# @api public
def self.valid_page_classes_beneath(parent_path)
+ end
+
+ def self.valid_page_ruby_classes_beneath(parent_path)
+ computed_classes = valid_page_classes_beneath(parent_path)
+
+ return Scrivito.models.pages.to_a unless computed_classes
+
+ convert_to_obj_classes(computed_classes, Obj.type_computer) do |class_name|
+ Rails.logger.warn(
+ "Invalid page class #{class_name} returned by #valid_page_classes_beneath."
+ )
+ end
end
# Update the {Scrivito::BasicObj Obj} with the attributes provided.
#
# For an overview of which values you can set via this method see the