Class: ValidMdmWebVulnParams
- Inherits:
-
ActiveRecord::Migration
- Object
- ActiveRecord::Migration
- ValidMdmWebVulnParams
- Defined in:
- db/migrate/20130515172727_valid_mdm_web_vuln_params.rb
Instance Method Summary collapse
- #down ⇒ void
-
#up ⇒ void
Changes any Mdm::WebVuln#params with value
''to value[].
Instance Method Details
#down ⇒ void
6 7 |
# File 'db/migrate/20130515172727_valid_mdm_web_vuln_params.rb', line 6 def down end |
#up ⇒ void
This method returns an undefined value.
Changes any Mdm::WebVuln#params with value '' to value [].
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'db/migrate/20130515172727_valid_mdm_web_vuln_params.rb', line 12 def up # Can't search serialized columns, so have to load all the Mdm::WebVulns in memory Mdm::WebVuln.find_each do |web_vuln| if web_vuln.invalid? # cast nil, '' and {} to correct []. if web_vuln.params.blank? web_vuln.params = [] end # If its still invalid have to destroy the Mdm::WebVuln or a different export error could occur. if web_vuln.invalid? web_vuln.destroy else web_vuln.save! end end end end |