0
votes

I'm facing a error in rails while updanting a attribute accepted. accepted is a boolean type coloumn.

This is the code:

 def response
if params[:response]
  @invite = Invite.find_by(invited: '2')
  @invite.update(accepted: params[:response])
  render nothing: true
end
end

The trace (sorry for image):

enter image description here The error is Stack level is too deep

1
The code you posted looks correct. Post the entire stacktrace, including the error and the error line, and the code gist that generated that error. - Simone Carletti
There might be a problem in one of your callbacks, but as @SimoneCarletti has already said we cannot be certain unless we see the stack trace. You can copy it from your rails server logs and paste it here. - Aravind
@Igor, any update? Did changing the action name solve the problem? And please update your post with some more information. - Sharvy Ahmed
@SharvyAhmed ...edited with the trace...the error only show this message, witthout lines... - Igor Martins

1 Answers

2
votes

I guess when you are calling update action and passing params[:response], somehow it's invoking response action and falling into an infinite loop, which is raising 'stack level too deep' error.

Change response to update_response or something else to fix the problem.

def update_response
  if params[:response]
    @invite = Invite.find_by(invited: '2')
    @invite.update(accepted: params[:response])
    render nothing: true
  end
end

I'll update this answer as soon as I find any explanation.