All pastes #906526 Raw Edit

Anonymous

public text v1 · immutable
·published 2008-02-16 19:40 UTC
rendered paste body

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} %>