initialize it in the controller and the re-assign it in your remote
action in the controller, form the params
def create
# do your stuff
@selected_city = params[:city]
@selected_city ||= City.first
render :action => show
end
then you can use @selected_city when you come back to the view
<%= select ( ..., :selected => @selected_city %>
hope it helps
j
On Jul 7, 2:36 pm, Mike Sava
<rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>
wrote:> In my model I have a city_id. ON the form I am using a cascading select
> to select the state, which then does a remote_submit to get the list of
> cities (and hence the city_id) for the selected state. The problem that
> I am having is that if I make a selection, hit SUBMIT and validation
> fails, the original selected state/city is now reset (ie, the values
> aren''t saved). Since they aren''t part of the model do I
assign them to
> the flash or session? How do you set the initial values from these
> hashes?
>
> Thanks
> --
> Posted viahttp://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---