Note that there are some explanatory texts on larger screens.

plurals
  1. POWhy is simple_form populating these select lists with all comment_titles?
    primarykey
    data
    text
    <p>So i have this form for generating comment_titles:</p> <pre><code>&lt;%= simple_form_for @video, :remote =&gt; true do |f| %&gt; &lt;%= f.input :comment_title_names, :label =&gt; false, :placeholder =&gt; "Add a Comments Title" %&gt; &lt;%= f.button :submit, :value =&gt; 'Add', :id =&gt; 'add_comment_title' %&gt; &lt;div class='hint'&gt;Let your listeners know what comments you want by adding a guiding title for them. Pose a question, ask for feedback, or anything else!&lt;/div&gt; &lt;% end %&gt; </code></pre> <p>And this is the relevant part of my video model that allows comment_titles to be created as a virtual attribute:</p> <pre><code>attr_accessor :comment_title_names after_save :assign_comment_titles def assign_comment_titles if @comment_title_names self.comment_titles &lt;&lt; @comment_title_names.map do |title| CommentTitle.find_or_create_by_title(title) end end end </code></pre> <p>Then this is the form for generating a comment where a user must select the desired comment_title:</p> <pre><code>&lt;%= simple_form_for([@video, @video.comments.new]) do |f| %&gt; &lt;%= f.association :comment_title, :label =&gt; "Comment Title:", :include_blank =&gt; false %&gt; &lt;%= f.input :body, :label =&gt; false, :placeholder =&gt; "Post a comment." %&gt; &lt;%= f.button :submit, :value =&gt; "Post" %&gt; &lt;% end %&gt; </code></pre> <p>Now the problem is that the comment_title select lists generated by <code>&lt;%= f.association :comment_title, :label =&gt; "Comment Title:", :include_blank =&gt; false %&gt;</code> seems to populate each list for each video with ALL of the comment titles that have been added to all videos instead of only populating it with the comment_titles that have been added to that specific video. Why is this and how can I fix it?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload