我的rails5应用程序已成功部署,但在导航到另一个页面时中断

时间:2017-12-19 03:52:59

标签: ruby-on-rails heroku

在我把它推到Heroku后,这是我的Heroku日志。我使用" pg"配置了数据库。并使用" Sqlite3"发展。我部署它时一定做错了,有人可以帮我吗?

###### WARNING:
       Removing `Gemfile.lock` because it was generated on Windows.
       Bundler will do a full resolve so native gems are handled properly.
       This may result in unexpected gem versions being used in your app.
       In rare occasions Bundler may not be able to resolve your dependencies at all.
       https://devcenter.heroku.com/articles/bundler-windows-gemfile
-----> Installing dependencies using bundler 1.15.2
       Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin -j4
       The dependency tzinfo-data (>= 0) will be unused by any of the platforms Bundler is installing for. Bundler is installing for ruby but the dependency is only for x86-mingw32, x86-mswin32, x64-mingw32, java. To add those platforms to the bundle, run `bundle lock --add-platform x86-mingw32 x86-mswin32 x64-mingw32 java`.

###### WARNING:
       Removing `vendor/bundle`.
       Checking in `vendor/bundle` is not supported. Please remove this directory
       and add it to your .gitignore. To vendor your gems with Bundler, use
       `bundle pack` instead.
###### WARNING:
       Removing `Gemfile.lock` because it was generated on Windows.
       Bundler will do a full resolve so native gems are handled properly.
       This may result in unexpected gem versions being used in your app.
       In rare occasions Bundler may not be able to resolve your dependencies at all.
       https://devcenter.heroku.com/articles/bundler-windows-gemfile
###### WARNING:
       No Procfile detected, using the default web server.
       We recommend explicitly declaring how to boot your server process via a Procfile.
       https://devcenter.heroku.com/articles/ruby-default-web-server
-----> Ruby app detected
-----> Compiling Ruby/Rails
-----> Using Ruby version: ruby-2.4.2
###### WARNING:
       You have the `.bundle/config` file checked into your repository
       It contains local state like the location of the installed bundle
       as well as configured git local gems, and other settings that should
       not be shared between multiple checkouts of a single repo. Please
       remove the `.bundle/` folder from your repo and add it to your `.gitignore` file.
       https://devcenter.heroku.com/articles/bundler-configuration
-----> Installing dependencies using bundler 1.15.2
       Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin -j4 --deployment

这是我的控制器,我不确定这里是否出现语法错误。有人可以看看控制器并提供一个提示。

 class CustomersController < ApplicationController
    before_action :set_customer, only: [:show, :edit, :update, :destroy]


      def home
      end

      # GET /customers
      # GET /customers.json
      def index
        if params[:refund].blank?
          @customers = Customer.all
        else
          @refund_id = Refund.find_by(status: params[:refund]).id
          @customers = Customer.where(:refund_id => @refund_id).order("created_at DESC")
        end
      end

      # GET /customers/1
      # GET /customers/1.json
      def show
      end

      # GET /customers/new
      def new
        @customer = current_user.customers.build
        @refund = Refund.all.map{ |c| [c.status, c.id]}
      end

      # GET /customers/1/edit
      def edit
        @refunds = Refund.all.map{ |c| [c.status, c.id]}
      end

      # POST /customers
      # POST /customers.json
      def create
        respond_to do |format|
          @refund = Refund.all.map{ |c| [c.status, c.id]}
          @customer = current_user.customers.build(customer_params)
          @customer.refund_id = params[:refund_id]

          if @customer.save
            format.html { redirect_to @customer, notice: "You have successfully added a refund for #{@customer.last_name}." }
            format.json { render :show, status: :created, location: @customer }
          else
            format.html { render :new }
            format.json { render json: @customer.errors, status: :unprocessable_entity }
          end
        end
      end

      # PATCH/PUT /customers/1
      # PATCH/PUT /customers/1.json
      def update
        respond_to do |format|
          if @customer.update(customer_params)
            format.html { redirect_to @customer, notice: "You have successfully updated #{@customer.last_name}\'s refund."}
            format.json { render :show, status: :ok, location: @customer }
          else
            format.html { render :edit }
            format.json { render json: @customer.errors, status: :unprocessable_entity }
          end
        end
      end

      # DELETE /customers/1
      # DELETE /customers/1.json
      def destroy
        @customer.destroy
        respond_to do |format|
          format.html { redirect_to customers_url, notice: "You have successfully deleted #{@customer.last_name}\'s refund." }
          format.json { head :no_content }
        end
      end



      private
        # Use callbacks to share common setup or constraints between actions.
        def set_customer
          @customer = Customer.find(params[:id])
        end

        # Never trust parameters from the scary internet, only allow the white list through.
        def customer_params
          params.require(:customer).permit(:first_name, :last_name, :phone_number, :amount, :note, :refund_id)
        end
    end

这是我的route.rb文件 Rails.application.routes.draw做   #有关此文件中可用DSL的详细信息,请参阅http://guides.rubyonrails.org/routing.html   得到&#39;客户/家庭&#39;   资源:客户   devise_for:用户   root&#39;客户#index&#39;  端

1 个答案:

答案 0 :(得分:0)

我认为您正在使用Windows,因此要部署到Heroku,您必须遵循

您的Gemfile.lock文件可能包含

PLATFORMS
  ruby
  x86-mingw32

您需要删除

  x86-mingw32

https://devcenter.heroku.com/articles/bundler-windows-gemfile