ROR grouped_options_for_select dynamic populate

I have this code

in view

grouped_options_for_select(@grouped_options, nil, @options_1)

in controller

@options_1 = [africa]

@grouped_options = [['North America',[['United States','US'],'Canada']], ['Europe',['Denmark','Germany','France']]]


how to make the countries populate dynamically from an array an not type them one by one?

Answers


for those who might be interested... this what i did

in view

options_for_select(@options, :disabled => ['North America', 'Europe']

in controller

@countries.each do |l|
    @options << [l.name, l.id]
  end

for this output

Africa North America      United States, US      Canada Europe      Denmark      Germany      France


Need Your Help

Character Encoding in Sending Email and PHP

php validation character-encoding character

I have a simple contact page that sends email with contact data with code below. But I can not read any of them because the characters are not readable. Based on my website content i guess these em...

Confused on SELECT 1 FROM

mysql sql select

If I do the following query:

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.