Hi,
I am working through the chapter in the book to learn about many to many
relationship bridges.
I have made it through the chapter up to the last part where it has us list
all users and their roles. Page 165 in Chapter 6.
This is the template file root/authusers/list.tt
html
head
titleAll
Instead of role.role_id.role you should do role.role.role
obviously that's silly in how confusing it is, so eventually if I were you
i'd make the column in the role table to be called name, and then instead
of calling user_roles role, call then user_role. That would make the above
Thanks, that worked. Now I am off to see why.
On Wed, Jul 11, 2012 at 12:26 PM, fREW Schmidt fri...@gmail.com wrote:
Instead of role.role_id.role you should do role.role.role
obviously that's silly in how confusing it is, so eventually if I were you
i'd make the column in the role table to
So Just to understand or get confirmation that I am understanding this
correctly...
When I use user.user_roles I am looking at the UserRole.pm result class.
Then when I look at that, I should use the belongs_to accessor to the
Role.pm result class not point at id for the Role in this table and
li[% role.role.role %]/li works because you're accessing the role name
(the third 'role') through the 'role' accessor (the second 'role') which is
defined in your many-to-many relationship:
__PACKAGE__-many_to_many(roles, user_roles, *role*);
This is one of the beauties of DBIC; as soon as you
Thanks Tim,
I thought that the many_to_many was a relationship bridge and as limited to
what it could do. I was studying the many_to_Many examples in the book to
help my real problem in a test application I am trying to work on. I guess
I should start a new thread for questions related to that. I
Sorry Robyn (and others I may have misled), I'm wrong.
I reviewed again, and you're not leveraging the many_to_many at all.
You're following a path that looks like this:
[% FOREACH role = user.user_roles %]
User.pm has a 'has_many' relationship called 'user_roles' that you are
leveraging, in