ruby on rails - Activeadmin Formtastic custom input -
ruby on rails - Activeadmin Formtastic custom input -
i have simple app, has 3 models assessment, question , assessmentquestion
in assessment have association like,
class assessment < activerecord::base has_many :assessment_questions, dependent: :destroy has_many :questions, through: :assessment_questions end in question have,
class question < activerecord::base has_many :assessment_questions, dependent: :destroy has_many :bank_questions, dependent: :destroy end in assessmentquestion have,
class assessmentquestion < activerecord::base belongs_to :question belongs_to :assessment end assessment_questions table has :assessment_id, :question_id , :mark columns
i have admin interface using activeadmin gem.
while creating assessments in admin interface, in admin/assessment.rb have form generated formtastic gem,
form |f| f.inputs f.input :name f.input :duration f.input :questions, as: :check_boxes, member_label: :id f.input :creator_id end f.actions :commit end this looks fine , no problem. thing want while choosing questions through checkboxes, want textbox below or side each checkbox containing mark of questions filled in text boxes respectively ( through question.assessment_question.mark association ), can edit prefilled marks of questions while creating assessment or leave is.
i have tried, got error
undefined method `to_sym' {:for=>:questions}:hash my code,
form |f| f.inputs f.input :name f.input :duration f.input for: :questions | question | f.input :question, as: :select f.input question.assessment_question.mark end f.input :creator_id end f.actions :commit end any solutions?
i create custom input contains checkbox , string input:
https://github.com/justinfrench/formtastic#modified--custom-inputs
ruby-on-rails activeadmin formtastic
Comments
Post a Comment