[Catalyst] (Beginner) Problem listing users in DB -- solved
Matt S Trout
dbix-class at trout.me.uk
Sun Oct 22 21:09:08 CEST 2006
Steffen Kremsler wrote:
> Well I just overlooked that the tutorial DBIx schema classes
> User.pm and Role.pm didn't have many-to-many relationships
> defined. Whereas they were defined in Book.pm and Author.pm.
> So i added the following lines
>
> to User.pm:
> __PACKAGE__->many_to_many(roles => 'map_user_role', 'role');
>
> to Role.pm:
> __PACKAGE__->many_to_many(users => 'map_user_role', 'user');
>
> and it works now.
>
> Sometimes it helps getting a break and some distance. :)
> But i'm still wondering why
> [% FOR role = Catalyst.user.roles %][% role %] [% END %]
> did work before then.
That uses the roles method on the
Catalyst::Plugin::Authentication::Store::DBIC::User object rather than the
underlying DBIC object (which would be Catalyst.user.obj)
--
Matt S Trout Offering custom development, consultancy and support
Technical Director contracts for Catalyst, DBIx::Class and BAST. Contact
Shadowcat Systems Ltd. mst (at) shadowcatsystems.co.uk for more information
+ Help us build a better perl ORM: http://dbix-class.shadowcatsystems.co.uk/ +
More information about the Catalyst
mailing list