[Catalyst] Some guidance needed please

Jonathan Rockway jon at jrock.us
Thu Sep 13 16:48:33 GMT 2007


Ian Docherty wrote:
> As I mentioned, if I try to do a call to
> $c->model('DBIC::UsedPassword')->create_limited( ... ); I get the
> fatal error
>
> Can't locate object method "create_limited" via package
> "DBIx::Class::ResultSet
>
> Which is why I think this is not the approach, unless you know otherwise?

I'm not sure I would structure the code exactly like you did.  I think I
would add a method to the User class like:

  package My::Schema::User;
  ...
  sub set_password { txn_do(update current password, update used
passwords) }

Then you can say something like:

  $c->model('DBIC::Users')->find(42)->set_password('foobarbaz');

and have everything work.

Finally, if you want your create_limited to work, try:

  package My::ResultSet::UsedPassword;
  use base 'DBIx::Class::ResultSet';
  sub create_limited { ... };

  package My::Schema::UsedPassword;
  __PACKAGE__->resultset_class('My::ResultSet::UsedPassword');

Regards,
Jonathan Rockway

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 370 bytes
Desc: OpenPGP digital signature
Url : http://lists.scsys.co.uk/pipermail/catalyst/attachments/20070913/e31e=
7ca4/signature.pgp


More information about the Catalyst mailing list