Method: Scrivito::ObjClass#update

Defined in:
lib/scrivito/obj_class.rb

#update(properties) ⇒ nil

Deprecated.

Updates this obj class and persists the changes in the CMS. It is not possible to update the name.

See create for a detailed overview of what properties are allowed and how to set them.

The is_binary option can only be removed. By passing nil for the is_binary option to update, you can convert legacy objects. This conversion removes the fields title, body (if is_binary was false) or blob (if is_binary was true). If you add the fields in the same request the values will be kept for all objs.

Examples:

Removing is_binary but keeping the previously predefined fields

ObjClass.find('Homepage').update(is_binary: nil, attributes: [
  {name: 'title', type: 'string'},
  {name: 'body',  type: 'html'}
])

# Binary ObjClass
ObjClass.find('Image').update(is_binary: nil, attributes: [
  {name: 'title', type: 'string'},
  {name: 'blob',  type: 'binary'}
])

Parameters:

  • properties (Hash)

Returns:

  • (nil)

Raises:

  • (ScrivitoError)

    Raised when trying to change name or is_binary.



236
237
238
# File 'lib/scrivito/obj_class.rb', line 236

def update(properties)
  Scrivito.raise_obj_class_deprecated_error
end