Christopher Heschong wrote:
Literals don't seem to work for relationships for me.  For instance:

my $foo = 'bar';
__PACKAGE__->has_many(
    'things',
    'MyApp::Schema::Thing',
    {
        'foreign.key' => 'self.id',
        'foreign.foo' => \$foo
    }
);

doesn't seem to work. I'm probably missing something simple, as usual. Any alternate ways of doing this?

Nope - currently you can do it.

The way I do something similar is with a function like:

sub things {
  my ($self, $foo) = @_;

  return $self->things_rs->search_rs({foo => $foo });
}

But with better naming.

-a

_______________________________________________
List: http://lists.rawmode.org/cgi-bin/mailman/listinfo/dbix-class
Wiki: http://dbix-class.shadowcatsystems.co.uk/
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/trunk/DBIx-Class/
Searchable Archive: http://www.mail-archive.com/[email protected]/

Reply via email to