Skip to content

Instantly share code, notes, and snippets.

@verkligheten
Last active May 27, 2016 12:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save verkligheten/ab0845b36fb618d34462e0b5996c5e4a to your computer and use it in GitHub Desktop.
Save verkligheten/ab0845b36fb618d34462e0b5996c5e4a to your computer and use it in GitHub Desktop.
User.all.each do |user|
user.attachments.each do |attachment|
unless ["contract", "terms_and_conditions", "consumer_credit_form", "consent_personal_data_processing", "registration_contract", "terms_and_conditions_provision", "loan_application", "terms_and_conditions_no_sign", "factura"].any? { |word| attachment.filename.include?(word) }
attachment.user_id = attachment.attachable_id
attachment.save
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment