Guest User

Untitled

a guest
Apr 10th, 2018
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.21 KB | None | 0 0
  1. class LegacyBase < ActiveRecord::Base
  2. establish_connection(
  3. :adapter => "mysql",
  4. :host => "localhost",
  5. :username => "",
  6. :password => "",
  7. :database => "ws_prosecutions"
  8. )
  9. end
  10.  
  11. class LegacyProsecutions < LegacyBase
  12. set_table_name "prosecutions"
  13.  
  14. def migrate_me!
  15. prosecution = Prosecution.create(
  16. :defendant => self.Defendant,
  17. :section => (self.Section || '') + " -- " + (self.zSearch_sec_reg_1 || '') + " - " + (self.zSearch_sec_reg_2 || '') + " - " + (self.zSearch_sec_reg_3 || ''),
  18. :description => self.Description,
  19. :background => self.Background,
  20. :conviction_date => (self.Conviction\ Date || '').to_date,
  21. :court => self.Court,
  22. :fine => self.Fine,
  23. :outcome_summary => self.Outcome\ Summary,
  24. :charge_number => self.Charge_Number || '',
  25. :date_added => (self.Date\ Added || '').to_date,
  26. :regulation => self.Regulation || '',
  27. :offence_date => self.Offence_Date,
  28. :trading_name => self.Trading_Name || '',
  29. :inspector => self.Inspector,
  30. :costs => self.Costs || '',
  31. :file_number => self.File_Number,
  32. :publish => self.Publish.downcase == "yes" ? true : false,
  33. :image => self.Image || ''
  34. )
  35. end
  36. end
Add Comment
Please, Sign In to add comment