# Run method at the same class

**URL:** <https://www.ruby-forum.com/t/run-method-at-the-same-class/52592>\
**Category:** Rails\
**Created:** [January 17, 2006, 12:59am UTC](https://www.ruby-forum.com/t/run-method-at-the-same-class/52592 "2006-01-17T00:59:12Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![steve](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/f19dbf/32.png) [@steve](https://www.ruby-forum.com/u/steve)\
**Post date:** [January 17, 2006, 12:59am UTC](https://www.ruby-forum.com/t/run-method-at-the-same-class/52592/1 "2006-01-17T00:59:12Z")

</div>

Sory for dummy question and bad english )

i’ve got a controller class

class ArtController \< ApplicationController  
layout “main”  
scaffold :art

```
  def rec

	a = a + 'hellomoto'
end
def srec
	for i in 0...5
		# run rec here (<- i dont know how do it )
	end

end

```

end

at the srec method i what run rec method at while. how i can do it?)  
whats syntax?  
thanks

---

<div class="post-metadata">

**Author:** ![steve](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/f19dbf/32.png) [@steve](https://www.ruby-forum.com/u/steve)\
**Post date:** [January 17, 2006, 11:30am UTC](https://www.ruby-forum.com/t/run-method-at-the-same-class/52592/2 "2006-01-17T11:30:08Z")

</div>

> ```
> for i in 0...5
> # run rec here (<- i dont know how do it )
> end
> 
> ```
> 
> end  
> end

Just use …

```
5.times do
   rec
     end

```

Or  
self.rec

Myself, I like the second form better (self.rec), because it tells  
the reader, what object you are using

cu jc
