Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save deepakdargade/1266776 to your computer and use it in GitHub Desktop.
Save deepakdargade/1266776 to your computer and use it in GitHub Desktop.
rails 3 custom attributes to select options 3
<%= f.select :country_id, grouped_options_for_select(@continents.map{ |group| [group.name, group.countries.map{ |c| [c.name, c.id, {'data-currency_code'=>c.currency_code}] } ] }, selected_key = f.object.country_id) %>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment