[Dbix-class] Extending 'find' to include constant value for
	search query
    Charlie Garrison 
    garrison at zeta.org.au
       
    Fri Jun 22 01:04:49 GMT 2007
    
    
  
Good morning,
On 22/6/07 at 8:37 AM +0930, Jon Schutz <jon+dbix at youramigo.com> wrote:
>>  So, first my question is, what is the best way to extend 
>>find so  that I can restrict records using an additional 
>>(constant) value  in the query? And if I should just override 
>>'find', where do I  put my 'find' method?
>
>find is a ResultSet method; you need to create a ResultSet class that
>inherits from DBIx::Class::ResultSet, put your find in there (and
>probably search_rs too), and direct your schema to use that class by
>adding
>__PACKAGE__->resultset_class(...)
>
>into your schema (table declaration) class.
I found a similar explanation in the cookbook, but didn't think 
that applied in this case (not sure why). Now that you've 
clarified it, it makes perfect sense. I'll give that a go now.
Thanks for your help.
Charlie
-- 
    Charlie Garrison  <garrison at zeta.org.au>
    PO Box 141, Windsor, NSW 2756, Australia
O< ascii ribbon campaign - stop html mail - www.asciiribbon.org
http://www.ietf.org/rfc/rfc1855.txt
    
    
More information about the Dbix-class
mailing list