Saturday, 15 August 2015

ruby - pass value in database through radio button in form for rails -



ruby - pass value in database through radio button in form for rails -

i have problem new ruby on rails. using form_for submit values. passing value through hidden field role login user. user depend on role. if role client user redirected clients page, , if role admin user redirect admin page. assigning roles through hidden field below: want remove hidden field , want assign role through radio buttons. kindly help me how can pass role through radio button in form for. thankful help.

if understand correctly, need this:

<%= f.radio_button :role, 'user', checked: true %> <%= label :role_user, 'user' %> <%= f.radio_button :role, 'client' %> <%= label :role_client, 'client' %> <%= f.radio_button :role, 'admin' %> <%= label :role_admin, 'admin' %>

ruby-on-rails ruby ruby-on-rails-4

No comments:

Post a Comment