mirror of
https://github.com/openSUSE/osem.git
synced 2026-08-16 21:24:05 +00:00
Fix failing migration for new price and currency columns of ticket
This commit is contained in:
parent
fa5b5242c1
commit
0911e1ed83
1 changed files with 11 additions and 9 deletions
|
|
@ -9,16 +9,18 @@ class SplitTicketPriceInPriceAndCurrency < ActiveRecord::Migration
|
|||
|
||||
TempTicket.all.each do |ticket|
|
||||
# Replace currency symbol with ISO Code
|
||||
ticket.ticket_price.gsub!('€', 'EUR')
|
||||
ticket.ticket_price.gsub!('$', 'USD')
|
||||
ticket.ticket_price.gsub!('£', 'GBP')
|
||||
ticket.ticket_price.gsub!('¥', 'CNY')
|
||||
ticket.ticket_price.gsub!('₹', 'INR')
|
||||
if ticket.ticket_price
|
||||
ticket.ticket_price.gsub!('€', 'EUR')
|
||||
ticket.ticket_price.gsub!('$', 'USD')
|
||||
ticket.ticket_price.gsub!('£', 'GBP')
|
||||
ticket.ticket_price.gsub!('¥', 'CNY')
|
||||
ticket.ticket_price.gsub!('₹', 'INR')
|
||||
|
||||
money = ticket.ticket_price.to_money
|
||||
ticket.price_cents = money.cents
|
||||
ticket.price_currency = money.currency_as_string
|
||||
ticket.save
|
||||
money = ticket.ticket_price.to_money
|
||||
ticket.price_cents = money.cents
|
||||
ticket.price_currency = money.currency_as_string
|
||||
ticket.save
|
||||
end
|
||||
end
|
||||
|
||||
remove_column :tickets, :ticket_price
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue