Class: VerySimpleCms::ContentsController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- VerySimpleCms::ContentsController
- Defined in:
- app/controllers/very_simple_cms/contents_controller.rb
Instance Method Summary collapse
Methods included from SharedHelper
Instance Method Details
#update ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'app/controllers/very_simple_cms/contents_controller.rb', line 5 def update data = params['content'] data.each do |key, value| static_text = HtmlBlock.find_by_attribute(dynamic_save_source, :title, key) if static_text.present? static_text.update_attributes(body: value['value']) else static_text = HtmlBlock.new( dynamic_source: dynamic_save_source, title: key, body: value['value'] ) static_text.save end end render text: "" end |