form.radio button in rails -


how select , create radio button in rails 3 when using
database records

id name selected
1 abc false
2 efg true
3 hij false
4 klm false

the above display on form 4 radio buttons using form_for , need use f.radio_button each group...

how achieve 1 selected

thanks

      fetch records database in @records in view file        <% @records.each |row| %>         <br><%= radio_button_tag 'field_name', row.name, row.selected %>         <%= row.name.humanize %>       <% end %> 

Comments

Popular posts from this blog

php - What is the difference between $_SERVER['PATH_INFO'] and $_SERVER['ORIG_PATH_INFO']? -

fortran - Function return type mismatch -

queue - mq_receive: message too long -