Forum: Ruby on Rails Stack level too deep

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Fffd37ea3580fc966209bd119f889fda?d=identicon&s=25 Babysudha Subbiah (babysudha)
on 2008-10-29 11:02
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.
93e83f35def2998975cd9da50e4e2426?d=identicon&s=25 alexey.Creopolis (Guest)
on 2008-10-29 15:56
(Received via mailing list)
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-
280b78a61a968391b7e07e912be102a8?d=identicon&s=25 Robert Walker (robert4723)
on 2008-10-30 01:48
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-
Fffd37ea3580fc966209bd119f889fda?d=identicon&s=25 Babysudha Subbiah (babysudha)
on 2008-10-30 09:40
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.
This topic is locked and can not be replied to.