class Address < ActiveRecord::Base
belongs_to :addressable, :polymorphic => true
class Client < ActiveRecord::Base
has_one :address, :as => :addressable
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
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.