Forum: Ruby on Rails best way to add new items to a select?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Patrick A. (Guest)
on 2007-05-11 21:16
(Received via mailing list)
hey all,
I have a select tag like this:

<%= select 'movie','director_id',Director.find(:all).collect {|x|
[x.name, x.id]}  %>

I would like to add a new director in case it's missing from the
select. I would like to do this the Ajax way maybe with a
in_place_select? or by putting an rjs link that replace the select
with a textfield and a button but I'm not sure maybe there's a better
way.
I also like how they do it in google mail, where the last option of
the select is a "create a new label", then if I click on that option
in the select it popups a dialog and then updates the select.

Any ideas or links to demo?

thanx in advance

Pat
This topic is locked and can not be replied to.