I’m playing with rails and RJS,
What I want I think sounds simple - but I can’t seem to figure it out.
So basically I have a Countries Model, which joins on Cities Model.
I want to display a list of countries in a select, when you select a
country it shows all the cities in that country.
That works just fine - the issue I have is to add the data in tables.
I have right now a index page
Listing countries
Please select country | <%= select_tag(:id , options_from_collection_for_select(@countries, :id, :country)) %> |
So when the user chooses a country it gets all the cities of that
country, now all I want to do is add a new row to the existing table,
with a new select containing the cities. My show.rjs does
page.replace_html :show_cities, :partial => ‘show’, :object => @country
And then the partial is
And it displays the data, but not in the exiting table…I know this
probably isn’t strictly rails as its javascript/html but maybe someone
can help… All I want is to be able to add new rows when the data is
available?