# Custom finder in associated model

**URL:** <https://www.ruby-forum.com/t/custom-finder-in-associated-model/171264>\
**Category:** Rails\
**Created:** [June 29, 2009, 7:06pm UTC](https://www.ruby-forum.com/t/custom-finder-in-associated-model/171264 "2009-06-29T19:06:18Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![byrnejb](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/d2c977/32.png) [@byrnejb](https://www.ruby-forum.com/u/byrnejb)\
**Post date:** [June 29, 2009, 7:06pm UTC](https://www.ruby-forum.com/t/custom-finder-in-associated-model/171264/1 "2009-06-29T19:06:18Z")

</div>

I have a model for which I have provided a customer finder method,  
‘find\_one\_by\_date(params)’, where params is a hash. This method  
always returns one or no record from the DB.

I would like to define an association, has\_one, from another model to  
this one, passing the params hash and using the custom finder that I  
have written. It seems to me as if this is not possible from my  
reading of the api. Before I try and roll my own solution to this I  
would like to know if it is, in fact, possible to do what I want  
through the has\_one association in AR; and, if so, how is it done?
