I'm starting in Rails and I could not find a relationship.
I have 3 tables: Video, donations and users. A user can put X videos and each video can have several donations.
- On video I have the
- In Donations I have the
My models are:
class Donation < ActiveRecord::Base belongs_to :user belongs_to :video end class Video < ActiveRecord::Base belongs_to :user has_many :donation end class User < ActiveRecord::Base has_many :video has_many :donation end
I can take the user out of each video without problems:
The problem is when I want to take the video title of a donation:
<% @donaciones.each do |d| %> <%= d.video.titulo %><br> <% end %>
It always gives me:
undefined method 'titulo' for nil:NilClass
The title is in the
videos table, I only have 1 record.
Is there any way to see the full query that is being made on the error page?