Skip to content

Instantly share code, notes, and snippets.

@juan-fdz-hawa
Created February 20, 2020 19:23
Show Gist options
  • Save juan-fdz-hawa/03dc8d35b56dc40cc16baf939a0a5b7e to your computer and use it in GitHub Desktop.
Save juan-fdz-hawa/03dc8d35b56dc40cc16baf939a0a5b7e to your computer and use it in GitHub Desktop.
<%= f.input :author,
:as => :grouped_select,
:collection => [['Authors', ['Jose', 'Carlos']], ['General', ['Bob', 'John']]],
:group_method => :last %>
<%= f.input :author,
:as => :grouped_select,
:collection => Proc.new { [['Authors', ['Jose', 'Carlos']], ['General', ['Bob', 'John']]] },
:group_method => :last %>
<%= f.input :author,
:as => :grouped_select,
:collection => { ['Jose', 'Carlos'] => 'Authors' },
:group_method => :first,
:group_label_method => :last %>
<%= f.input :author,
:as => :grouped_select,
:collection => { 'Authors' => ['Jose', 'Carlos'] },
:group_method => :last,
:label_method => :upcase,
:value_method => :downcase %>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment