I have a model that works something like this. I have a User object. Each User has a Profile. Each Profile has a Picture. Well not always. At creation there is no Picture and the user could choose to never set one.
Prior to my latest upgrade of RoR I would use a line like this to check if there was a picture.
But when I went to 0.14.1 this started giving me an error, “uninitialized constant Picture”. I define the relationship in the model by saying:
class Picture < ActiveRecord::Base
and in Profile
class Profile < ActiveRecord::Base
:dependent => :destroy
The addition of the :dependent => :destroy is new to this version. So how do I specify this relationship knowing the picture may not be there? Do I have to not use belongs_to, has_one?