reading that default attribute on inheriting editable_elements and calling the method on that page (instead of getting it from the parent)

This commit is contained in:
Dirk Kelly 2011-03-02 14:38:57 +08:00
parent ea81025d33
commit 97e3ddb6e3

View File

@ -68,8 +68,12 @@ module Models
if existing_el.nil? # new one from parents
new_attributes = el.attributes.merge(:from_parent => true)
new_attributes[:default_content] = el.content
if new_attributes['default_attribute'].present?
new_attributes['default_content'] = self.send(new_attributes['default_attribute']) || el.content
else
new_attributes['default_content'] = el.content
end
self.editable_elements.build(new_attributes, el.class)
else
existing_el.attributes = { :disabled => false, :default_content => el.content }