Home Rails select values
Reply: 0

Rails select values

user757 Published in May 20, 2018, 9:56 am

I have a select option in a form:

<%= f.select :role, options_for_select(User.roles.keys.to_a, params[:role]), {}, class: 'form-control form-control-lg roleSelect' %>

These roles are defined in my model:

enum role: {user: 0, profile_user: 1}

Now in my dropdown when the user choses it shows user and profile_user as drop down option.

Is there any way to show another value to represent these in a drop down?

For example:

In the drop down I would rather show "I am a teacher" which maps to user.

In the drop down I would rather show "I am here to study" which maps to profile_user.

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.303456 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO