rubyonrailsin

A Ruby and Rails talk

Tuesday, March 30, 2010


[Rails] setting up has_many

by rubyonrailsin 0 comments

Tag


Share this post:
Design Float
StumbleUpon
Reddit

Do I have to manually set a column in a dependent table for the id of
the object to which it belongs?

I have a collection of objects called photos that are owned by a
analysis object. When I try to show an attribute of each of the photo
objects I get this error:

Mysql::Error: Unknown column 'photos.analysis_id' in 'where clause':
SELECT * FROM `photos` WHERE (`photos`.analysis_id = 7)

Extracted source (around line #1):

1: <% for photo in @analysis.photos %>
2: <p>
3: <%= photo.description %>
4: </p>

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

No comments:

Post a Comment

Subscribe feeds via e-mail

Blog Archive