I want to create a form like that :
The easiest location to put your JSON file is in the same directory as your controllers -- although doing this kind of thing repeatedly will quickly make a mess out of your controllers folder.
Once you've done that you can read it from your controller like this:
var file = File.read('./countries.json') var countries = JSON.parse(file)
and then map countries to the data type that
Once you have that working, I'd recommend making a helper that knows how to read the json file, cache it's data, and return it. Store the json file in the same directory as the helper. Reference the helper in your controller.
Also note: the JSON gem is required for this.