# find in model

**URL:** <https://discuss.rubyonrails.org/t/find-in-model/45311>\
**Category:** rubyonrails-talk\
**Created:** [August 20, 2009, 4:20am UTC](https://discuss.rubyonrails.org/t/find-in-model/45311 "2009-08-20T04:20:38Z")\
**Posts on this page:** 1\
**Showing post:** 11

<div class="post-metadata">

**Author:** ![Frederick\_Cheung](https://sea2.discourse-cdn.com/rubyonrails/user_avatar/discuss.rubyonrails.org/frederick_cheung/32/3901_2.png) [@Frederick\_Cheung](https://discuss.rubyonrails.org/u/Frederick_Cheung)\
**Post date:** [August 21, 2009, 8:04am UTC](https://discuss.rubyonrails.org/t/find-in-model/45311/11 "2009-08-21T08:04:32Z")

</div>

> Below used in definition
> 
> Model Employee -------------- def self.list find(:all) end
> 
> In some case it is used inside
> 
> Model Employee -------------- def list self.find(:all) end
> 
> So please let me know what is the reason behind this, using in two different way

self is the implicit receiver, ie calling self.find(:all) is the same as calling find(:all). Sometimes it is useful to make it obvious what you are doing

def self.list ... end

creates a class method. The second example you gave probably wouldn't run, unless the model had an instance method called find. More likely is that you find something like that inside a

class \<\< self &nbsp;&nbsp;def list &nbsp;&nbsp;&nbsp;&nbsp;... &nbsp;&nbsp;end end

in which case it is identical to the first example

Fred

---

_[View the full topic](https://discuss.rubyonrails.org/t/find-in-model/45311)._
