> No need for send here:
>
> def part(*args, &block)
>  lot.part(*args, block) # may need an if block_given?
> end
>
I was thinking that I would have to use #send since there is so much
Ruby magic wrapped inside ActiveRecord in order to map column names to
object attributes, but a very simple test (following your email)
showed me I was wrong.  (And it seems to work fine w/o block_given? --
I can't find any ActiveRecord instance methods that take a block, so
this might be overkill anyway.)

Basically, I wanted to add something like

  belongs_to :part, :through => :lot

to my Component model, which I was happy to see I could do with 3
lines of code.  I just picked 3 lines of code that were more
complicated than they needed to be.

> Yup.  Of course, you could have done that even without the :through.
>
I want to relationship to go both ways, and as far as I can tell,
there is no belongs_to :through => construct similar to the has_many
:through => construct.  But it is easy enough to implement with the
single method definition.

Thanks again for the help and the tips.  I appreciate them both.

--wpd

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to