Deepak Dargade.

I'm a Mumbai-based Entrepreneur, Ruby on Rails monomaniac and Food enthusiast.
Best known for turning ideas into reality and Co-founder of Classpro.

in Rails we can add custom attributes to select options, using the existing options_for_select helper.

If you need grouped options, you can use the grouped_options_for_select helper, like this (if @continents is an array of continent objects, each having a countries method):

<%= :country_id, grouped_options_for_select({ |group| [,{ |c| [,, {'data-currency_pre'=>c.currency_pre}] } ] }, selected_key = f.object.country_id) %>