Rails4:SystemStackError:堆栈级别太深

时间:2018-08-25 11:09:06

标签: ruby-on-rails heroku c9.io

我打算使用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 ...命令来获得更大的堆栈大小,但是它不起作用。 我还尝试了许多gem和bundle install,甚至bundle updategit 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

有什么方法可以找到错误吗?

0 个答案:

没有答案