我的应用程序中有引脚工作,但每当我添加一个新引脚时,我都会收到页面错误,上面写着“我们很抱歉,但出现了问题”并且无法加载页面。
My Heroku Logs:
2013-12-14T05:30:27.896359+00:00 app[web.1]: Started POST "/pins" for 110.10.180.6 at 2013-12-14 05:30:27 +0000
2013-12-14T05:30:29.112850+00:00 app[web.1]:
2013-12-14T05:30:29.112850+00:00 app[web.1]:
2013-12-14T05:30:29.112850+00:00 app[web.1]: ArgumentError (missing required :bucket option):
2013-12-14T05:30:29.112850+00:00 app[web.1]: app/controllers/pins_controller.rb:22:in `create'
2013-12-14T05:30:29.112850+00:00 app[web.1]:
2013-12-14T05:30:29.112850+00:00 app[web.1]: ArgumentError (missing required :bucket option):
2013-12-14T05:30:29.112850+00:00 app[web.1]: app/controllers/pins_controller.rb:22:in `create'
2013-12-14T05:30:29.112850+00:00 app[web.1]:
2013-12-14T05:30:29.112850+00:00 app[web.1]:
2013-12-14T05:30:29.112850+00:00 app[web.1]:
2013-12-14T05:30:29.147794+00:00 heroku[router]: at=info method=POST path=/pins host=stormy-brushlands-5162.herokuapp.com fwd="110.10.180.6" dyno=web.1 connect=1ms service=2505ms status=500 bytes=1266
2013-12-14T05:30:07.000336+00:00 heroku[router]: at=info method=GET path=/favicon.ico host=stormy-brushlands-5162.herokuapp.com fwd="110.10.180.6" dyno=web.1 connect=2ms service=7ms status=304 bytes=0
2013-12-14T05:32:03.462213+00:00 heroku[api]: Starting process with command `bundle exec rake db:migrate` by jeongj2014@tciscommunity.com
2013-12-14T05:32:08.486001+00:00 heroku[run.9006]: State changed from starting to up
2013-12-14T05:32:08.907786+00:00 heroku[run.9006]: Awaiting client
2013-12-14T05:32:08.957441+00:00 heroku[run.9006]: Starting process with command `bundle exec rake db:migrate`
2013-12-14T05:32:16.798136+00:00
heroku[run.9006]: State changed from up to complete
2013-12-14T05:32:16.780456+00:00 heroku[run.9006]: Process exited with status 0
2013-12-14T05:32:53.023817+00:00 app[web.1]: Started GET "/" for 110.10.180.6 at 2013-12-14 05:32:53 +0000
2013-12-14T05:32:53.023817+00:00 app[web.1]: Started GET "/" for 110.10.180.6 at 2013-12-14 05:32:53 +0000
2013-12-14T05:32:53.046336+00:00 heroku[router]: at=info method=GET path=/ host=stormy-brushlands-5162.herokuapp.com fwd="110.10.180.6" dyno=web.1 connect=3ms service=34ms status=200 bytes=1894
2013-12-14T05:32:56.816747+00:00 app[web.1]: Started GET "/pins/new" for 110.10.180.6 at 2013-12-14 05:32:56 +0000
2013-12-14T05:32:56.816537+00:00 app[web.1]: Started GET "/pins/new" for 110.10.180.6 at 2013-12-14 05:32:56 +0000
2013-12-14T05:32:56.933124+00:00 heroku[router]: at=info method=GET path=/pins/new host=stormy-brushlands-5162.herokuapp.com fwd="110.10.180.6" dyno=web.1 connect=3ms service=122ms status=304 bytes=0
2013-12-14T05:32:57.208212+00:00 app[web.1]: Started GET "/pins/new" for 110.10.180.6 at 2013-12-14 05:32:57 +0000
2013-12-14T05:32:57.208417+00:00 app[web.1]: Started GET "/pins/new" for 110.10.180.6 at 2013-12-14 05:32:57 +0000
2013-12-14T05:32:57.226021+00:00 heroku[router]: at=info method=GET path=/pins/new host=stormy-brushlands-5162.herokuapp.com fwd="110.10.180.6" dyno=web.1 connect=2ms service=24ms status=304 bytes=0
2013-12-14T05:33:05.089753+00:00 app[web.1]: Started POST "/pins" for 110.10.180.6 at 2013-12-14 05:33:05 +0000
2013-12-14T05:33:05.089753+00:00 app[web.1]: Started POST "/pins" for 110.10.180.6 at 2013-12-14 05:33:05 +0000
2013-12-14T05:33:07.211159+00:00 app[web.1]:
2013-12-14T05:33:07.211159+00:00 app[web.1]:
2013-12-14T05:33:07.211159+00:00 app[web.1]:
2013-12-14T05:33:07.211159+00:00 app[web.1]:
2013-12-14T05:33:07.211159+00:00 app[web.1]:
2013-12-14T05:33:07.211159+00:00 app[web.1]: ArgumentError (missing required :bucket option):
2013-12-14T05:33:07.211159+00:00 app[web.1]: app/controllers/pins_controller.rb:22:in `create'
2013-12-14T05:33:07.211159+00:00 app[web.1]: ArgumentError (missing required :bucket option):
2013-12-14T05:33:07.211159+00:00 app[web.1]: app/controllers/pins_controller.rb:22:in `create'
2013-12-14T05:33:07.211159+00:00 app[web.1]:
2013-12-14T05:33:57.020002+00:00 app[web.1]: Started GET "/" for 110.10.180.6 at 2013-12-14 05:33:57 +0000
2013-12-14T05:33:57.020002+00:00 app[web.1]: Started GET "/" for 110.10.180.6 at 2013-12-14 05:33:57 +0000
2013-12-14T05:33:57.060025+00:00 heroku[router]: at=info method=GET path=/ host=stormy-brushlands-5162.herokuapp.com fwd="110.10.180.6" dyno=web.1 connect=2ms service=45ms status=304 bytes=0
2013-12-14T05:34:00.813098+00:00 app[web.1]: Started GET "/about" for 110.10.180.6 at 2013-12-14 05:34:00 +0000
2013-12-14T05:34:00.813098+00:00 app[web.1]: Started GET "/about" for 110.10.180.6 at 2013-12-14 05:34:00 +0000
2013-12-14T05:34:01.130785+00:00 app[web.1]: Started GET "/about" for 110.10.180.6 at 2013-12-14 05:34:01 +0000
2013-12-14T05:34:01.130785+00:00 app[web.1]: Started GET "/about" for 110.10.180.6 at 2013-12-14 05:34:01 +0000
2013-12-14T05:34:01.155039+00:00 heroku[router]: at=info method=GET path=/about host=stormy-brushlands-5162.herokuapp.com fwd="110.10.180.6" dyno=web.1 connect=5ms service=29ms status=304 bytes=0
2013-12-14T05:34:31.544936+00:00 app[web.1]: Started GET "/" for 110.10.180.6 at 2013-12-14 05:34:31 +0000
2013-12-14T05:34:31.544936+00:00 app[web.1]: Started GET "/" for 110.10.180.6 at 2013-12-14 05:34:31 +0000
2013-12-14T05:34:31.653972+00:00 heroku[router]: at=info method=GET path=/ host=stormy-brushlands-5162.herokuapp.com fwd="110.10.180.6" dyno=web.1 connect=3ms service=116ms status=304 bytes=0
2013-12-14T05:34:31.956480+00:00 app[web.1]: Started GET "/" for 110.10.180.6 at 2013-12-14 05:34:31 +0000
2013-12-14T05:34:31.956480+00:00 app[web.1]: Started GET "/" for 110.10.180.6 at 2013-12-14 05:34:31 +0000
2013-12-14T05:33:07.221688+00:00 heroku[router]: at=info method=POST path=/pins host=stormy-brushlands-5162.herokuapp.com fwd="110.10.180.6" dyno=web.1 connect=2ms service=3296ms status=500 bytes=1266
2013-12-14T05:35:48.098450+00:00 app[web.1]: Started GET "/pins/new" for 110.10.180.6 at 2013-12-14 05:35:48 +0000
2013-12-14T05:35:48.098450+00:00 app[web.1]: Started GET "/pins/new" for 110.10.180.6 at 2013-12-14 05:35:48 +0000
2013-12-14T05:35:48.451430+00:00 app[web.1]: Started GET "/pins/new" for 110.10.180.6 at 2013-12-14 05:35:48 +0000
2013-12-14T05:35:48.451430+00:00 app[web.1]: Started GET "/pins/new" for 110.10.180.6 at 2013-12-14 05:35:48 +0000
2013-12-14T05:35:48.476713+00:00 heroku[router]: at=info method=GET path=/pins/new host=stormy-brushlands-5162.herokuapp.com fwd="110.10.180.6" dyno=web.1 connect=2ms service=31ms status=304 bytes=0
2013-12-14T05:35:48.130914+00:00 heroku[router]: at=info method=GET path=/pins/new host=stormy-brushlands-5162.herokuapp.com fwd="110.10.180.6" dyno=web.1 connect=1ms service=37ms status=304 bytes=0
2013-12-14T05:35:55.191162+00:00 app[web.1]: Started POST "/pins" for 110.10.180.6 at 2013-12-14 05:35:55 +0000
2013-12-14T05:35:55.191534+00:00 app[web.1]: Started POST "/pins" for 110.10.180.6 at 2013-12-14 05:35:55 +0000
2013-12-14T05:35:57.077050+00:00 app[web.1]: app/controllers/pins_controller.rb:22:in `create'
2013-12-14T05:35:57.077050+00:00 app[web.1]:
2013-12-14T05:35:57.077050+00:00 app[web.1]:
2013-12-14T05:35:57.077050+00:00 app[web.1]:
2013-12-14T05:35:57.077050+00:00 app[web.1]: ArgumentError (missing required :bucket option):
2013-12-14T05:35:57.077050+00:00 app[web.1]: app/controllers/pins_controller.rb:22:in `create'
2013-12-14T05:35:57.077050+00:00 app[web.1]:
2013-12-14T05:35:57.077050+00:00 app[web.1]: ArgumentError (missing required :bucket option):
2013-12-14T05:35:57.077050+00:00 app[web.1]:
2013-12-14T05:35:57.077050+00:00 app[web.1]:
2013-12-14T05:35:57.081157+00:00 heroku[router]: at=info method=POST path=/pins host=stormy-brushlands-5162.herokuapp.com fwd="110.10.180.6" dyno=web.1 connect=1ms service=3070ms status=500 bytes=1266
2013-12-14T05:34:31.973323+00:00 heroku[router]: at=info method=GET path=/ host=stormy-brushlands-5162.herokuapp.com fwd="110.10.180.6" dyno=web.1 connect=2ms service=21ms status=304 bytes=0
2013-12-14T06:03:07.658276+00:00 app[web.1]: Started GET "/" for 110.10.180.6 at 2013-12-14 06:03:07 +0000
2013-12-14T06:03:07.658276+00:00 app[web.1]: Started GET "/" for 110.10.180.6 at 2013-12-14 06:03:07 +0000
2013-12-14T06:03:07.693445+00:00 heroku[router]: at=info method=GET path=/ host=stormy-brushlands-5162.herokuapp.com fwd="110.10.180.6" dyno=web.1 connect=4ms service=37ms status=304 bytes=0
2013-12-14T06:03:09.564870+00:00 app[web.1]: Started GET "/" for 110.10.180.6 at 2013-12-14 06:03:09 +0000
2013-12-14T06:03:09.564870+00:00 app[web.1]: Started GET "/" for 110.10.180.6 at 2013-12-14 06:03:09 +0000
2013-12-14T06:03:09.921635+00:00 app[web.1]: Started GET "/" for 110.10.180.6 at 2013-12-14 06:03:09 +0000
2013-12-14T06:03:09.922127+00:00 app[web.1]: Started GET "/" for 110.10.180.6 at 2013-12-14 06:03:09 +0000
2013-12-14T06:03:09.977497+00:00 heroku[router]: at=info method=GET path=/ host=stormy-brushlands-5162.herokuapp.com fwd="110.10.180.6" dyno=web.1 connect=2ms service=64ms status=304 bytes=0
2013-12-14T06:03:10.944650+00:00 app[web.1]: Started DELETE "/users/sign_out" for 110.10.180.6 at 2013-12-14 06:03:10 +0000
2013-12-14T06:03:10.944650+00:00 app[web.1]: Started DELETE "/users/sign_out" for 110.10.180.6 at 2013-12-14 06:03:10 +0000
2013-12-14T06:03:10.978863+00:00 heroku[router]: at=info method=POST path=/users/sign_out host=stormy-brushlands-5162.herokuapp.com fwd="110.10.180.6" dyno=web.1 connect=3ms service=42ms status=302 bytes=110
2013-12-14T06:03:11.314049+00:00 app[web.1]: Started GET "/" for 110.10.180.6 at 2013-12-14 06:03:11 +0000
2013-12-14T06:03:11.316918+00:00 app[web.1]: Started GET "/" for 110.10.180.6 at 2013-12-14 06:03:11 +0000
2013-12-14T06:03:11.358859+00:00 heroku[router]: at=info method=GET path=/ host=stormy-brushlands-5162.herokuapp.com fwd="110.10.180.6" dyno=web.1 connect=8ms service=50ms status=200 bytes=2020
2013-12-14T06:03:18.254935+00:00 heroku[router]: at=info method=GET path=/about host=stormy-brushlands-5162.herokuapp.com fwd="110.10.180.6" dyno=web.1 connect=2ms service=23ms status=200 bytes=1826
2013-12-14T06:03:18.235651+00:00 app[web.1]: Started GET "/about" for 110.10.180.6 at 2013-12-14 06:03:18 +0000
2013-12-14T06:03:18.235651+00:00 app[web.1]: Started GET "/about" for 110.10.180.6 at 2013-12-14 06:03:18 +0000
2013-12-14T06:03:18.522161+00:00 app[web.1]: Started GET "/about" for 110.10.180.6 at 2013-12-14 06:03:18 +0000
2013-12-14T06:03:18.522161+00:00 app[web.1]: Started GET "/about" for 110.10.180.6 at 2013-12-14 06:03:18 +0000
2013-12-14T06:03:18.536227+00:00 heroku[router]: at=info method=GET path=/about host=stormy-brushlands-5162.herokuapp.com fwd="110.10.180.6" dyno=web.1 connect=3ms service=22ms status=304 bytes=0
2013-12-14T06:03:25.709744+00:00 app[web.1]: Started GET "/" for 110.10.180.6 at 2013-12-14 06:03:25 +0000
2013-12-14T06:03:25.709744+00:00 app[web.1]: Started GET "/" for 110.10.180.6 at 2013-12-14 06:03:25 +0000
2013-12-14T06:03:25.739174+00:00 heroku[router]: at=info method=GET path=/ host=stormy-brushlands-5162.herokuapp.com fwd="110.10.180.6" dyno=web.1 connect=2ms service=35ms status=200 bytes=1956
2013-12-14T06:03:26.059051+00:00 app[web.1]: Started GET "/" for 110.10.180.6 at 2013-12-14 06:03:26 +0000
2013-12-14T06:03:26.059137+00:00 app[web.1]: Started GET "/" for 110.10.180.6 at 2013-12-14 06:03:26 +0000
2013-12-14T06:03:26.088548+00:00 heroku[router]: at=info method=GET path=/ host=stormy-brushlands-5162.herokuapp.com fwd="110.10.180.6" dyno=web.1 connect=2ms service=38ms status=304 bytes=0
2013-12-14T06:03:09.585699+00:00 heroku[router]: at=info method=GET path=/ host=stormy-brushlands-5162.herokuapp.com fwd="110.10.180.6" dyno=web.1 connect=2ms service=31ms status=304 bytes=0
我该如何解决这个问题?
Pins_controller.rb:
class PinsController < ApplicationController
before_action :set_pin, only: [:show, :edit, :update, :destroy]
before_action :correct_user, only: [:edit, :update, :destroy]
before_action :authenticate_user!, except: [:index, :show]
def index
@pins = Pin.all.order("created_at DESC").paginate(:page => params[:page], :per_page => 50)
end
def show
end
def new
@pin = current_user.pins.build
end
def edit
end
def create
@pin = current_user.pins.build(pin_params)
if @pin.save
redirect_to @pin, notice: 'Pin was successfully created.'
else
render action: 'new'
end
end
def update
if @pin.update(pin_params)
redirect_to @pin, notice: 'Pin was successfully updated.'
else
render action: 'edit'
end
end
def destroy
@pin.destroy
redirect_to pins_url
end
private
# Use callbacks to share common setup or constraints between actions.
def set_pin
@pin = Pin.find(params[:id])
end
def correct_user
@pin = current_user.pins.find_by(id: params[:id])
redirect_to pins_path, notice: "Not authorized to edit this pin" if @pin.nil?
end
# Never trust parameters from the scary internet, only allow the white list through.
def pin_params
params.require(:pin).permit(:description, :image)
end
end
答案 0 :(得分:0)
错误似乎出现在Pin
模型中。特别是错误
missing required :bucket option
当:bucket
配置的内容为空时,Paperclip会引发。答案中有大量类似的问题,请使用this search来阅读它们。