The explanation from api.rubyonrails.org is rather baffling for a newbie like me,
collection_select(object, method, collection, value_method, text_method, options = {}, html_options = {}) |
Still managed to get the dropdown menu working for my application after searching through the web. There are already quite a few useful resources available in the net for helper method collection_select.
But I seem to lost in the code again looking back at it after a while. And am too lazy to look through all the stuff again. So I try to make a diagram to put down what I already understand from those resources. Might not be the best or complete explanation, but just try to help myself to be able to view it and quickly get a grasp of it.
Chris
Have to say this is not the most comprehensive collection_select post out there BUT it is straight to the point and illustrates the theory perfectly. Good job
admin
Thansk Chris…glad if it did help someone to understand it better.
Ben R
You just saved my life. The ‘method” thing was killing me. Read this and it works.
Thank you. Ben
eeeeee
you shrunk the image, now it’s unreadable unless you view it by URL: http://www.kahfei.com/wp-content/uploads/2009/06/collection_select_explain_3.png
kahfei
eeeeee, sorry for the problem, I am changing my blog layout, and seeing some images are exceeding the blog width, so I shrunk them. I will try to fix it over the weekend.
Alex
Great post about collection_select. You just saved some hours of my life. Thanks a lot 🙂
P.S. The image is little, though it’s readable enough
kahfei
Hi Alex,
Glad that it is useful to you.
I plan to redrawn the image so it is more visible, as soon as I find the time to do it.
zora
U just need to ‘Strg’ + ‘+’ to Zoom the pic 😉
eh
the image is fine, it just needs to be displayed normally. and not to complain, but hardset 400px content columns are user-hostile and lame.
kahfei
eh, yes, definitely, am working on a new layout, ha, but the progress is really slow at the moment. 😉
kahfei | why attr_accessor
[…] I have written about it, then I have a better understanding and longer memory. Like the collection_select method which I drawn a illustration and post about it sometimes ago, it stuck in my memory till […]
andrew122
I am using the multi select, but i have a edit form and when i try get the values that were stored in the db it doesn’t render as selected, any advice?