Created
March 31, 2015 14:34
-
-
Save umar-webonise/0493ae93cd8d118bb0a8 to your computer and use it in GitHub Desktop.
Seed Data for adding units for dynamice forms
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
unit_types = [ | |
{ name: 'length' }, | |
{ name: 'area' }, | |
{ name: 'weight' }, | |
{ name: 'volume' } | |
].each do |tag_info| | |
puts "Added #{UnitType.create(tag_info).inspect}" | |
end | |
UnitType.where(name: 'length').first.units.create( | |
[ | |
{ name: 'inch'}, | |
{ name: 'foot'}, | |
{ name: 'meters'}, | |
{ name: 'yard'}, | |
{ name: 'mile'} | |
] | |
) | |
UnitType.where(name: 'area').first.units.create( | |
[ | |
{ name: 'square metres'}, | |
{ name: 'square centimetres'}, | |
{ name: 'square millimetres'}, | |
{ name: 'square miles'}, | |
{ name: 'square yards'} | |
] | |
) | |
UnitType.where(name: 'volume').first.units.create( | |
[ | |
{ name: 'cubic metres'}, | |
{ name: 'cubic centimetres'}, | |
{ name: 'cubic millimetres'}, | |
{ name: 'cubic miles'}, | |
{ name: 'cubic yards'} | |
] | |
) | |
UnitType.where(name: 'weight').first.units.create( | |
[ | |
{ name: 'kg'}, | |
{ name: 'mg'} | |
] | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment