Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8212691
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T10:50:44+00:00 2026-06-07T10:50:44+00:00

I know for a fact (having checked through the console) that the output should

  • 0

I know for a fact (having checked through the console) that the output should be three songs, but for some reason I keep getting a fourth song added to every page. The song is different on every occasion, and I’m baffled as to why this is happening. Any help is much appreciated!

In my controller

  def edit
    @songs = Song.all(order: 'title')
    @song = Song.find(params[:id])
    @setlist = Setlist.find(params[:id])
    @allocations = @setlist.allocations
  end

The full view code, as requested:

First the view for the actual edit page:

<h1>Edit a Setlist</h1>
<div class="row">
   <div class="span8">
      <%=form_for(@setlist) do|f|%>

         <%=f.label :date, "Set a date" %>
         <span><%=f.date_select :date%><span>

         <%=f.label :morning, "Morning" %>
         <%=f.radio_button :morning, true %>
         <%=f.label :morning, "Evening" %>
         <%=f.radio_button :morning, false %>

         <h2>Library</h2>   

        <div>
          <%= render 'library' %>
          <%= render 'currentSet' %> 
        </div>

         <%=f.submit "Save Setlist", class: "btn btn-large btn-primary" %>
      <% end %>
   </div>
</div>

The current set partial (ignore the library partial, as it’s a nested form with nothing added yet):

<div id="currentSet">
   <h2>Current Setlist</h2>
     <table class= "table table-striped table-bordered">
       <thead>
         <th>Title</th>
         <th>Artist</th>
         <th>Root Key</th>
         <th>Remove</th>
       </thead>
       <tbody>
         <% if(@allocations.empty?) %>
            <tr><td>NO SONGS</td></tr>
         <% else %>
            <%= render @allocations %>
         <%end%>    
      </tbody>
     </table>
   </div>

And allocations:

<tr>
    <td><%= allocation.song.title %></td>
    <td><%= allocation.song.artist %></td>
    <td><%= allocation.song.key %></td>
    <td><%= link_to "Remove Song", allocation, method: :delete %></td>
</tr>

I’m not sure if this is relevant but I’ve also added the actual rendered html for examination:

<tr>
    <td>S</td>
    <td>A</td>
    <td>K</td>
    <td><a href="/allocations/7" data-method="delete" rel="nofollow">Remove Song</a>...
</tr><tr>
    <td>S</td>
    <td>A</td>
    <td>K</td>
    <td><a href="/allocations" data-method="delete" rel="nofollow">Remove Song</a></td>
</tr>

The part I’m finding wierd is that the last entry differs from all the others in that the url doesn’t have an allocation id i.e. /allocations/9 in the second last one vs /allocations in the last one.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T10:50:46+00:00Added an answer on June 7, 2026 at 10:50 am

    Just to close this one off then:

      def edit
        @songs = Song.all(order: 'title')
        @song = Song.find(params[:id])
        @setlist = Setlist.find(params[:id])
        @allocations = @setlist.allocations
      end
    

    Use the appropriate :id’s in your Song and Setlist finders (i.e. not the same one).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm having trouble with something that should be so easy, but I don't know
I know this subject should be pretty much dated by now, but I'm having
I should preface this with the fact that I know virtually nothing about javascript
I know for a matter of fact that Type cannot be used when passing
I know that Phonegap has an event for back button, but it's only available
I know that this sort of question has been asked here before, but still
I have an application that's having some trouble handling multi-processor systems. It's not an
I'm using AQuery to help cache some images. I know for fact the images
I am having some issues with JQuery and CakePHP. I wanted to know if
I'm having some trouble getting gmail login to work. In fact, the log in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.