Suggestion for a stylistic change to RDG

1 view
Skip to first unread message

mackler

unread,
Jan 24, 2010, 3:07:26 PM1/24/10
to CatalystX::CRUD
This is a suggestion for a small change to the behavior of RDG. It
would not affect anything substantively, but would merely make the
output more human-oriented.

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

Peter Karman

unread,
Jan 24, 2010, 10:02:11 PM1/24/10
to CatalystX::CRUD

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.

Peter Karman

unread,
Apr 11, 2010, 1:26:02 PM4/11/10
to cataly...@googlegroups.com
Peter Karman wrote on 1/24/10 9:02 PM:

> 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

mackler

unread,
Apr 11, 2010, 10:21:51 PM4/11/10
to CatalystX::CRUD
It works; thank you very much!

Peter Karman

unread,
Apr 11, 2010, 11:37:43 PM4/11/10
to cataly...@googlegroups.com
mackler wrote on 4/11/10 9:21 PM:

> It works; thank you very much!

cool. 0.22 just uploaded to CPAN.

Reply all
Reply to author
Forward
0 new messages