Forum: Ruby on Rails Introspecting Active Record Associations

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Dan W. (Guest)
on 2006-01-12 17:45
(Received via mailing list)
Hi,

I'm looking into write scaffold generators that will, amoung other
things, scaffold active record associations (eg.  generate select
boxes for belongs_to where you can choose a parent object) for quicker
prototyping. But...

My question is:  Is there anyway of finding out what associations
exist from examining the lodel classes themselves or indeed any other
way of finding out this information?

There's nothing obvious from looking at the RDOCs and Im poised to
delve into the rails source but Id rather not because the association
code is pretty meaty.

Anyone got any clues?

Thanks,

--
Dan W.
http://www.danwebb.net
Rick O. (Guest)
on 2006-01-12 17:51
(Received via mailing list)
> delve into the rails source but Id rather not because the association
> code is pretty meaty.
>
> Anyone got any clues?

You just didn't look hard enough :)

http://rails.rubyonrails.com/classes/ActiveRecord/...
http://rails.rubyonrails.com/classes/ActiveRecord/...

(kidding, there are a ton of hidden gems and I find new things all the
time)

good luck!

--
rick
http://techno-weenie.net
Jeremy E. (Guest)
on 2006-01-12 19:47
(Received via mailing list)
On 1/12/06, Dan W. <removed_email_address@domain.invalid> wrote:
> I'm looking into write scaffold generators that will, amoung other
> things, scaffold active record associations (eg.  generate select
> boxes for belongs_to where you can choose a parent object) for quicker
> prototyping. But...

Take a look at the Scaffolding Extensions plugin for a start.  It
doesn't work with the scaffold generator, but it will probably help
give you an idea of what you need to change.
Dan W. (Guest)
on 2006-01-12 20:38
(Received via mailing list)
Thanks very much both of you.  Thats perfect.

Cheers,

Dan

On 1/12/06, Jeremy E. <removed_email_address@domain.invalid> wrote:
> Rails mailing list
> removed_email_address@domain.invalid
> http://lists.rubyonrails.org/mailman/listinfo/rails
>


--
Dan W.
http://www.danwebb.net
This topic is locked and can not be replied to.