Thanks, I suppose that would work. Ido.
On Sun, Feb 28, 2010 at 10:41 AM, Charlie Garrison <[email protected]>wrote: > Good evening, > > > On 28/02/10 at 8:58 AM +0200, Ido Perlmuter <[email protected]> wrote: > > I've been racking my brain trying to find a way to automatically pass an >> object, for the matter the Catalyst::Request object, to DBIx::Class >> methods. >> I cannot and will not pass it myself every time I call a method in my >> schema. While I do believe the model and the app should be completely >> separated, further information must flow between the two. >> > > I think you're looking for ACCEPT_CONTEXT or InstancePerContext. That's how > I solved passing values from Catalyst to DBIC. > > <http://www.google.com/search?q=Catalyst%20ACCEPT_CONTEXT> > <http://search.cpan.org/perldoc?Catalyst::Component::InstancePerContext> > > I seem to recall reading that you should decide what data/values your DBIC > model needs, and then only pass those in ACCEPT_CONTEXT, rather than passing > whole objects like $c->req. That way when you use a different front-end, you > don't have to mock a $c->req object, you simply pass the values the DBIC > schema requires. > > In your example you want the "user ID and the user IP" so grab those from > $c->req during ACCEPT_CONTEXT (or build_per_context_instance) and pass them > to your schema. > > > Charlie > > -- > Ꮚ Charlie Garrison ♊ <[email protected]> > 〠 PO Box 141, Windsor, NSW 2756, Australia > > O< ascii ribbon campaign - stop html mail - www.asciiribbon.org > http://www.ietf.org/rfc/rfc1855.txt > > > _______________________________________________ > List: [email protected] > Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst > Searchable archive: > http://www.mail-archive.com/[email protected]/ > Dev site: http://dev.catalyst.perl.org/ >
_______________________________________________ List: [email protected] Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/[email protected]/ Dev site: http://dev.catalyst.perl.org/
