ruby on rails - How do I create a dropdown list specifically for Indian states and cities? -


my app planned go india , need add location information user profiles. there way create dropdowns myself states , cities or gems india.

i mean if feed states , cities myself want showing user , allow him choose his, how do that?

i can't work text fields because want make whole thing searchable locations , if users enter different locations quality of search drastically decrease.

links tutorials welcome :)

you use form select helper. if have possible states in activerecord, can in form:

<%= f.select :state_id, state.all.collect {|s| [s.name, s.id]} %> 

if don't want them in activerecord, define array of in model, , feed form.

also, take @ enumerize, gem, it's useful if have finite set of options field.

and thing, there countries , cities gems householding city/country data.


Comments

Popular posts from this blog

node.js - How to mock a third-party api calls in the backend -

node.js - Why do I get "SOCKS connection failed. Connection not allowed by ruleset" for some .onion sites? -

matlab - 0-by-1 sym - What do I need to change in order to get proper symbolic results? -