I am trying to set multiple placeholders, one for each form field, from an array of placeholders. It sounds like the __nested_field_for_replace_with_index__ string would be useful, but I'm getting the following error:
undefined local variable or method `__nested_field_for_replace_with_index__' for #<#<Class:0x007f7fa3821188>:0x007f7f9ef8a578>
Here's my code:
/ _form.html.haml
= vertical_form_for study, url: study_questions_path(study.slug), method: :post do |f|
= f.nested_fields_for :questions do |question|
= render partial: 'form_fields', locals: { f: question, placeholder: Question::PLACEHOLDERS[__nested_field_for_replace_with_index__] }
/_form_fields.html.haml
= f.input :body, placeholder: placeholder, label: 'Open-ended question', as: :text, input_html: { class: 'question-textarea' }
I also tried just putting it there as a string, but then I get no implicit conversion of String into Integer as the error instead.
I am trying to set multiple placeholders, one for each form field, from an array of placeholders. It sounds like the
__nested_field_for_replace_with_index__string would be useful, but I'm getting the following error:Here's my code:
I also tried just putting it there as a string, but then I get
no implicit conversion of String into Integeras the error instead.