> > Although this advice wasn't because of avoiding this bug, it's > generally considered to be a "Bad Plan"� to make a relationship name > the same as the foreign-key column you're using to fetch on. Instead > of $family->order_id->order_scientific_name, it should be something > like $family->order->scientific_name. There are lots of reasons you > might want the order_id itself. And, always prefetching something > without knowing you're going to need it is just . . . icky. >
Out of curiosity, why is making the relationship name the same as the foreign key considered a "bad plan"? Seems like a matter of taste to me. You can always get the actual value of the column via get_column. Not that I disagree with you. This is a hold over from my early days with DBIx::Class when I was much more comfortable thinking in terms of the database structure. Now that I'm more comfortable with the DBIx::Class way of doing things I do name my relationships something other than the foreign key. Although, in this case "order" as a relationship name is a no-go since it's a SQL reserved word. - Alan _______________________________________________ List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class IRC: irc.perl.org#dbix-class SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/ Searchable Archive: http://www.grokbase.com/group/[email protected]
