Method: Scrivito::BasicWidget#update

Defined in:
app/cms/scrivito/basic_widget.rb

#update(attributes) ⇒ Object

Updates the attributes of this Widget. See Obj.create for a detailed overview of how to set attributes.

Examples:

Set the title of a specific widget contained in the ‘main_content’ attribute of an Obj:

obj.main_content[4].update(title: "New Title")

Add a widget to the ‘main_content’ widgetlist attribute:

widgets = obj.main_content << MyWidget.new(title: "Fresh")
obj.update(main_content: widgets)

Parameters:

  • attributes (Hash)


170
171
172
173
# File 'app/cms/scrivito/basic_widget.rb', line 170

def update(attributes)
  obj.update(_widget_pool: { self => attributes })
  reload
end