2

В девелопменте все работает нормально. При деплое на Хероку все тоже работает нормально - кроме страницы shipments/new (форма создания Shipment) - на ней Хероку выдает заглушку "We're sorry, but something went wrong." Assets precompile уже пробовал. При выполнении "heroku run rake db:migrate" выдает следующее:

Running rake db:migrate on guarded-citadel-14552... up, run.9678
  ActiveRecord::SchemaMigration Load (0.7ms)  SELECT "schema_migrations".* FROM "schema_migrations"
  ActiveRecord::SchemaMigration Load (0.5ms)  SELECT "schema_migrations".* FROM "schema_migrations"
   (2.9ms)  SELECT t2.oid::regclass::text AS to_table, a1.attname AS column, a2.attname AS primary_key, c.conname AS name, c.confupdtype AS on_update, c.confdeltype AS on_delete
FROM pg_constraint c
JOIN pg_class t1 ON c.conrelid = t1.oid
JOIN pg_class t2 ON c.confrelid = t2.oid
JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
JOIN pg_namespace t3 ON c.connamespace = t3.oid
WHERE c.contype = 'f'
  AND t1.relname = 'expectations'
  AND t3.nspname = ANY (current_schemas(false))
ORDER BY c.conname

   (2.4ms)  SELECT t2.oid::regclass::text AS to_table, a1.attname AS column, a2.attname AS primary_key, c.conname AS name, c.confupdtype AS on_update, c.confdeltype AS on_delete
FROM pg_constraint c
JOIN pg_class t1 ON c.conrelid = t1.oid
JOIN pg_class t2 ON c.confrelid = t2.oid
JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
JOIN pg_namespace t3 ON c.connamespace = t3.oid
WHERE c.contype = 'f'
  AND t1.relname = 'friendships'
  AND t3.nspname = ANY (current_schemas(false))
ORDER BY c.conname

   (2.5ms)  SELECT t2.oid::regclass::text AS to_table, a1.attname AS column, a2.attname AS primary_key, c.conname AS name, c.confupdtype AS on_update, c.confdeltype AS on_delete
FROM pg_constraint c
JOIN pg_class t1 ON c.conrelid = t1.oid
JOIN pg_class t2 ON c.confrelid = t2.oid
JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
JOIN pg_namespace t3 ON c.connamespace = t3.oid
WHERE c.contype = 'f'
  AND t1.relname = 'shipment_expectations'
  AND t3.nspname = ANY (current_schemas(false))
ORDER BY c.conname

   (2.7ms)  SELECT t2.oid::regclass::text AS to_table, a1.attname AS column, a2.attname AS primary_key, c.conname AS name, c.confupdtype AS on_update, c.confdeltype AS on_delete
FROM pg_constraint c
JOIN pg_class t1 ON c.conrelid = t1.oid
JOIN pg_class t2 ON c.confrelid = t2.oid
JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
JOIN pg_namespace t3 ON c.connamespace = t3.oid
WHERE c.contype = 'f'
  AND t1.relname = 'shipments'
  AND t3.nspname = ANY (current_schemas(false))
ORDER BY c.conname

   (2.4ms)  SELECT t2.oid::regclass::text AS to_table, a1.attname AS column, a2.attname AS primary_key, c.conname AS name, c.confupdtype AS on_update, c.confdeltype AS on_delete
FROM pg_constraint c
JOIN pg_class t1 ON c.conrelid = t1.oid
JOIN pg_class t2 ON c.confrelid = t2.oid
JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
JOIN pg_namespace t3 ON c.connamespace = t3.oid
WHERE c.contype = 'f'
  AND t1.relname = 'users'
  AND t3.nspname = ANY (current_schemas(false))
ORDER BY c.conname

Деплой:

Counting objects: 5, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (2/2), 253 bytes | 0 bytes/s, done.
Total 2 (delta 1), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote: 
remote: -----> Using set buildpack heroku/ruby
remote: -----> Ruby app detected
remote: -----> Compiling Ruby/Rails
remote: -----> Using Ruby version: ruby-2.2.4
remote: -----> Installing dependencies using bundler 1.11.2
remote:        Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin -j4 --deployment
remote:        Using i18n 0.7.0
remote:        Using json 1.8.3
remote:        Using minitest 5.8.4
remote:        Using thread_safe 0.3.5
remote:        Using builder 3.2.2
remote:        Using erubis 2.7.0
remote:        Using CFPropertyList 2.3.2
remote:        Using rake 11.1.2
remote:        Using mini_portile2 2.0.0
remote:        Using rack 1.6.4
remote:        Using mime-types-data 3.2016.0221
remote:        Using arel 6.0.3
remote:        Using bcrypt 3.1.7
remote:        Using coffee-script-source 1.10.0
remote:        Using execjs 2.6.0
remote:        Using thor 0.19.1
remote:        Using concurrent-ruby 1.0.1
remote:        Using orm_adapter 0.5.0
remote:        Using excon 0.49.0
remote:        Using formatador 0.2.5
remote:        Using multi_json 1.11.2
remote:        Using ipaddress 0.8.3
remote:        Using xml-simple 1.1.5
remote:        Using inflecto 0.0.2
remote:        Using sass 3.4.22
remote:        Using tilt 1.4.1
remote:        Using mimemagic 0.3.0
remote:        Using subexec 0.2.3
remote:        Using pg 0.17.1
remote:        Using bundler 1.11.2
remote:        Using rails_serve_static_assets 0.0.5
remote:        Using rails_stdout_logging 0.0.5
remote:        Using faker 1.4.2
remote:        Using rdoc 4.2.2
remote:        Using tzinfo 1.2.2
remote:        Using fission 0.5.0
remote:        Using nokogiri 1.6.7.2
remote:        Using mime-types 3.0
remote:        Using rack-test 0.6.3
remote:        Using warden 1.2.6
remote:        Using puma 2.11.1
remote:        Using sprockets 3.6.0
remote:        Using fog-core 1.37.0
remote:        Using uglifier 2.5.3
remote:        Using coffee-script 2.4.1
remote:        Using mini_magick 3.8.0
remote:        Using rails_12factor 0.0.2
remote:        Using activesupport 4.2.2
remote:        Using sdoc 0.4.0
remote:        Using mail 2.6.4
remote:        Using loofah 2.0.3
remote:        Using fog-json 1.0.2
remote:        Using fog-xml 0.1.2
remote:        Using fog-local 0.3.0
remote:        Using fog-vmfusion 0.1.0
remote:        Using rails-deprecated_sanitizer 1.0.3
remote:        Using globalid 0.3.6
remote:        Using activemodel 4.2.2
remote:        Using climate_control 0.0.3
remote:        Using jbuilder 2.2.3
remote:        Using rails-html-sanitizer 1.0.3
remote:        Using fog-aliyun 0.1.0
remote:        Using fog-brightbox 0.10.1
remote:        Using fog-sakuracloud 1.7.5
remote:        Using fog-serverlove 0.1.2
remote:        Using fog-softlayer 1.1.0
remote:        Using fog-storm_on_demand 0.1.1
remote:        Using fog-atmos 0.1.0
remote:        Using fog-aws 0.9.2
remote:        Using fog-dynect 0.0.3
remote:        Using fog-ecloud 0.3.0
remote:        Using fog-google 0.1.0
remote:        Using fog-powerdns 0.1.1
remote:        Using fog-profitbricks 0.0.5
remote:        Using fog-radosgw 0.0.5
remote:        Using fog-riakcs 0.1.0
remote:        Using fog-terremark 0.1.0
remote:        Using fog-voxel 0.1.0
remote:        Using fog-xenserver 0.2.3
remote:        Using rails-dom-testing 1.0.7
remote:        Using activejob 4.2.2
remote:        Using activerecord 4.2.2
remote:        Using carrierwave 0.10.0
remote:        Using cocaine 0.5.8
remote:        Using actionview 4.2.2
remote:        Using paperclip 4.3.6
remote:        Using fog 1.36.0
remote:        Using actionpack 4.2.2
remote:        Using actionmailer 4.2.2
remote:        Using railties 4.2.2
remote:        Using sprockets-rails 3.0.4
remote:        Using coffee-rails 4.1.0
remote:        Using responders 2.1.2
remote:        Using jquery-rails 4.0.3
remote:        Using sass-rails 5.0.2
remote:        Using rails 4.2.2
remote:        Using turbolinks 2.3.0
remote:        Using devise 3.5.6
remote:        Using foundation-icons-sass-rails 3.0.0
remote:        Bundle complete! 27 Gemfile dependencies, 99 gems now installed.
remote:        Gems in the groups development and test were not installed.
remote:        Bundled gems are installed into ./vendor/bundle.
remote:        Bundle completed (0.56s)
remote:        Cleaning up the bundler cache.
remote:        Detected manifest file, assuming assets were compiled locally
remote: 
remote: ###### WARNING:
remote:        You have not declared a Ruby version in your Gemfile.
remote:        To set your Ruby version add this line to your Gemfile:
remote:        ruby '2.2.4'
remote:        # See https://devcenter.heroku.com/articles/ruby-versions for more information.
remote: 
remote: 
remote: -----> Discovering process types
remote:        Procfile declares types     -> web
remote:        Default types for buildpack -> console, rake, worker
remote: 
remote: -----> Compressing...
remote:        Done: 53.4M
remote: -----> Launching...
remote:        Released v20
remote:        https://guarded-citadel-14552.herokuapp.com/ deployed to Heroku
remote: 
remote: Verifying deploy... done.
To https://git.heroku.com/guarded-citadel-14552.git
   292c771..2be75f3  master -> master

Модель Shipment:

class Shipment < ActiveRecord::Base
  belongs_to :user
  belongs_to :friendship

  has_many :shipment_expectations
  has_many :expectations, through: :shipment_expectations

  validates :image, presence: true
  validates :user_id, presence: true

  has_attached_file :image, styles: { small: "200x333>", medium: "900x1500>" }
  validates_attachment_content_type :image, content_type: /\Aimage\/.*\Z/

  enum days: {"3": 3, "7": 7, "14": 14, 
                                              "30": 30}
end

Форма Shipment которую не показывает:

<%= form_for(@shipment, html: { multipart: true }) do |f| %>

      <% if @shipment.errors.any? %>
        <div class="alert callout">
          <h3>Запрос не был отправлен из за следующих ошибок:</h3>
          <ul>
          <% @shipment.errors.full_messages.each do |message| %>
            <li><%= message %></li>
          <% end %>
          </ul>
        </div>
      <% end %>

      <div class="row">
        <div class="7u 12u$(xsmall)">
            <small>
              Добавьте фотографию пересылаемого предмета.
            </small>
            <br/>
            <%= f.file_field :image, id: "FileUpload", class: "show-for-sr" %>
        </div>

        <div class="7u 12u$(xsmall)" style="padding-top: 25px;">
          <small>
            Выбрите получателя из списка друзей или заполните данные вручную.
            ( <%= link_to "Добавить друга?", my_friends_path %> )
          </small>
                    <div class="select-wrapper">
                        <%= f.select :friend_id, user.friendships.map{ |friendship| 
                         [friendship.friend.name, friendship.id] }, 
                         prompt: "Выберите получателя из списка друзей" %>
                    </div>
          <%= f.text_field :name, placeholder: "Фамилия Имя Отчество" %>
          <%= f.text_field :adress, placeholder: "Почтовый адрес получателя" %>
          <div class="select-wrapper">
            <%= f.select :days, Shipment.days.keys, 
                                prompt: "Выберите срок доставки" %>
          </div>
        </div>

            <div class="7u 12u$(xsmall)" style="padding-top: 30px;">
          <%= f.submit "Готово!", class: "button special2" %>
        </div>
      </div>
    <% end %>

В чем может быть проблема?

4
  • Смотрите логи после запроса.
    – user181100
    18 апр 2016 в 16:28
  • А где они находятся?
    – lif3ar
    18 апр 2016 в 17:22
  • 1
    За heroku logs.
    – user181100
    18 апр 2016 в 17:22
  • Спасибо, помогло - ляп был связан с ассоциациями.
    – lif3ar
    19 апр 2016 в 18:35

1 ответ 1

2

Запусти в терминале

heroku logs --tail

Отображение логов realtime.

Ваш ответ

By clicking “Отправить ответ”, you agree to our terms of service and acknowledge you have read our privacy policy.

Всё ещё ищете ответ? Посмотрите другие вопросы с метками или задайте свой вопрос.