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 Webb http://www.danwebb.net
> 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?You just didn''t look hard enough :) http://rails.rubyonrails.com/classes/ActiveRecord/Reflection/ClassMethods.html http://rails.rubyonrails.com/classes/ActiveRecord/Reflection/MacroReflection.html (kidding, there are a ton of hidden gems and I find new things all the time) good luck! -- rick http://techno-weenie.net
On 1/12/06, Dan Webb <dan@danwebb.net> 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.
Thanks very much both of you. Thats perfect. Cheers, Dan On 1/12/06, Jeremy Evans <jeremyevans0@gmail.com> wrote:> On 1/12/06, Dan Webb <dan@danwebb.net> 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. > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-- Dan Webb http://www.danwebb.net