Class: BulkImports::Common::Transformers::ProhibitedAttributesTransformer
- Inherits:
-
Object
- Object
- BulkImports::Common::Transformers::ProhibitedAttributesTransformer
- Defined in:
- lib/bulk_imports/common/transformers/prohibited_attributes_transformer.rb
Constant Summary collapse
- PROHIBITED_REFERENCES =
Regexp.union( /\Acached_markdown_version\Z/, /\Aid\Z/, /_id\Z/, /_ids\Z/, /_html\Z/, /attributes/, /\Aremote_\w+_(url|urls|request_header)\Z/ # carrierwave automatically creates these attribute methods for uploads ).freeze
Instance Method Summary collapse
Instance Method Details
#transform(context, data) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/bulk_imports/common/transformers/prohibited_attributes_transformer.rb', line 17 def transform(context, data) return unless data data.each_with_object({}) do |(key, value), result| prohibited = prohibited_key?(key) unless prohibited result[key] = value.is_a?(Hash) ? transform(context, value) : value end end end |