I''m rendering my form in a partial, as below: ... <%= f.collection_select :color_id, @colors, :id, :name, {:include_blank => false, :prompt => ''What color?''} %> ... Now, I''m rendering this partial in both the new and edit methods of my controller. Everything works great, except for one caveat. If the user deletes the color that was assigned prior, this results in the parent object being assigned a color ID that doesn''t exist. It doesn''t throw up any errors, but when you go into the edit method of the parent controller to change the color, another color is automatically selected. It seems that the options for :prompt are ignored when the value is passed when in the edit method for example, even if that value no longer exists. What I''d like for it to do is to show the prompt - even in the edit method - if the value doesn''t exist. Any way to do this? Thanks in advance for any help at all. -- Posted via http://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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Fixed it. Turns out I was using collection_select wrong. This works perfectly: <%= f.collection_select :items, :color_id, @colors, :id, :name, {:include_blank => false, :prompt => ''What color?''} %> -- Posted via http://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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Actually - nevermind. I thought it fixed the issue but turns out it''s still not working right. I was still using the collection_select wrong, I believe - so at least that was fixed. -- Posted via http://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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Looks like this is already known: http://dev.rubyonrails.org/ticket/10768 -- Posted via http://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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.