Dreams
Dreams

Reputation: 8506

How do I create radio buttons based on other table of database value?

I am using Rails 4.2 with Ruby 2.1.5

I have a table name "API" and has "status" column.

How do I create form_for radio buttons base on status data in view template?

Upvotes: 0

Views: 188

Answers (1)

Simone Carletti
Simone Carletti

Reputation: 176472

Here's a simple example

<% form_for(...) do |f| %>
  <%= f.radio_button :status, 'alpha' %> 
  <%= f.radio_button :status, 'beta' %>
<% end %>

For more details you should check the radio_button helper documentation.

Upvotes: 3

Related Questions