Last active
August 24, 2017 16:47
-
-
Save staycreativedesign/058e2cfb0787b584db5b885d04a81d6d to your computer and use it in GitHub Desktop.
answer text_fields are not showing up
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Questionnaire < ApplicationRecord | |
has_many :questions | |
has_many :member_questionnaires | |
has_many :users, through: :member_questionnaires | |
accepts_nested_attributes_for :questions | |
end | |
class Question < ApplicationRecord | |
belongs_to :questionnaire | |
has_one :answer | |
accepts_nested_attributes_for :answer | |
end | |
class Answer < ApplicationRecord | |
belongs_to :question | |
end | |
https://www.youtube.com/watch?v=WxqmaKk79Hw |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%h1 | |
questionnaires#edit | |
= form_for @questionnaire do |f| | |
- @questionnaire.questions.each do |q| | |
%h1 | |
= q.description | |
- f.fields_for :question, q do |question_fields| | |
%h1 | |
not showing up | |
- question_fields.fields_for :answer, q.build_answer do |answer_fields| | |
%h1 | |
not showing up 2 | |
= answer_fields.text_field :description | |
= f.submit | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment