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


I have a problem because I'm new to Ruby on Rails I submit some value to form_for I am passing a value through a hidden field as a role for a user to login. The user depends on his role. If the role is a customer then the user is redirected to the customer page, and if the role is administrator then the user is redirected to the admin page. I am playing a role through the hidden fields below: Now I want to remove the hidden area and I want to play the role through the radio button. Please help me how I can pass through the radio button as a form for the role. I would be very grateful for any help.

If I understand you correctly, then you need something:

  & lt;% = f.radio_button: role, 'user', checked: true%> & lt;% = label: role_user, 'user'% & gt; & Lt;% = f.radio_button: roll, 'client'% & gt; & lt;% = label: role_client, 'client'% & gt; & Lt;% = f.radio_button: role, 'admin'% & gt; & lt;% = label: role_admin, 'Admin'% & gt;    

Comments

Popular posts from this blog

php - PDO bindParam() fatal error -

logging - How can I log both the Request.InputStream and Response.OutputStream traffic in my ASP.NET MVC3 Application for specific Actions? -

java - Why my included JSP file won't get processed correctly? -