app/controllers/effective/regions_controller.rb in effective_regions-1.10.3 vs app/controllers/effective/regions_controller.rb in effective_regions-1.11.0

- old
+ new

@@ -21,10 +21,11 @@ end def update refresh_page = false response = {} + success = false Effective::Region.transaction do (request.fullpath.slice!(0..4) rescue nil) if request.fullpath.to_s.starts_with?('/edit') # This is so the before_save_method can reference the real current page region_params.each do |key, vals| # article_section_2_title => {:content => '<p></p>'} @@ -62,14 +63,18 @@ Effective::Menu.update_from_effective_regions!(menu_params) end response[:refresh] = true if refresh_page + success = true + end + + if success render(json: response.to_json(), status: 200) - return + else + render(text: 'error', status: :unprocessable_entity) end - render(text: 'error', status: :unprocessable_entity) end def snippet # This is a GET. CKEDITOR passes us data, we need to render the non-editable content EffectiveResources.authorize!(self, :edit, Effective::Region.new)