One default convention followed by
Rose::DB::Object::ConventionManager is:
"Foreign key column names are made from the singular version of the
foreign table's name joined (with an underscore) to the foreign
table's key column name."
Since we know that such a suffix of a foreign-key column name is not
really part of that column's name, but rather is more of a flag to
indicate that it's a foreign key, my suggestion is that when the field
label is created from that column name, the suffix be dropped.
So, for example, if there's a 'customers' table with a foreign-key
column called 'address_id' and the addresses table's primary-key
column is called 'id', then the label for the foreign key field in the
Customer Form would be labeled 'address' rather than 'address_id'.
I can see that I could set the column_to_label configuration parameter
to do that based on recognizing the suffix (if all primary keys
columns are called 'id', for example). But there should be a more
reliable way to do it that actually checks to see if the column
contains foreign keys before losing part of its name.
Adam Mackler
This isn't properly a feature of RDG, because the RDG generated Forms
do not assume they are related to one another. Each field represents a
column exactly. It's one-to-one.
Rose::HTMLx::Form::Related, otoh, is where such a feature could
belong, since that's where the magic of interrogating for foreign
keys, etc., is happening.
I'll have to think about how best to do that. Probably a configurable
option that takes the relationship name as the field label.
Thanks for the suggestion.
> Rose::HTMLx::Form::Related, otoh, is where such a feature could
> belong, since that's where the magic of interrogating for foreign
> keys, etc., is happening.
>
I just replied to this thread via the google web site but it didn't appear to work.
In any case, this is now implemented in svn trunk. Please try
https://svn.msi.umn.edu/sw/perl/Rose-HTMLx-Form-Related/trunk
and see if that does what you asked for.
--
Peter Karman . http://peknet.com/ . pe...@peknet.com
cool. 0.22 just uploaded to CPAN.