title: Delete selected value from array in rails
body: <p>I have an array <code>entertainment</code> that contains several values, e.g. <code>favorite bands: ["coldplay", "u2", "oscar and the wolf", "indiana"]</code></p>
  
  <p>I created a view that shows each value in a seperate container and I want to be able to delete a value by clicking a link in the container. I have been able to delete values, however it is always the first value in the array that is deleted. </p>
  
  <p>I'm stuck on passing the selected value to the method in the controller. So when I select the link in the container for <code>indiana</code> I want the value (or actually all values) <code>indiana</code> to be deleted from the array.</p>
  
  <p><strong>the view</strong></p>
  
  <pre><code>&lt;div class="interest-container"&gt;
    &lt;% @user.profile.entertainment.each do |interest| %&gt;
      &lt;span class="interest-selected"&gt;&lt;%= "#{interest.downcase}" %&gt;
          &lt;%= link_to "delete", @interest, :method =&gt; 'delete',
                             data: { confirm: "Are you sure?" } %&gt;
      &lt;/span&gt;
    &lt;% end %&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p><strong>the destroy method in the controller</strong></p>
  
  <pre><code>  def destroy
      @user = User.find_by(params[:id])
      @profile = @user.profile
      @profile.entertainment.delete_at(params[@interest].to_i) 
      @profile.save
      redirect_to profile_path(current_user, tab:"entertainment")
    end
  </code></pre>
  
  <p>I understand that <code>delete_at</code> is used for deleting a value at a specific position in the array (<code>delete_at(3)</code> would delete <code>oscar and the wolf</code>) and I should use something like <code>delete('oscar and the wolf')</code>, however whatever I've tried, I have not been able to pass the selected value to the method.</p>