has_one association with :conditions: is this somehow possible?

What is the right way to achieve something like this:

class Design < ActiveRecord::Base
  belongs_to :card_collection
  after_save :generate_images

  has_one :background,
          :as => :resourceable,
          :class_name => "Resource",
          :conditions => [ 'title = ?', self.id ],
          :dependent => :destroy
end

What is the right way to achieve something like this:

class Design < ActiveRecord::Base
belongs_to :card_collection
after_save :generate_images

has_one :background,
         :as => :resourceable,
         :class_name => "Resource",
         :conditions => [ 'title = ?', self.id ],
         :dependent => :destroy
end

--------------------
Everything here is working as expected. ONLY the conditions part is
not working...

The problem is that self.id is NOT the @my_design.id (the id of the
active record design instance), but the object_id of the instance. HOW
can I tell ActiveRecord that I want the @my_design.id ???

Set conditions to 'title =#{self.id}' (make sure it's single quotes
not double quotes). Activerecord should interpolate it for you.

Fred

Hi Fred,

thanks for the hint. I finally found out how to get it work: