When the object referenced by the association exists, it's a real AssociationProxy, and all the methods work: http://apidock.com/rails/ActiveRecord/Associations/AssociationProxy
Container.first.pickup_at.class.to_s
=> "Terminal"
Container.first.pickup_at.aliased_table_name
=> "companies"
When the object is new:
Container.new.pickup_at.class
=> NilClass
ImportContainer.new.pickup_at.aliased_table_name
NoMethodError: You have a nil object when you didn't expect it! The error occurred while evaluating nil.aliased_table_name
It seems to be a real nil object, and not a AssociationProxy with the "class" method removed.
The question is: How do I reflect on the association when the object is new?