All pastes #909742 Raw Edit

Something

public text v1 · immutable
·published 2008-02-19 13:46 UTC
rendered paste body
I have a form
Inside that form, I need a country/state/city selector (3 <select>)
when you select the country, state will be updated using ajax (observe_field...)
when you select the state, the cities will be updated so the user can select the city.

I need this "control/widget" in many places in my app and different controllers.
DRY, so I should have it all in one place.

So I thought about having an "ajax" controller with this kind of "widgets" 
(I also need one for Country/State selection)

Now, those states and cities are in database, so they should be taken from model
in the controller, not break MVC pattern.

Ok, so I have to call a controller/action, say, ajax/country_state_select to render inside
of my form...

Now, how to render this ?
partials ? They depend on the current controller/action to call the model
file ? Will only render the rhtml without calling the ajax/country_state_select controller/action


I still could break the MVC pattern and call the model from the view somehow but observe_field
will not let me specify the controller I want to call, only the action... or Am I wrong ?