o2bwise has asked for the wisdom of the Perl Monks concerning the following question:

Hi,

My job requires me to learn the Catalyst and DBIx mods and I have been going thru the metacpan Catalyst tutorial with its database as well as one of my own.

Now, my database is called music_library and has three tables - artists, albums, and songs. I am successfully viewing each table's contents on the browser, but using Table albums as an example, I do not want to look at field artist_id which is a foreign key in Table albums and the primary key in Table artists.

I want to see artist_name, another field in Table artists.

Now, Catalyst has the following text in file Album.pm in path music_library/lib/music_library/Schema/Result.

__PACKAGE__->add_columns( "album_id", { data_type => "integer", is_auto_increment => 1, is_nullable => 0 } +, "album_name", { data_type => "text", is_nullable => 1 }, "artist_id", { data_type => "integer", is_foreign_key => 1, is_nullable => 1 }, "genre", { data_type => "text", is_nullable => 1 }, "source", { data_type => "text", is_nullable => 1 }, );

As well as:

__PACKAGE__->belongs_to( "artist", "music_library::Schema::Result::Artist", { artist_id => "artist_id" }, { is_deferrable => 0, join_type => "LEFT", on_delete => "NO ACTION", on_update => "NO ACTION", }, );

So the foreign key and left joins are defined.

Here are my questions:
1) What is the best way to enable viewing artist_name rather than artist_id?

2) Does the above code already make it so that the application "has" artist_name and it is just up to me to somehow correctly specify it in my Toolkit Template view file?

3) If it is not too much trouble, where does the cpan module definition indicate how to do what I want to do?

Thanks in advance!

Tony