``enter code here<%= form_for(@person) do |f| %>
<% if @person.errors.any? %>
<div id="error_explanation">
<h2><%= pluralize(@person.errors.count, "error") %> prohibited this person from being saved:</h2>
<ul>
<% @person.errors.full_messages.each do |msg| %>
<li><%= msg %></li>
<% end %>
</ul>
</div>
<% end %>
<div class="field">
<%= f.label :name %><br />
<%= f.text_field :name %>
</div>
<div class="field">
<%= f.label :country_id %><br />
<%= f.collection_select :country_id, Country.all(:order => "name"), :id, :name, :prompt => "-- Select a Country --"%>
<%= observe_field (:person_country_id, :url => {:action => "update_state_div"}, :with => 'person_country_id'%>
</div>
<div class="field">
<%= f.label :state_id %><br />
<%= f.collection_select :state_id, State.all(:order => "name"), :id, :name, :prompt => "-- Select a State --"%>
<%observe_field 'person_country_id', :url => {:action => "update_state_div"}, :with => 'person_country_id'%>
</div>
<div class="actions">
<%= f.submit %>
</div>
<% end %>
取悅似乎那裏不會停錯了的observe_field,我期待它做的是,當我把在國內的值,該國下的狀態顯示出來的observe_field錯誤
啊。 'observe_field'不再包含在Rails中 - 請參閱我的編輯信息。 – ThatOtherPerson