Polymorphic association and has_one retrieval issues

class Address < ActiveRecord::Base
belongs_to :addressable, :polymorphic => true
end

class Client < ActiveRecord::Base
has_one :address, :as => :addressable
end

Now I’am able to create a correct entry in the db for address with
addressable_id = 1#client_id
addreassable_type = ‘Client’

but when I retrieve
client = Client.find(1) --> return client instance with id =1
address = client.address -> address is not nil

BUT
address.attributes == nil

Somehow I can’t retrieve the address back using association
client.address even though I could create it.
I must be missing something simple. Would appreciate any tips.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs