forked from fixin.me/fixin.me
* replace variable names with Hash to avoid invalid Ruby identifiers * export all values as single-quoted to avoid string interpolation and treating BigDecimal numbers as Float * #truncate table instead of #delete_all to avoid foreing_key constraints errors Closes #56
10 lines
426 B
Plaintext
10 lines
426 B
Plaintext
Unit.transaction do
|
|
ActiveRecord::Base.connection.truncate(Unit.table_name)
|
|
<% Unit.defaults.ordered.each do |unit| %>
|
|
<%= "\n" if unit.base.nil? %>
|
|
units['<%= unit.symbol %>'] =
|
|
Unit.create symbol: '<%= unit.symbol %>',<% unless unit.base.nil? %> base: units['<%= unit.base.symbol %>'], multiplier: '<%= unit.multiplier.to_scientific %>',<% end %>
|
|
description: '<%= unit.description %>'
|
|
<% end %>
|
|
end
|