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.
It seems like it's often that tables are named, say, user_status and
then the table's class name is UserStatus. I often name my foreign
keys the names of the tables, that is in the "user" table I might
have:
user_status integer NOT NULL REFERENCES user_status
So another guess might be simply:
$f_key = $class->table;
Currently, it's guessing "userstatus".
--
Bill Moseley
[EMAIL PROTECTED]
_______________________________________________
List: http://lists.rawmode.org/cgi-bin/mailman/listinfo/dbix-class
Wiki: http://dbix-class.shadowcatsystems.co.uk/
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/trunk/DBIx-Class/
Searchable Archive: http://www.mail-archive.com/[email protected]/