state select box to be populated according to country

Hi
    I have the models company,country, state
company belongs_to country
country has_many states
state belongs_to country

       In my company creation view i have two select boxes for country
and state. I could implement the country select like

<% form_for @company do |f| %>
<%= f.collection_select :country_id, Country.all, :id,:name,{},{} %>

Ryan Bates got a railscasts episode that deals with this exact case:
http://railscasts.com/episodes/88-dynamic-select-menus

Hi

Ryan Bates got a railscasts episode that deals with this exact case:
http://railscasts.com/episodes/88-dynamic-select-menus

    Thanks for your reply. I have tried this But is not working My rails
version is 2.3.5 I have added map.connect
':controller/:action/:id.:format'
   to routes.r as suggested. But in any way I cant access
http://localhost:3001/javascripts/dynamic_states.js
    I am getting

Routing Error

No route matches "/javascripts/dynamic_states.js" with {:method=>:get}

Tom

You need to but dynamic_states.js in your public/javascripts folder.

–Lasse

Lasse Bunk wrote:

You need to but dynamic_states.js in your public/javascripts folder.

--Lasse

   But how is it possible? In screencast it is dynamic_states.js.erb
that contains both ruby and javascript code. So how can i put that to
public/javascripts?

Tom

You might avoid a lot of work by using the Carmen plugin (or one like
it):
http://github.com/jim/carmen