FAQ
Hello!

I've made a simple many-to-many relationship for user/roles
authentication, and suddenly found that

my $model = $c->model('Pwuser')->search()->all();
my $roles = $c->model('Role')->search()->all();
my $ur = $c->model('UserRole')->search()->all();

results in

SELECT me.uid, me.login, me.password FROM pwuser me:
SELECT me.uid, me.rid FROM user_role me:
SELECT me.uid, me.rid FROM user_role me:

nothing get selected from role table, and $c->model('Role')->search->all
selects from wrong table.

How can it be and what can I do?...

Alex.

Search Discussions

  • Andreas Marienborg at Mar 6, 2008 at 11:21 am
    Include the model-name, not only the table

    $c->model('DBIC::Pwuser') for instance

    - andreas
    On Mar 6, 2008, at 12:12 PM, Alex Povolotsky wrote:

    Hello!

    I've made a simple many-to-many relationship for user/roles
    authentication, and suddenly found that

    my $model = $c->model('Pwuser')->search()->all();
    my $roles = $c->model('Role')->search()->all();
    my $ur = $c->model('UserRole')->search()->all();

    results in

    SELECT me.uid, me.login, me.password FROM pwuser me:
    SELECT me.uid, me.rid FROM user_role me:
    SELECT me.uid, me.rid FROM user_role me:

    nothing get selected from role table, and $c->model('Role')->search-
    all selects from wrong table.
    How can it be and what can I do?...

    Alex.


    _______________________________________________
    List: Catalyst@lists.scsys.co.uk
    Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
    Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
    Dev site: http://dev.catalyst.perl.org/
  • Ash Berlin at Mar 6, 2008 at 11:26 am

    On 6 Mar 2008, at 11:12, Alex Povolotsky wrote:

    Hello!

    I've made a simple many-to-many relationship for user/roles
    authentication, and suddenly found that

    my $model = $c->model('Pwuser')->search()->all();
    my $roles = $c->model('Role')->search()->all();
    my $ur = $c->model('UserRole')->search()->all();

    results in

    SELECT me.uid, me.login, me.password FROM pwuser me:
    SELECT me.uid, me.rid FROM user_role me:
    SELECT me.uid, me.rid FROM user_role me:

    nothing get selected from role table, and $c->model('Role')->search-
    all selects from wrong table.
    How can it be and what can I do?...

    Alex.
    You are passing the wrong thing to $c->model and its falling back to
    the (hateful) regexp search.

    Assuming your DBIC::Schema model is MyApp::Model::DBModel you want $c-
    model('DBModel::Role').
    -ash
  • Alex Povolotsky at Mar 6, 2008 at 11:41 am

    Ash Berlin wrote:
    On 6 Mar 2008, at 11:12, Alex Povolotsky wrote:

    Hello!

    I've made a simple many-to-many relationship for user/roles
    authentication, and suddenly found that

    my $model = $c->model('Pwuser')->search()->all();
    my $roles = $c->model('Role')->search()->all();
    my $ur = $c->model('UserRole')->search()->all();

    results in

    SELECT me.uid, me.login, me.password FROM pwuser me:
    SELECT me.uid, me.rid FROM user_role me:
    SELECT me.uid, me.rid FROM user_role me:

    nothing get selected from role table, and
    $c->model('Role')->search->all selects from wrong table.

    How can it be and what can I do?...

    Alex.
    You are passing the wrong thing to $c->model and its falling back to
    the (hateful) regexp search.

    Assuming your DBIC::Schema model is MyApp::Model::DBModel you want
    $c->model('DBModel::Role').
    Thanks a lot!


    Alex.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupcatalyst @
categoriescatalyst, perl
postedMar 6, '08 at 11:12a
activeMar 6, '08 at 11:41a
posts4
users3
websitecatalystframework.org
irc#catalyst

People

Translate

site design / logo © 2021 Grokbase