M I R wrote: > Hi, > I am new for RoR i am using > f.select for dropdown and want to populate it from database table > i have a function in cities model which retrieve all cities and i am > doing the follwoing to populate the dropdown > f.select :city_id , @cities > but it display a strange output with some # etc > how i will do it and i dont want to use collection_select so thats > mean how to write the function > def self.find_all_cities > find(:all) > end > > thats how my function is how can i modify so that it gives me s refine > array so that it did my business > > Regards,
You can use this way <%= collection_select(:city, :id, City.find_all_cities, :id, :city) %> i have a working craigslist clone here: http://github.com/railslist/craigslist-clone download, install and play to learn more. -- 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-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.