Radio buttons with simple_form nested

1

I need to set an input radio into a simple form with association.

I'm following the documentation , but the difficulty is being in rendering radio the right way . Instead of displaying the contents of the association it displays a array YES and NO for each record.

My models:

class Page < ActiveRecord::Base
  has_many :questions
end

class Question < ActiveRecord::Base
  has_many :answer_options
  belongs_to :page
end

class AnswerOption < ActiveRecord::Base
  belongs_to :question
end

My code looks like this:

- @page.questions.each do |question|
  h1 = question.title
  h5 = question.description

  = simple_form_for question do |f|
    = f.error_notification

    .form-inputs
      = f.simple_fields_for :answer_options do |ff|
        = ff.input :content, label: false, as: :radio_buttons

    .form-actions
      = f.button :submit, class: 'btn btn-success'

The funny thing is that if I leave the field without the as: :radio_buttons it brings the content right but in the format of the input text, when in fact I need to present it in the format radio .

    
asked by anonymous 24.07.2015 / 21:35

0 answers