Forum: Ruby on Rails collection_select with :selected option

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.
B75f9bc2b05e37ab421f17d7845645c5?d=identicon&s=25 David Scheffel (david-x)
on 2007-03-29 14:28
Hi there.

I know that there are a lot of solutions that have been discussed for
this issue here already. However none of them did work for me. Either
the selected option did work, but not ":include_blank => true" or my
AJAX-code gots messed-up.

Is there a final solution for this?



Here my code:

  <%= collection_select("category_selection", "super_category_id",
                        @super_categories, :super_category_id, :name,
                        @selected_super_category_id,
                        {:onChange => remote_function(:update =>
"box_search",
                                                      :url => {:action
=> :search_by_category},
                                                      :submit =>
"category_selection_super_category") } ) -%>


Thanks
David
B75f9bc2b05e37ab421f17d7845645c5?d=identicon&s=25 David Scheffel (david-x)
on 2007-03-30 09:23
Hey. Is there nobody using this?
40db9e75b3f5899258e3bdc0c9210154?d=identicon&s=25 Conrad Taylor (Guest)
on 2007-03-30 11:52
(Received via mailing list)
Hi, could you explain what you're trying to do exactly so that people
can chime in?

-Conrad
B75f9bc2b05e37ab421f17d7845645c5?d=identicon&s=25 David Scheffel (david-x)
on 2007-03-30 13:08
Conrad Taylor wrote:
> Hi, could you explain what you're trying to do exactly so that people
> can chime in?

Hi. I'm trying to generate a HTML select-tag including the selected
option from a model object.

I've tried this with the collection_select, which does not include the
selected option. I've also tried options_from_collection_for_select,
which worked unless a blank option was included.

Thanks
David
0d4192d68421c5c7c22734a480838156?d=identicon&s=25 Pingu (Guest)
on 2007-05-08 19:46
(Received via mailing list)
Have a look here: http://shiningthrough.co.uk/blog/show/6

On Mar 30, 12:08 pm, David Scheffel <rails-mailing-l...@andreas-s.net>
This topic is locked and can not be replied to.