[Maypole] feature idea: Automatic 'AddFrom' of has_many relationships.

From: Drew Crampsie - Software Developer (drew at tech.coop)
Date: Tue Sep 07 2004 - 05:33:03 BST


Hello,

I'd like to add a new feature to maypole, as it would simplify what i'm
doing currently, and it seems like a good idea.

For any table that has a 'has_many' relationship setup, the default view
template lists all the rows in the foreign table that are related. I'd
like to add a feature that takes it when step further and defines a
function that will add a new row to the related table.

Example:
    I have two tables, account and demograpic. when i do
"account/view/x" i'd like a function on demographic linked from that
page that does 'addnew' , but automatically populates the foreign key
field 'account_id' with the account id of the currently viewed account.
ie: "demographic/add_from_account/x".

It seems to me that adding that functionality to Maypole::Model::CDBI
would be the best bet. Then, in my current project, creating an 'add
new customer' wizard would be a simple matter of creating new view
templates, rather then a whole bunch of methods on the various tables
involved in a new customer (which is somthing like
account->demographic->delivery_account->delivery_route).

Any suggestions of how to procceed to make it most useful to maypole
users? Gotchas? It seems pretty simple in concept.

Thanks!

drewc

_______________________________________________
maypole mailing list
maypole at lists.netthink.co.uk
http://lists.netthink.co.uk/listinfo/maypole



This archive was generated by hypermail 2.1.3 : Thu Feb 24 2005 - 22:25:56 GMT