Class: Pulitzer::ContentElementsController::Update
- Inherits:
-
Object
- Object
- Pulitzer::ContentElementsController::Update
- Defined in:
- app/interactions/pulitzer/content_elements_controller/update.rb
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(content_element, params) ⇒ Update
constructor
A new instance of Update.
- #prune_params ⇒ Object
Constructor Details
#initialize(content_element, params) ⇒ Update
Returns a new instance of Update.
3 4 5 |
# File 'app/interactions/pulitzer/content_elements_controller/update.rb', line 3 def initialize(content_element, params) @content_element, @params = content_element, params.to_h.to_hash.symbolize_keys end |
Instance Method Details
#call ⇒ Object
7 8 9 10 |
# File 'app/interactions/pulitzer/content_elements_controller/update.rb', line 7 def call prune_params @content_element.update @params end |
#prune_params ⇒ Object
12 13 14 15 16 17 18 19 20 |
# File 'app/interactions/pulitzer/content_elements_controller/update.rb', line 12 def prune_params clickable_kind = @params.delete :clickable_kind custom_option_list = GlobalID::Locator.locate(clickable_kind) if custom_option_list.present? @params[:body] = nil else @params[:custom_option_id] = nil end end |