質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.48%
Ruby on Rails

Ruby on Railsは、オープンソースのWebアプリケーションフレームワークです。「同じことを繰り返さない」というRailsの基本理念のもと、他のフレームワークより少ないコードで簡単に開発できるよう設計されています。

Q&A

解決済

1回答

1653閲覧

【Railsチュートリアル】11章 herokuへのpush時のエラー

ink88882

総合スコア24

Ruby on Rails

Ruby on Railsは、オープンソースのWebアプリケーションフレームワークです。「同じことを繰り返さない」というRailsの基本理念のもと、他のフレームワークより少ないコードで簡単に開発できるよう設計されています。

0グッド

0クリップ

投稿2018/09/23 04:30

https://railstutorial.jp/chapters/account_activation?version=5.1#code-sendgrid_config

上記ページの
「11.4 本番環境でのメール送信」にて、push heroku時に

$ rails test
$ git push
$ git push heroku
$ heroku run rails db:migrate

上記処理を行いましたが、下記のエラーが出てしまいます。


(略)

remote:
remote: !
remote: ! Precompiling assets failed.
remote: !
remote: ! Push rejected, failed to compile Ruby app.
remote:
remote: ! Push failed
remote: Verifying deploy...
remote:
remote: ! Push rejected to guarded-scrubland-60168.
remote:
To https://git.heroku.com/(自分のアプリURLです).git
! [remote rejected] master -> master (pre-receive hook declined)


色々ファイルの編集を試して、git push heroku masterのコマンドのみ、そのまま繰り返したりもしましたがうまくいきませんでしたのでファイルは戻しました。
(gitの扱い方も理解が浅く、これも良くなかったりしたら教えていただけると幸いです。)

ちなみに、同じ項目内の、直前に編集をした「config/environments/production.rb」の中身は下記の通りです。

ruby

1 2Rails.application.configure do 3 # Settings specified here will take precedence over those in config/application.rb. 4 5 # Code is not reloaded between requests. 6 config.cache_classes = true 7 8 # Eager load code on boot. This eager loads most of Rails and 9 # your application in memory, allowing both threaded web servers 10 # and those relying on copy on write to perform better. 11 # Rake tasks automatically ignore this option for performance. 12 config.eager_load = true 13 14 # Full error reports are disabled and caching is turned on. 15 config.consider_all_requests_local = false 16 config.action_controller.perform_caching = true 17 18 # Attempt to read encrypted secrets from `config/secrets.yml.enc`. 19 # Requires an encryption key in `ENV["RAILS_MASTER_KEY"]` or 20 # `config/secrets.yml.key`. 21 config.read_encrypted_secrets = true 22 23 # Disable serving static files from the `/public` folder by default since 24 # Apache or NGINX already handles this. 25 config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present? 26 27 # Compress JavaScripts and CSS. 28 config.assets.js_compressor = :uglifier 29 # config.assets.css_compressor = :sass 30 31 # Do not fallback to assets pipeline if a precompiled asset is missed. 32 config.assets.compile = false 33 34 # `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb 35 36 # Enable serving of images, stylesheets, and JavaScripts from an asset server. 37 # config.action_controller.asset_host = 'http://assets.example.com' 38 39 # Specifies the header that your server uses for sending files. 40 # config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache 41 # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX 42 43 # Mount Action Cable outside main process or domain 44 # config.action_cable.mount_path = nil 45 # config.action_cable.url = 'wss://example.com/cable' 46 # config.action_cable.allowed_request_origins = [ 'http://example.com', /http://example.*/ ] 47 48 # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies. 49 config.force_ssl = true 50 51 # Use the lowest log level to ensure availability of diagnostic information 52 # when problems arise. 53 config.log_level = :debug 54 55 # Prepend all log lines with the following tags. 56 config.log_tags = [ :request_id ] 57 58 # Use a different cache store in production. 59 # config.cache_store = :mem_cache_store 60 61 # Use a real queuing backend for Active Job (and separate queues per environment) 62 # config.active_job.queue_adapter = :resque 63 # config.active_job.queue_name_prefix = "sample_app_#{Rails.env}" 64 config.action_mailer.perform_caching = false 65 66 # Ignore bad email addresses and do not raise email delivery errors. 67 # Set this to true and configure the email server for immediate delivery to raise delivery errors. 68 # config.action_mailer.raise_delivery_errors = false 69 70 config.action_mailer.raise_delivery_errors = true 71 config.action_mailer.delivery_method = :smtp 72 host = 'https://アプリのurl.herokuapp.com' 73 config.action_mailer.default_url_options = { host: host } 74 ActionMailer::Base.smtp_settings = { 75 :address => 'smtp.sendgrid.net', 76 :port => '587', 77 :authentication => :plain, 78 :user_name => ENV['app104762945@heroku.com'], 79 :password => ENV['2aipejia2101'], 80 :domain => 'heroku.com', 81 :enable_starttls_auto => true 82 } 83 84 85 86 # Enable locale fallbacks for I18n (makes lookups for any locale fall back to 87 # the I18n.default_locale when a translation cannot be found). 88 config.i18n.fallbacks = true 89 90 # Send deprecation notices to registered listeners. 91 config.active_support.deprecation = :notify 92 93 # Use default logging formatter so that PID and timestamp are not suppressed. 94 config.log_formatter = ::Logger::Formatter.new 95 96 # Use a different logger for distributed setups. 97 # require 'syslog/logger' 98 # config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new 'app-name') 99 100 if ENV["RAILS_LOG_TO_STDOUT"].present? 101 logger = ActiveSupport::Logger.new(STDOUT) 102 logger.formatter = config.log_formatter 103 config.logger = ActiveSupport::TaggedLogging.new(logger) 104 end 105 106 # Do not dump schema after migrations. 107 config.active_record.dump_schema_after_migration = false 108end 109 110

何か思い当たる点、足りない情報などあれば教えていただけますと幸いです。
よろしくお願いいたします。

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

guest

回答1

0

自己解決

自己解決しました。
理由は不明ですが、11章を最初から見直してみました。
おそらくgitのやり方も間違っていた可能性がありそうです。
書かれている通りにgitの操作もやりなおしました。

投稿2018/09/23 19:05

ink88882

総合スコア24

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.48%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問