Combobox-distinct element

plz help me in retrieving distinct element from db and populate in
combobox?

I hav created a model “location”.It has elements
(state,district,province,…)
I want to populate one combobox with distinct state and the other combo
box should display corresponding districts in that state which is
selected.

Can you give me the code for view, and controller

You can use .uniq! on any array (which includes
ActiveRecord.find(:all…)
return values).

In terms of setting the other combo boxes you’ll either need to ajax
back to
the controller or pass all data in the first time and have javascript do
some filtering for you (which you choose depends on how much data you
have).

My computer at home has something like this already coded. I’ll try to
remember to put it up on github tonight or tomorrow.

Ben Wiseley wrote:

You can use .uniq! on any array (which includes
ActiveRecord.find(:all…)
return values).

In terms of setting the other combo boxes you’ll either need to ajax
back to
the controller or pass all data in the first time and have javascript do
some filtering for you (which you choose depends on how much data you
have).

My computer at home has something like this already coded. I’ll try to
remember to put it up on github tonight or tomorrow.

Thanks Ben…
Plz forward me that code if possible.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs