# Stack level too deep

**URL:** <https://www.ruby-forum.com/t/stack-level-too-deep/152034>\
**Category:** Rails\
**Created:** [October 29, 2008, 11:02am UTC](https://www.ruby-forum.com/t/stack-level-too-deep/152034 "2008-10-29T11:02:48Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![babysudha](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/d78d45/32.png) [@babysudha](https://www.ruby-forum.com/u/babysudha)\
**Post date:** [October 29, 2008, 11:02am UTC](https://www.ruby-forum.com/t/stack-level-too-deep/152034/1 "2008-10-29T11:02:48Z")

</div>

Hi,

i have worked on one website using Ruby On Rails.i have installed  
acts\_as\_attachment for authenticate the user.after that i have installed  
login\_engine plugin to try out some mail sending function.but i did not  
get that function worked.So i have just removed that login\_engine  
plugin.and try out mail sending using acton\_mailer gem.But while i am  
running that application to send mail for forgot password fuction.

It shows the error as

stack level too deep

RAILS\_ROOT: E:/Anovaproject/anova\_tues  
Application Trace | Framework Trace | Full Trace

C:/ruby/lib/ruby/gems/1.8/gems/actionmailer-2.1.0/lib/action\_mailer/helpers.rb:92:in  
`inherited_without_helper' C:/ruby/lib/ruby/gems/1.8/gems/actionmailer-2.1.0/lib/action_mailer/helpers.rb:92:in`inherited’  
app/models/mymailertest.rb:1  
app/controllers/account\_controller.rb:261:in `forgot\_password’

for this i have also reinstalled login\_engine plugin.Cannot recover the  
error.Please any one can help me.How can i remove this error.any idea.

---

<div class="post-metadata">

**Author:** ![babysudha](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/d78d45/32.png) [@babysudha](https://www.ruby-forum.com/u/babysudha)\
**Post date:** [October 29, 2008, 3:56pm UTC](https://www.ruby-forum.com/t/stack-level-too-deep/152034/2 "2008-10-29T15:56:24Z")

</div>

This error can happen on endless loop or never ending recursive  
function,  
CAn u show app/models/mymailertest.rb content and method on app/  
controllers/account\_controller.rb:261 ?

On Oct 29, 12:02 pm, Babysudha Subbiah \<rails-mailing-l…@andreas-

---

<div class="post-metadata">

**Author:** ![babysudha](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/d78d45/32.png) [@babysudha](https://www.ruby-forum.com/u/babysudha)\
**Post date:** [October 30, 2008, 1:48am UTC](https://www.ruby-forum.com/t/stack-level-too-deep/152034/3 "2008-10-30T01:48:52Z")

</div>

It’s also common to see this when accessor methods are misused. Suppose  
the following:

class Test  
def initialize(new\_value = “Foo”)  
@my\_value = new\_value  
end

def my\_value  
@my\_value  
end

def my\_value=(new\_value)  
self.my\_value = new\_value  
end  
end

test = Test.new  
test.my\_value = “Bar”  
puts test.my\_value

In this contrived example notice how the setter method is calling itself  
in an attempt to set my\_value. Hence an infinite loop in the setter and  
a “stack level too deep” is the side-effect.

Of course the proper syntax for the setter should be:

def my\_value=(new\_value)  
@my\_value = new\_value  
end

Maybe your case if different, but I’ve seen this happen so I thought I’d  
mention it before you spend too much time on something silly like this.

alexey.Creopolis wrote:

> This error can happen on endless loop or never ending recursive  
> function,  
> CAn u show app/models/mymailertest.rb content and method on app/  
> controllers/account\_controller.rb:261 ?
> 
> On Oct 29, 12:02ï¿½pm, Babysudha Subbiah \<rails-mailing-l…@andreas-

---

<div class="post-metadata">

**Author:** ![babysudha](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/d78d45/32.png) [@babysudha](https://www.ruby-forum.com/u/babysudha)\
**Post date:** [October 30, 2008, 9:40am UTC](https://www.ruby-forum.com/t/stack-level-too-deep/152034/4 "2008-10-30T09:40:29Z")

</div>

alexey.Creopolis wrote:

> This error can happen on endless loop or never ending recursive  
> function,  
> CAn u show app/models/mymailertest.rb content and method on app/  
> controllers/account\_controller.rb:261 ?
> 
> On Oct 29, 12:02ï¿½pm, Babysudha Subbiah \<rails-mailing-l…@andreas-

Hi alexey,

```
Thanks for your reply.This is my

```

app/controllers/account\_controller.rb:261?

```
Mymailertest.deliver_welcome(recipient,subject,message)

```

app/models/mymailertest.rb

def welcome(recipient, subject, message, sent\_at = Time.now)  
@subject = subject  
@recipients = recipient  
@from = ‘’  
@sent\_on = sent\_at  
@body[“title”] = ‘This is title’  
@body[“email”] = ‘’  
@body[“message”] = message  
@headers = {}  
end

calling and called function.
