> Now I've got all the JavaScript and the Rails code to allow the user
> to enter a new option, the problem is how do I add the last
> alternative ("Add new...") to my select box?

In your controller:

@options = Option.find(:all).collect {|p| [ p.name, p.id ] }
@options << ["Add New", nil]

Then in your view:

<%= select("user", "choice_id", @options, { :include_blank => true }) -%>


This should work, because select just iterates over an array taking
the .first and .last values from it.

Mikel


-- 
http://lindsaar.net/
Rails, RSpec and Life blog....

--~--~---------~--~----~------------~-------~--~----~
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 [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to