Dynamic drop down - pls help

002_create_states.rb

class CreateCities < ActiveRecord::Migration
def self.up
create_table :cities do |t|
t.column :state_id, :integer
t.column :city_name, :string
end
end

def self.down
drop_table :cities
end
end

001_create_cities.rb

class CreateCities < ActiveRecord::Migration
def self.up
create_table :cities do |t|
t.column :state_id, :integer
t.column :city_name, :string
end
end

def self.down
drop_table :cities
end
end

index.rhtml

<%= javascript_include_tag “prototype” %>

state

Select state <% @states.each do |state| %> <%= state.state_name %> <% end %>
city
cities

<%= observe_field(:state_id,
:update => “city_id_container”,
:url => { :action => :index},
:with => “‘state_id=’+value”) %>

admin_controller.rb

class AdminController < ApplicationController
def index
@cities = City.find_all_by_state_id(@params[":state_id"])
@html = “”
@html += “No city”
@cities.each do |@city|
@html += “#{@city.city_name}”
end
@html += “”
@states = State.find(:all)
end
end

state.rb

class State < ActiveRecord::Base
has_many :cities
end

city.rb

class City < ActiveRecord::Base
belongs_to :states
end

can u jst tell me how can i get the values into the 2nd drop down
list…plss

is it a copy paste error or are

001_create_cities.rb

and

002_create_states.rb

equal ?

marcel