在Heroku上部署我的应用程序时出现问题

时间:2018-06-11 09:29:11

标签: ruby-on-rails heroku cloudinary

我在heroku上部署了我的网站。我在heroku上的cloudinary_url设置得很好。我正在通过i18n gem为网站添加翻译。以下是我的声明控制器中的newcreate操作:

def new
 @declaration = Declaration.new
end

def create
  @declaration = Declaration.new(declaration_params)
  @declaration.record = Record.where(imei: @declaration.imei).first
  @declaration.type_outage << params[:declaration][:type_outage]

  create_ticket_result = FreshdeskApi.new.manage_declaration(@declaration)

  if create_ticket_result && @declaration.save
    # Les emails sont gérés dans Freshdesk
    # UserMailer.after_declaration_prs(@declaration).deliver_now
    # UserMailer.after_declaration(@declaration).deliver_now
    flash[:notice] = "Vous avez bien déclaré votre panne, Vous recevrez une réponse sous peu."
    redirect_to root_path
  else
    flash[:alert] = "Un problème est survenu..."
    render :new
  end
end

当我尝试访问某个页面时,发生了错误。在我的heroku日志中,这就是我所拥有的:

2018-06-10T19:03:31.771776+00:00 app[web.1]: I, [2018-06-10T19:03:31.771705 #4]  INFO -- : [efb3e575-07c5-481b-a015-30f106c09446] Completed 500 Internal Server Error in 16ms (ActiveRecord: 0.0ms)
2018-06-10T19:03:31.772528+00:00 app[web.1]: F, [2018-06-10T19:03:31.772455 #4] FATAL -- : [efb3e575-07c5-481b-a015-30f106c09446]   
2018-06-10T19:03:31.772595+00:00 app[web.1]: F, [2018-06-10T19:03:31.772524 #4] FATAL -- : [efb3e575-07c5-481b-a015-30f106c09446] ActionView::Template::Error (Must supply cloud_name):
2018-06-10T19:03:31.773068+00:00 app[web.1]: F, [2018-06-10T19:03:31.773001 #4] FATAL -- : [efb3e575-07c5-481b-a015-30f106c09446]     796:                 <div class="title-declaration">Votre facture d'achat</div>
2018-06-10T19:03:31.773070+00:00 app[web.1]: [efb3e575-07c5-481b-a015-30f106c09446]     797:                 <div class="autour-facture">
2018-06-10T19:03:31.773072+00:00 app[web.1]: [efb3e575-07c5-481b-a015-30f106c09446]     798:                   <div class="facture-upload">
2018-06-10T19:03:31.773073+00:00 app[web.1]: [efb3e575-07c5-481b-a015-30f106c09446]     799:                     <%= f.input :facture, as: :attachinary, label: 'IMPORTER VOTRE FACTURE' %>
2018-06-10T19:03:31.773082+00:00 app[web.1]: [efb3e575-07c5-481b-a015-30f106c09446]     800:                     <i class="fa fa-file-pdf-o" aria-hidden="true" style="font-size: 34px;"><span style="font-size: 18px;font-weight: bold;font-family: monospace;display:block">PDF</span></i>
2018-06-10T19:03:31.773084+00:00 app[web.1]: [efb3e575-07c5-481b-a015-30f106c09446]     801: 
2018-06-10T19:03:31.773087+00:00 app[web.1]: [efb3e575-07c5-481b-a015-30f106c09446]     802:                   </div>
2018-06-10T19:03:31.773131+00:00 app[web.1]: F, [2018-06-10T19:03:31.773059 #4] FATAL -- : [efb3e575-07c5-481b-a015-30f106c09446]   
2018-06-10T19:03:31.773207+00:00 app[web.1]: F, [2018-06-10T19:03:31.773139 #4] FATAL -- : [efb3e575-07c5-481b-a015-30f106c09446] app/views/declarations/new.html.erb:799:in `block in _app_views_declarations_new_html_erb___3664345609896457777_69823217213900'
2018-06-10T19:03:31.773209+00:00 app[web.1]: [efb3e575-07c5-481b-a015-30f106c09446] app/views/declarations/new.html.erb:7:in `_app_views_declarations_new_html_erb___3664345609896457777_69823217213900'

我不知道“必须提供cloud name”的来源。

1 个答案:

答案 0 :(得分:0)

我认为您忘了配置CLOUDINARY_URL。请参阅this GitHub comment

在heroku上执行此操作的命令是:

heroku config:add CLOUDINARY_URL=cloudinary://API_KEY:API_SECRET@CLOUD_NAME