From 62568bbdbb8ab975f9cab835f942a3f6472af2ea Mon Sep 17 00:00:00 2001 From: Dirk Kelly Date: Fri, 14 Jan 2011 15:27:58 +0800 Subject: [PATCH] Fixed exception when updating a layout from back-office which contained an editable area --- lib/locomotive/liquid/tags/editable/base.rb | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/lib/locomotive/liquid/tags/editable/base.rb b/lib/locomotive/liquid/tags/editable/base.rb index 4e9c7f3a..b2621185 100644 --- a/lib/locomotive/liquid/tags/editable/base.rb +++ b/lib/locomotive/liquid/tags/editable/base.rb @@ -19,14 +19,18 @@ module Locomotive end def end_tag - @context[:page].add_or_update_editable_element({ - :block => @context[:current_block].try(:name), - :slug => @slug, - :hint => @options[:hint], - :default_content => @nodelist.first.to_s, - :disabled => false, - :from_parent => false - }, document_type) + super + + if @context[:page].present? + @context[:page].add_or_update_editable_element({ + :block => @context[:current_block].try(:name), + :slug => @slug, + :hint => @options[:hint], + :default_content => @nodelist.first.to_s, + :disabled => false, + :from_parent => false + }, document_type) + end end def render(context)