jeudi 13 avril 2017

why cause undefined method `empty? on rails?

I'm trying to loop on a related model and i have no idea why in the log is showing this

undefined method `empty?

'

someone have a idea why?

ActionView::Template::Error (undefined method `empty?' for #<Proback:0x007ffc8899c8c0>)

the proback belongs to product

and the product has_many probacks

product probacks view

<table class="completed_feedback_table">

  <tbody>
    <% @probacks.each do |proback| %>

      <tr>


        <td>
                     <div class="feedback_stars_rating" data-read-only="true" data-score="<%= proback.buyer_rating %>"></div>
        <%= proback.buyer_comment %></td>

      <td>



     <%=   link_to(proback.user.first_name, user_path(proback.user_id))%>



      </td>

      <td>
             <%= proback.buyer_feedback_date.strftime("%d/%m/%Y") %></td>


      </td>
    <td>

    </td>

  </tr>
  <% end %>


</tbody>
<tfoot>
  <tr>
    <td colspan="4">
  <%= render :partial => 'shared/proback_pagination'%>


    </td>
  </tr>
</tfoot>
</table>

controller probacks action

def probacks

    @product = Product.find(params[:id])
    @probacks =  Proback.joins(:product).where('products.id = ?', @product.id).paginate(:per_page => 22, :page => params[:page])

  end

Aucun commentaire:

Enregistrer un commentaire