I have two models:
AdvertisementImages (table: advertisement_images)
Advertisement (table: advertisements)
The table advertisement_images has a foreign key to advertisements
called advertisement_id. Both tables has one entry where the entry in
dvertisement_images belongs to advertisement.
The model code looks lik this so far:
class AdvertisementImages < ActiveRecord::Base
class Advertisement < ActiveRecord::Base
validates_presence_of :title, :body
Well… I want now have access to the advertisement images where ever
I display an advertisement.
I have a view where I can edit an advertisment. In this view I wanna
display the images as well… My problem is, that the advertisement
doesn’t fetch the images automatically.
When I dump the advertisement via <%= debug @advertisement %>, my
output is :
— &id001 !ruby/object:Advertisement
body: some text
title: Villa Katherina
I must have done a mistake somewhere in my declarations or so… does
anyone know what I’ve done wrong ??
Thanx in advance,