search for: addreassable_type

Displaying 1 result from an estimated 1 matches for "addreassable_type".

2010 Mar 29
0
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 coul...