Guest User

Untitled

a guest
Mar 5th, 2018
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. ## error
  2. Showing app/views/tabs/index.rhtml where line #3 raised:
  3.  
  4. You have a nil object when you didn't expect it!
  5. The error occurred while evaluating nil.name
  6.  
  7. Extracted source (around line #3):
  8.  
  9. 1: <% for tab in @tabs %>
  10. 2: <div>
  11. 3: <%= tab.artist.name %>
  12. 4: </div>
  13. 5: <% end %>
  14.  
  15. ## tab.rb
  16. class Tab < ActiveRecord::Base
  17. has_one :artist,
  18. :foreign_key => 'artist_id'
  19.  
  20. def self.find_all_tabs
  21. find(:all)
  22. end
  23. end
  24.  
  25.  
  26. ## artist.rb
  27. class Artist < ActiveRecord::Base
  28. belongs_to :tab,
  29. :foreign_key => 'artist_id',
  30. end
Add Comment
Please, Sign In to add comment