ActiveAdmin "infinite loop": no error message, increased CPU and memory usage, forced destruction and server restart

I am having a problem with ActiveAdmin. Sometimes, when I visit a page with an undefined variable variable, the server starts a kind of “endless loop” without displaying error messages and increasing CPU and memory usage until I have to kill it.

Here is an example:

I have an answer table, and this is part of the code in the answers. rb:

show :title => proc { answer.id } do
  panel 'Answer' do
    .
    .
  end
  .
  .
end

This part of the code does not work and displays an error: "undefined local variable or" response "method

I need to write

show :title => proc { @answer.id } do

to solve this problem.

BUT I got the Users table, and this is part of the code in users.rb:

show :title => proc{ @user.name } do
  panel 'User details' do
    .
    .
  end
  .
  .
end

If i write

show :title => proc{ user.name } do

, , , .

, , , , , cpu/memory .

+5
3

, !

a SELECT * FROM users, 300 000 , " " undefined .

, SELECT * FROM answers, , . , , SELECT * .

answer.rb users.rb, users.rb:

ActiveAdmin.register User do

  scope_to :association_method => :scoped do
    User.includes([:current_device => [:current_device_config, :current_push_config],:current_web_device => [:current_device_config, :current_push_config]])
  end

Active Active Directory , .

:

controller do
  def scoped_collection
    User.includes([:current_device => [:current_device_config, :current_push_config], :current_web_device => [:current_device_config, :current_push_config]])
  end

SELECT * FROM users undefined variable 'user' '.

,

0

, . :

class User < ActiveRecord::Base
  paginates_per 25
end

, . AA 0.4.0 : https://github.com/gregbell/active_admin/issues/996

0

, best_errors , , - , ActiveRelation, . , , , ActiveRelation.

Pow, , , . .

To fix this problem, I needed to run the rails serverold-fashioned way and directly check the output. This allowed me to immediately kill the ruby. It would also be possible to check log/development.log.

0
source

All Articles