Rails4: SystemStackError: уровень стека слишком глубокий - PullRequest
0 голосов
/ 25 августа 2018

Я намеревался развернуть свое приложение с помощью Rails в Heroku. Но я получил эту ошибку из файла журнала Heroku.

    -----> Ruby app detected
-----> Compiling Ruby/Rails
-----> Using Ruby version: ruby-2.4.4
-----> Installing dependencies using bundler 1.15.2
       Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin -j4 --deployment
       Warning: the running version of Bundler (1.15.2) is older than the version that created the lockfile (1.15.4). We suggest you upgrade to the latest version of Bundler by running `gem install bundler`.
       Fetching gem metadata from https://rubygems.org/..........
       Fetching version metadata from https://rubygems.org/..
       Fetching dependency metadata from https://rubygems.org/.
       Fetching rake 12.0.0
       Fetching i18n 0.8.6
       .........
       Fetching loofah 2.0.3
       Fetching fog-xml 0.1.3
       Installing fog-xml 0.1.3
       Installing rails-dom-testing 1.0.8
       Installing loofah 2.0.3
       Fetching fog-aws 3.0.0
       Fetching rails-html-sanitizer 1.0.3
       Installing rails-html-sanitizer 1.0.3
       Fetching actionview 4.2.5
       Installing fog-aws 3.0.0
       Installing actionview 4.2.5
       Fetching actionpack 4.2.5
       Installing actionpack 4.2.5
       Fetching actionmailer 4.2.5
       Fetching railties 4.2.5
       Installing actionmailer 4.2.5
       Installing railties 4.2.5
       Fetching sprockets-rails 3.2.0
       Installing sprockets-rails 3.2.0
       Fetching coffee-rails 4.1.1
       Fetching responders 2.4.0
       Installing coffee-rails 4.1.1
       Installing responders 2.4.0
       Fetching jquery-rails 4.3.1
       Fetching rails 4.2.5
       Installing jquery-rails 4.3.1
       Installing rails 4.2.5
       Fetching sass-rails 5.0.6
       Installing sass-rails 5.0.6
       Fetching devise 4.5.0
       Installing devise 4.5.0
       Bundle complete! 21 Gemfile dependencies, 73 gems now installed.
       Gems in the groups development and test were not installed.
       Bundled gems are installed into ./vendor/bundle.
       Bundle completed (34.24s)
       Cleaning up the bundler cache.
-----> Installing node-v8.10.0-linux-x64
-----> Detecting rake tasks
-----> Preparing app for Rails asset pipeline
       Running: rake assets:precompile
       /tmp/build_a609b10cbb2e649e43c1b42cb99934b0/vendor/bundle/ruby/2.4.0/gems/activesupport-4.2.5/lib/active_support/core_ext/numeric/conversions.rb:121: warning: constant ::Fixnum is deprecated
       /tmp/build_a609b10cbb2e649e43c1b42cb99934b0/vendor/bundle/ruby/2.4.0/gems/activesupport-4.2.5/lib/active_support/core_ext/numeric/conversions.rb:121: warning: constant ::Bignum is deprecated
       rake aborted!
       SystemStackError: stack level too deep
       /tmp/build_a609b10cbb2e649e43c1b42cb99934b0/vendor/bundle/ruby/2.4.0/gems/activesupport-4.2.5/lib/active_support/core_ext/numeric/conversions.rb:124:in `block (2 levels) in <class:Numeric>'
       /tmp/build_a609b10cbb2e649e43c1b42cb99934b0/vendor/bundle/ruby/2.4.0/gems/activesupport-4.2.5/lib/active_support/core_ext/numeric/conversions.rb:131:in `block (2 levels) in <class:Numeric>'
       /tmp/build_a609b10cbb2e649e43c1b42cb99934b0/vendor/bundle/ruby/2.4.0/gems/activesupport-4.2.5/lib/active_support/core_ext/numeric/conversions.rb:131:in `block (2 levels) in <class:Numeric>'....

ENV - это C9.io и Rails 4.2.8, а также я использовал все, чтобы выяснить, что это за ошибка. Но ничего не случилось.

Я попробовал команду ulimit -s ... для увеличения размера стека, но она не работает. Также я пробовал много драгоценных камней и bundle install, даже bundle update, git push -f heroku master .... но не работает.

Я не могу найти никакой рекурсии в моем display_controller.rb.

class DisplaysController < ApplicationController
  before_action :set_display, only: [:show, :edit, :update, :destroy]
  before_action :authenticate_user!, only: [:new, :edit, :create, :update, :destroy]
  # GET /displays
  # GET /displays.json
  def index
    @display_list = Display.all
  end

  # GET /displays/1
  # GET /displays/1.json
  def show
    @display_list = Display.all
  end

  # GET /displays/new
  def new
    @display = Display.new
  end

  # GET /displays/1/edit
  def edit
  end


  def hashtags
    tag =Tag.find_by(name: params[:name])
    @displays= tag.displays
  end

  # POST /displays
  # POST /displays.json
  def create
    @display = Display.new(display_params)

    respond_to do |format|
      if @display.save
        format.html { redirect_to @display, notice: 'Display was successfully created.' }
        format.json { render :show, status: :created, location: @display }
      else
        format.html { render :new }
        format.json { render json: @display.errors, status: :unprocessable_entity }
      end
    end
  end

  # PATCH/PUT /displays/1
  # PATCH/PUT /displays/1.json
  def update
    respond_to do |format|
      if @display.update(display_params)
        format.html { redirect_to @display, notice: 'Display was successfully updated.' }
        format.json { render :show, status: :ok, location: @display }
      else
        format.html { render :edit }
        format.json { render json: @display.errors, status: :unprocessable_entity }
      end
    end
  end

  # DELETE /displays/1
  # DELETE /displays/1.json
  def destroy
    @display.destroy
    respond_to do |format|
      format.html { redirect_to displays_url, notice: 'Display was successfully destroyed.' }
      format.json { head :no_content }
    end
  end

  def list
    # list.html.erb
    @lists=Tag.all
  end

  private
    def set_display
      @d = Display.find(params[:id])
    end

    # Never trust parameters from the scary internet, only allow the white list through.
    def display_params
      params.require(:display).permit(:title, :artist, :start_date, :end_date, :time, :address, :image, :description, :url, :content)
    end
end

Есть ли способ найти ошибку?

...