Module: ActiveRecordUpdateAttributesBipExtension
- Extended by:
- ActiveSupport::Concern
- Defined in:
- app/models/active_record_update_attributes_bip_extension.rb
Overview
This module overrides the regular ‘update_attributes` method in order to fix some issues with best_in_place. For unknown reasons, best_in_place keeps sending post requests with empty strings — without pattern we could recognize, so far. Therefore, this hack is a quick fix to avoid accidental data loss until we have fixed the real issue, which is on the view/js side, really.
Defined Under Namespace
Modules: ClassMethods
Instance Method Summary collapse
-
#update_attributes(attributes, options = {}) ⇒ Object
Definition of the original method: apidock.com/rails/v3.2.13/ActiveRecord/Persistence/update_attributes.
Instance Method Details
#update_attributes(attributes, options = {}) ⇒ Object
Definition of the original method: apidock.com/rails/v3.2.13/ActiveRecord/Persistence/update_attributes
13 14 15 16 17 |
# File 'app/models/active_record_update_attributes_bip_extension.rb', line 13 def update_attributes(attributes, = {}) # We allow `nil`, but we do not allow "" (empty string). non_empty_attributes = attributes.select { |key, value| value != "" } super(non_empty_attributes, ) end |