Anonymous
public text v1 · immutable
Controller:
def show_states_select
render :layout => false
if params[:country_id] != "" then
@state_options = State.find(:all, :conditions => "country_id = " + params[:country_id]).collect do |s| [s.name, s.id] end
else
@state_options = State.find(:all).collect do |s| [s.name, s.id] end
end
end
View:
<%= select '', 'state_id', @state_options, {:include_blank => true} %>