Activeadmin Formtastic user input

I have a simple application that has three models Assessment, QuestionandAssessmentQuestion

As AssessmentI have such an association,

class Assessment < ActiveRecord::Base
  has_many :assessment_questions, dependent: :destroy
  has_many :questions, through: :assessment_questions
end

In Questioni

class Question < ActiveRecord::Base
  has_many :assessment_questions, dependent: :destroy
  has_many :bank_questions, dependent: :destroy
end

In AssessmentQuestioni

class AssessmentQuestion < ActiveRecord::Base
  belongs_to :question
  belongs_to :assessment
end
Table

evaluation_questions has :assessment_id, :question_idand :markcolumns

I have an admin interface using ActiveAdmingem.

When creating ratings in the admin interface, in admin / evaluation.rb, I have a form generated by the gem format,

  form do |f|
    f.inputs do
      f.input :name
      f.input :duration
      f.input :questions, as: :check_boxes, member_label: :id
      f.input :creator_id
    end

    f.actions :commit
  end

Screen shot of that page

. , , - , , , , ( question.assessment_question.mark), .

, ,

undefined method `to_sym' for {:for=>:questions}:Hash

,

form do |f|
        f.inputs do
          f.input :name
          f.input :duration
          f.input for: :questions do | question |
            f.input :question, as: :select
            f.input question.assessment_question.mark
           end 
          f.input :creator_id
        end

        f.actions :commit
      end

?

+4
3

, .

semantic_form_for _form.html.erb admin/evaluation.rb

form partial: 'assessment/form'

.

: http://activeadmin.info/docs/5-forms.html

+1

The solution is obvious, your "f.input: for" skips "s". It must be f.inputs

0
source

All Articles