I have following models in a Rails application.
class Address < ActiveRecord::Base
belongs_to :addressable, :polymorphic => true
end
class Client < ActiveRecord::Base
has_one :address, :as => :addressable, dependent: :destroy
accepts_nested_attributes_for :address, :allow_destroy => true
has_many :invoices
end
class Invoice < ActiveRecord::Base
belongs_to :client
end
While I am able to retrieve the client name using
@invoice.client.name
I am not able to retrieve the address information in the similar manner.
How do I retrieve the address attributes in the view for invoice?