Is there a "has_one ..., :through"?

I have found a few posts on various sites that this was something that
was going to be available. The posts were all over a year ago, but it
doesn’t seem like it is available in 1.2 unless I am missing something
(which I hope is true)

I have a member and office table that each have an address. Any
advice on the best way to do this. I have also seen a few posts
saying to use delegates, but without much info on how to do so and I
can’t find any info on delegates in the docs.

Any advice on the best way to make these relationships is appreciated.

Thanks

On Nov 2, 10:03 am, chris [email protected] wrote:

Any advice on the best way to make these relationships is appreciated.

Thanks

are these the posts youre talking about?
http://railsexpress.de/blog/articles/2006/09/16/piggy-back-plugin-updated
http://www.artofmission.com/articles/2007/6/21/has_one-through
http://entren.ivanyvenian.com/inclusiones-anidadas-asociaciones/

first 2 yes, last one no.

if I take the long approach of creating a get and set method, is there
a short way to make the association between the address and member
table without having to create a model out of the associative table?

class member

#properties
def address
if @address.nil?
@address = Address.find_by_member_id(self.id) unless
@address.nil?
@address
end

def address=(value)
@address = value
end

#methods
def after_insert
@address.save
#connect the tables here
end

end

the guy who wrote the second article reference, Ryan H., is
working on a patch for Rails to add the has_one :through.

or there is this way, but now I have a address collection within the
model. It is rather difficult to believe that Rails would not have a
better way of making associations of this sort.

class Member
has_and_belongs_to_many :addresses, :join_table
=> :members_addresses

#properties
def address
return self.addresses[0] unless self.addresses.nil?
nil
end

def address=(value)
self.addresses = [] if self.addresses.nil?
self.addresses << value
end
end

In my case I have an address table that is linked to a few tables
within the database. It turns out that in my case polymorphic
association is probably the best bet anyway.

Thanks for letting me know though, I am sure the plugin will come in
handy someday.