hello. first things first - I am new to ruby on rails (ruby, too), so
I’m figuring this is just a basic newbie error.
I’m creating a basic photography website. And I have two tables with a
- id (set up as PK)
- id (set up as a PK)
- photos_id (set up as a FK)
In my photo.rb model file i have this:
class Photo < ActiveRecord::Base
other code where I use ‘find’ to get the photo info
This is all I have in my photo_comment.rb model file:
class Photo_comment < ActiveRecord::Base
From here I’ll admit I’m a little lost as to how to procede. Right now
I’m just wanting to view the comments (i’ll worry about adding comments
next… but one step at a time).
In my photo_controller.rb file I get the desired photo like this:
@photos = Photo.get_photo(params[:photo])
On the view side for this, I have this line to display the photo:
To get the comments, I’ve been trying to do something like this:
<% for a_comment in @photos.photo_comment %>
<%= a_comment.comment %>
<% end %>
However, when I run this code, I get this error:
“uninitialized constant PhotoComment”
Any suggestions on how to fix this, or am I approaching this the wrong
way and need to do it differently?
Thanks in advance, I appreciate it.