[Dbix-class] HasMany foreign column guess
Matt S Trout
dbix-class at trout.me.uk
Tue May 8 13:04:18 GMT 2007
On Sun, Apr 22, 2007 at 10:15:07PM -0700, Bill Moseley wrote:
> If the foreign key is not specified DBIx::Class::Relationship::HasMany
> makes this as a guess:
>
> $class =~ /([^\:]+)$/;
> $f_key = lc $1; # go ahead and guess; best we can do
> $guess = "using our class name '$class' as foreign key";
> }
>
> Would a better guess be to look at the foreign table and see in any
> columns are pointing to the table making the has_many relationship?
> That is, look for a belongs_to relationship on the class.
Patches+tests to support this welcome.
--
Matt S Trout Need help with your Catalyst or DBIx::Class project?
Technical Director Want a managed development or deployment platform?
Shadowcat Systems Ltd. Contact mst (at) shadowcatsystems.co.uk for a quote
http://www.shadowcatsystems.co.uk/
More information about the Dbix-class
mailing list