app/services/clean.rb
def clean(metadata, &block)
        metadata = scope.restricted_metadata(metadata)

        block.call metadata

        if metadata.periodes.empty?
          metadata.destroy
        else
          metadata.save!
        end
      end
# Modify the given metadata (after scope restriction)
# Save it or destroy it if empty
Modify the given metadata (after scope restriction)
Save it or destroy it if empty
Modify the given metadata ( after scope restriction ) Save it or destroy it if empty
def clean(metadata, &block)
        metadata = scope.restricted_metadata(metadata)
        block.call metadata
        if metadata.periodes.empty?
          metadata.destroy
        else
          metadata.save!
        end
      end
def clean ( metadata , & block ) metadata = scope . restricted_metadata ( metadata ) block . call metadata if metadata . periodes . empty? metadata . destroy else metadata . save! end end
Modify the given metadata (after scope restriction)
Save it or destroy it if empty
Modify the given metadata ( after scope restriction ) Save it or destroy it if empty
metadata
block