Country Code for Rails with Migration
Feb 6, 2013AD:
		
		
	
	I want to setup contry code for my Rails app so I searched by google there are some Gem but I just want to make Tables & Model.
I used data from here
Make migratiton file
| 1 2 3 4 5 6 | $ rails g model country name:string alpha_2:string alpha_3:string invoke  active_record create    db/migrate/20130206044924_create_countries.rb create    app/models/country.rb invoke    rspec create      spec/models/country_spec.rb | 
Add SQL from here
| 1 2 3 4 5 6 7 8 9 | $ vi db/migrate/20130206044924_create_countries.rb #add data from http://stefangabos.ro/other-projects/list-of-world-countries-with-national-flags/ execute " INSERT INTO `countries` (`name`, `alpha_2`, `alpha_3`) VALUES ('Afghanistan', 'af', 'afg'), ('Aland Islands', 'ax', 'ala'), ('Albania', 'al', 'alb'), more... ('Zimbabwe', 'zw', 'zwe')" | 
and then
| 1 | $ rake db:migrate | 
Done.
		AD:
			
			
		
		
	

 Ayumi Mizoshiri
Ayumi Mizoshiri







No Comments, Comment or Ping
Reply to “Country Code for Rails with Migration”
Warning: Undefined variable $user_ID in /home/sazaeau/mizoshiri.com/public_html/blog.mizoshiri.com/wp-content/themes/grid_focus_public_mizo/comments.php on line 66
You must be logged in to post a comment.