为什么我的动作邮件不能与Send Grid一起使用?

时间:2018-03-13 03:52:02

标签: ruby-on-rails

我在发送激活和密码重置电子邮件时遇到问题。我正在构建Michael Hartl的Ruby on Rails教程中的示例应用程序,并且在第12章结束时遇到了这个问题。在部署到Heroku之后(项目名为evening-river-42952),我打开了应用程序并尝试发送密码重置电子邮件给现有用户。

我收到了“我们很抱歉,但出了点问题”的消息。我回到应用程序并决定尝试创建一个新用户,通过电子邮件激活它,并请求为这个新用户重置密码。但只是创建新用户提示相同的“我们很抱歉”,并且我没有收到任何激活链接。

我在检索激活电子邮件之前遇到了问题,但似乎解决了问题(我的发送网格帐户被暂停)。所有似乎都在工作到现在。我为Mailers写的测试正在通过。非常感激任何的帮助! (如果下面的代码不够,我会很乐意上传更多,或者您可以在我的Github帐户上看到整个应用程序。我的用户名是miagenovese,存储库是sample_app。)

Heroku Logs:

    2018-03-13T03:29:18.020071+00:00 app[web.1]: F, [2018-03-13T03:29:18.020008 #6] FATAL -- : [c17c714b-296f-47c6-a37c-171a2e034f9f]   
2018-03-13T03:29:18.019948+00:00 app[web.1]: F, [2018-03-13T03:29:18.019861 #6] FATAL -- : [c17c714b-296f-47c6-a37c-171a2e034f9f]   
2018-03-13T03:29:18.020011+00:00 app[web.1]: F, [2018-03-13T03:29:18.019943 #6] FATAL -- : [c17c714b-296f-47c6-a37c-171a2e034f9f] Net::SMTPAuthenticationError (535 Authentication failed: Bad username / password
2018-03-13T03:29:18.020154+00:00 app[web.1]: [c17c714b-296f-47c6-a37c-171a2e034f9f] app/controllers/password_resets_controller.rb:13:in `create'
2018-03-13T03:29:18.020150+00:00 app[web.1]: F, [2018-03-13T03:29:18.020084 #6] FATAL -- : [c17c714b-296f-47c6-a37c-171a2e034f9f] app/models/user.rb:62:in `send_password_reset_email'
2018-03-13T03:29:18.343417+00:00 heroku[router]: at=info method=GET path="/favicon.ico" host=evening-river-42952.herokuapp.com request_id=2cb0d864-f1c7-431c-9f3c-89d41e3c80dc fwd="73.150.134.10" dyno=web.1 connect=0ms service=3ms status=304 bytes=112 protocol=https
2018-03-13T03:31:58.585281+00:00 app[web.1]: I, [2018-03-13T03:31:58.585170 #10]  INFO -- : [5f6467ba-d886-4dea-bc2f-73098769fbce] Started GET "/login" for 73.150.134.10 at 2018-03-13 03:31:58 +0000
2018-03-13T03:31:58.587401+00:00 app[web.1]: I, [2018-03-13T03:31:58.587322 #10]  INFO -- : [5f6467ba-d886-4dea-bc2f-73098769fbce] Processing by SessionsController#new as HTML
2018-03-13T03:31:58.607376+00:00 app[web.1]: I, [2018-03-13T03:31:58.598227 #10]  INFO -- : [5f6467ba-d886-4dea-bc2f-73098769fbce]   Rendering sessions/new.html.erb within layouts/application
2018-03-13T03:31:58.610770+00:00 app[web.1]: I, [2018-03-13T03:31:58.610685 #10]  INFO -- : [5f6467ba-d886-4dea-bc2f-73098769fbce]   Rendered sessions/new.html.erb within layouts/application (3.2ms)
2018-03-13T03:31:58.611631+00:00 app[web.1]: I, [2018-03-13T03:31:58.611555 #10]  INFO -- : [5f6467ba-d886-4dea-bc2f-73098769fbce]   Rendered layouts/_rails_default.html.erb (0.4ms)
2018-03-13T03:31:58.618597+00:00 app[web.1]: I, [2018-03-13T03:31:58.618518 #10]  INFO -- : [5f6467ba-d886-4dea-bc2f-73098769fbce]   Rendered layouts/_shim.html.erb (0.1ms)
2018-03-13T03:31:58.619556+00:00 app[web.1]: I, [2018-03-13T03:31:58.619484 #10]  INFO -- : [5f6467ba-d886-4dea-bc2f-73098769fbce]   Rendered layouts/_footer.html.erb (0.2ms)
2018-03-13T03:31:58.619151+00:00 app[web.1]: I, [2018-03-13T03:31:58.619076 #10]  INFO -- : [5f6467ba-d886-4dea-bc2f-73098769fbce]   Rendered layouts/_header.html.erb (0.4ms)
2018-03-13T03:31:58.619903+00:00 app[web.1]: I, [2018-03-13T03:31:58.619831 #10]  INFO -- : [5f6467ba-d886-4dea-bc2f-73098769fbce] Completed 200 OK in 32ms (Views: 31.0ms | ActiveRecord: 0.0ms)
2018-03-13T03:31:58.609008+00:00 heroku[router]: at=info method=GET path="/favicon.ico" host=evening-river-42952.herokuapp.com request_id=68b51b65-471f-4925-98d5-ef8d2984d0b8 fwd="73.150.134.10" dyno=web.1 connect=0ms service=26ms status=304 bytes=112 protocol=https
2018-03-13T03:31:58.621851+00:00 heroku[router]: at=info method=GET path="/login" host=evening-river-42952.herokuapp.com request_id=5f6467ba-d886-4dea-bc2f-73098769fbce fwd="73.150.134.10" dyno=web.1 connect=1ms service=41ms status=200 bytes=3496 protocol=https
2018-03-13T03:32:00.178502+00:00 heroku[router]: at=info method=GET path="/signup" host=evening-river-42952.herokuapp.com request_id=037f1a51-f47f-4e8c-bc50-24ab2914ee89 fwd="73.150.134.10" dyno=web.1 connect=1ms service=35ms status=200 bytes=3467 protocol=https
2018-03-13T03:32:00.146526+00:00 app[web.1]: I, [2018-03-13T03:32:00.146397 #10]  INFO -- : [037f1a51-f47f-4e8c-bc50-24ab2914ee89] Started GET "/signup" for 73.150.134.10 at 2018-03-13 03:32:00 +0000
2018-03-13T03:32:00.148605+00:00 app[web.1]: I, [2018-03-13T03:32:00.148530 #10]  INFO -- : [037f1a51-f47f-4e8c-bc50-24ab2914ee89] Processing by UsersController#new as HTML
2018-03-13T03:32:00.151894+00:00 app[web.1]: I, [2018-03-13T03:32:00.151808 #10]  INFO -- : [037f1a51-f47f-4e8c-bc50-24ab2914ee89]   Rendering users/new.html.erb within layouts/application
2018-03-13T03:32:00.156089+00:00 app[web.1]: I, [2018-03-13T03:32:00.156005 #10]  INFO -- : [037f1a51-f47f-4e8c-bc50-24ab2914ee89]   Rendered shared/_error_messages.html.erb (0.7ms)
2018-03-13T03:32:00.162691+00:00 app[web.1]: I, [2018-03-13T03:32:00.162604 #10]  INFO -- : [037f1a51-f47f-4e8c-bc50-24ab2914ee89]   Rendered users/new.html.erb within layouts/application (10.2ms)
2018-03-13T03:32:00.166650+00:00 app[web.1]: I, [2018-03-13T03:32:00.166567 #10]  INFO -- : [037f1a51-f47f-4e8c-bc50-24ab2914ee89]   Rendered layouts/_rails_default.html.erb (0.8ms)
2018-03-13T03:32:00.169949+00:00 app[web.1]: I, [2018-03-13T03:32:00.169877 #10]  INFO -- : [037f1a51-f47f-4e8c-bc50-24ab2914ee 9]   Rendered layouts/_shim.html.erb (0.1ms)
2018-03-13T03:32:00.170622+00:00 app[web.1]: I, [2018-03-13T03:32:00.170554 #10]  INFO -- : [037f1a51-f47f-4e8c-bc50-24ab2914ee89]   Rendered layouts/_header.html.erb (0.4ms)
2018-03-13T03:32:00.171096+00:00 app[web.1]: I, [2018-03-13T03:32:00.171020 #10]  INFO -- : [037f1a51-f47f-4e8c-bc50-24ab2914ee89]   Rendered layouts/_footer.html.erb (0.2ms)
2018-03-13T03:32:00.171664+00:00 app[web.1]: I, [2018-03-13T03:32:00.171596 #10]  INFO -- : [037f1a51-f47f-4e8c-bc50-24ab2914ee89] Completed 200 OK in 23ms (Views: 20.9ms | ActiveRecord: 0.0ms)
2018-03-13T03:32:39.523098+00:00 app[web.1]: I, [2018-03-13T03:32:39.523005 #10]  INFO -- : [553c4cce-7ab5-40cd-bb49-dc2ea6df6474] Started POST "/signup" for 73.150.134.10 at 2018-03-13 03:32:39 +0000
2018-03-13T03:32:39.524750+00:00 app[web.1]: I, [2018-03-13T03:32:39.524674 #10]  INFO -- : [553c4cce-7ab5-40cd-bb49-dc2ea6df6474] Processing by UsersController#create as HTML
2018-03-13T03:32:39.524925+00:00 app[web.1]: I, [2018-03-13T03:32:39.524848 #10]  INFO -- : [553c4cce-7ab5-40cd-bb49-dc2ea6df6474]   Parameters: {"utf8"=>"✓", "authenticity_token"=>"sAEWjc4ImCrdeYQDxWNWe33bd4m307CnsksScmBk3y8D92mfnSI4SBArNK9z68ScUNkU7lGjm8aaDegEeeimww==", "user"=>{"name"=>"Test User 1", "email"=>"hahyl@amail.club", "password"=>"[FILTERED]", "password_confirmation"=>"[FILTERED]"}, "commit"=>"Create my account"}
2018-03-13T03:32:39.608278+00:00 app[web.1]: D, [2018-03-13T03:32:39.608157 #10] DEBUG -- : [553c4cce-7ab5-40cd-bb49-dc2ea6df6474]    (0.7ms)  BEGIN
2018-03-13T03:32:39.617490+00:00 app[web.1]: D, [2018-03-13T03:32:39.617407 #10] DEBUG -- : [553c4cce-7ab5-40cd-bb49-dc2ea6df6474]   User Exists (1.1ms)  SELECT  1 AS one FROM "users" WHERE LOWER("users"."email") = LOWER($1) LIMIT $2  [["email", "hahyl@amail.club"], ["LIMIT", 1]]
2018-03-13T03:32:39.694966+00:00 app[web.1]: D, [2018-03-13T03:32:39.694851 #10] DEBUG -- : [553c4cce-7ab5-40cd-bb49-dc2ea6df6474]   SQL (1.2ms)  INSERT INTO "users" ("name", "email", "created_at", "updated_at", "password_digest", "activation_digest") VALUES ($1, $2, $3, $4, $5, $6) RETURNING "id"  [["name", "Test User 1"], ["email", "hahyl@amail.club"], ["created_at", "2018-03-13 03:32:39.618143"], ["updated_at", "2018-03-13 03:32:39.618143"], ["password_digest", "$2a$10$uvnZX.vljrrfSRgMwAb.duzmBy4aPb2040xaytFtX5yIDh7CVMNl."], ["activation_digest", "$2a$10$iendy286HJWAwtXH4zR5Oelj7zTdoXqOz/R117CAVF7.W6CNHzmY6"]]
2018-03-13T03:32:39.697133+00:00 app[web.1]: D, [2018-03-13T03:32:39.697061 #10] DEBUG -- : [553c4cce-7ab5-40cd-bb49-dc2ea6df6474]    (1.7ms)  COMMIT
2018-03-13T03:32:39.701977+00:00 app[web.1]: I, [2018-03-13T03:32:39.701892 #10]  INFO -- : [553c4cce-7ab5-40cd-bb49-dc2ea6df6474]   Rendering user_mailer/account_activation.html.erb within layouts/mailer
2018-03-13T03:32:39.702840+00:00 app[web.1]: I, [2018-03-13T03:32:39.702771 #10]  INFO -- : [553c4cce-7ab5-40cd-bb49-dc2ea6df6474]   Rendered user_mailer/account_activation.html.erb within layouts/mailer (0.8ms)
2018-03-13T03:32:39.703175+00:00 app[web.1]: I, [2018-03-13T03:32:39.703108 #10]  INFO -- : [553c4cce-7ab5-40cd-bb49-dc2ea6df6474]   Rendering user_mailer/account_activation.text.erb within layouts/mailer
2018-03-13T03:32:39.703796+00:00 app[web.1]: I, [2018-03-13T03:32:39.703718 #10]  INFO -- : [553c4cce-7ab5-40cd-bb49-dc2ea6df6474]   Rendered user_mailer/account_activation.text.erb within layouts/mailer (0.5ms)
2018-03-13T03:32:39.705612+00:00 app[web.1]: D, [2018-03-13T03:32:39.705491 #10] DEBUG -- : [553c4cce-7ab5-40cd-bb49-dc2ea6df6474] UserMailer#account_activation: processed outbound mail in 8.0ms
2018-03-13T03:32:39.931964+00:00 heroku[router]: at=info method=POST path="/signup" host=evening-river-42952.herokuapp.com request_id=553c4cce-7ab5-40cd-bb49-dc2ea6df6474 fwd="73.150.134.10" dyno=web.1 connect=0ms service=410ms status=500 bytes=1891 protocol=https
2018-03-13T03:32:39.928767+00:00 app[web.1]: I, [2018-03-13T03:32:39.928624 #10]  INFO -- : [553c4cce-7ab5-40cd-bb49-dc2ea6df6474] Sent mail to hahyl@amail.club (222.9ms)
2018-03-13T03:32:39.928844+00:00 app[web.1]: D, [2018-03-13T03:32:39.928758 #10] DEBUG -- : [553c4cce-7ab5-40cd-bb49-dc2ea6df6474] Date: Tue, 13 Mar 2018 03:32:39 +0000
2018-03-13T03:32:39.928847+00:00 app[web.1]: From: noreply@example.com
2018-03-13T03:32:39.928849+00:00 app[web.1]: To: hahyl@amail.club
2018-03-13T03:32:39.928851+00:00 app[web.1]: Message-ID: <5aa74657aca91_a3169f4c629a4@16b93889-b671-4421-8086-dbf03b7786ca.mail>
2018-03-13T03:32:39.928852+00:00 app[web.1]: Subject: Account activation
2018-03-13T03:32:39.928854+00:00 app[web.1]: Mime-Version: 1.0
2018-03-13T03:32:39.928856+00:00 app[web.1]: Content-Type: multipart/alternative;
2018-03-13T03:32:39.928861+00:00 app[web.1]:  boundary="--==_mimepart_5aa74657abf4b_a3169f4c62848";
2018-03-13T03:32:39.928863+00:00 app[web.1]:  charset=UTF-8
2018-03-13T03:32:39.928865+00:00 app[web.1]: Content-Transfer-Encoding: 7bit
2018-03-13T03:32:39.928866+00:00 app[web.1]: 
2018-03-13T03:32:39.928867+00:00 app[web.1]: 
2018-03-13T03:32:39.928869+00:00 app[web.1]: ----==_mimepart_5aa74657abf4b_a3169f4c62848
2018-03-13T03:32:39.928870+00:00 app[web.1]: Content-Type: text/plain;
2018-03-13T03:32:39.928872+00:00 app[web.1]:  charset=UTF-8
2018-03-13T03:32:39.928873+00:00 app[web.1]: Content-Transfer-Encoding: 7bit
2018-03-13T03:32:39.928875+00:00 app[web.1]: 
2018-03-13T03:32:39.928876+00:00 app[web.1]: Hi Test User 1,
2018-03-13T03:32:39.928878+00:00 app[web.1]: 
2018-03-13T03:32:39.928880+00:00 app[web.1]: Welcome to Micro App! Click on the link below to activate your account:
2018-03-13T03:32:39.928881+00:00 app[web.1]: 
2018-03-13T03:32:39.928883+00:00 app[web.1]: https://evening-river-42952.herokuapp.com/account_activations/Nexyvh0nacOqftjJA_Koog/edit?email=hahyl%40amail.club
2018-03-13T03:32:39.928884+00:00 app[web.1]: 
2018-03-13T03:32:39.928886+00:00 app[web.1]: ----==_mimepart_5aa74657abf4b_a3169f4c62848
2018-03-13T03:32:39.928887+00:00 app[web.1]: Content-Type: text/html;
2018-03-13T03:32:39.928889+00:00 app[web.1]:  charset=UTF-8
2018-03-13T03:32:39.928891+00:00 app[web.1]: Content-Transfer-Encoding: 7bit
2018-03-13T03:32:39.928892+00:00 app[web.1]: 
2018-03-13T03:32:39.928894+00:00 app[web.1]: <!DOCTYPE html>
2018-03-13T03:32:39.928896+00:00 app[web.1]: <html>
2018-03-13T03:32:39.928897+00:00 app[web.1]:   <head>
2018-03-13T03:32:39.928899+00:00 app[web.1]:     <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
2018-03-13T03:32:39.928900+00:00 app[web.1]:     <style>
2018-03-13T03:32:39.928902+00:00 app[web.1]:       /* Email styles need to be inline */
2018-03-13T03:32:39.928903+00:00 app[web.1]:     </style>
2018-03-13T03:32:39.928905+00:00 app[web.1]:   </head>
2018-03-13T03:32:39.928906+00:00 app[web.1]: 
2018-03-13T03:32:39.928908+00:00 app[web.1]:   <body>
2018-03-13T03:32:39.928909+00:00 app[web.1]:     <h1>Micro App</h1>
2018-03-13T03:32:39.928911+00:00 app[web.1]: 
2018-03-13T03:32:39.928913+00:00 app[web.1]: <p>Hi Test User 1,</p>
2018-03-13T03:32:39.928914+00:00 app[web.1]: 
2018-03-13T03:32:39.928916+00:00 app[web.1]: <p>
2018-03-13T03:32:39.928917+00:00 app[web.1]:   Welcome to the Sample App! Click on the link below to activate your account:
2018-03-13T03:32:39.928919+00:00 app[web.1]: </p>
2018-03-13T03:32:39.928920+00:00 app[web.1]: 
2018-03-13T03:32:39.928923+00:00 app[web.1]: <a href="https://evening-river-42952.herokuapp.com/account_activations/Nexyvh0nacOqftjJA_Koog/edit?email=hahyl%40amail.club">Activate</a>
2018-03-13T03:32:39.928924+00:00 app[web.1]:   </body>
2018-03-13T03:32:39.928926+00:00 app[web.1]: </html>
2018-03-13T03:32:39.928927+00:00 app[web.1]: 
2018-03-13T03:32:39.928929+00:00 app[web.1]: ----==_mimepart_5aa74657abf4b_a3169f4c62848--
2018-03-13T03:32:39.928930+00:00 app[web.1]: 
2018-03-13T03:32:39.929177+00:00 app[web.1]: I, [2018-03-13T03:32:39.929098 #10]  INFO -- : [553c4cce-7ab5-40cd-bb49-dc2ea6df6474] Completed 500 Internal Server Error in 404ms (ActiveRecord: 6.5ms)
2018-03-13T03:32:39.930227+00:00 app[web.1]: F, [2018-03-13T03:32:39.930146 #10] FATAL -- : [553c4cce-7ab5-40cd-bb49-dc2ea6df6474]   
2018-03-13T03:32:39.930301+00:00 app[web.1]: F, [2018-03-13T03:32:39.930234 #10] FATAL -- : [553c4cce-7ab5-40cd-bb49-dc2ea6df6474] Net::SMTPAuthenticationError (535 Authentication failed: Bad username / password
2018-03-13T03:32:39.930303+00:00 app[web.1]: ):
2018-03-13T03:32:39.930390+00:00 app[web.1]: F, [2018-03-13T03:32:39.930329 #10] FATAL -- : [553c4cce-7ab5-40cd-bb49-dc2ea6df6474]   
2018-03-13T03:32:39.930482+00:00 app[web.1]: F, [2018-03-13T03:32:39.930423 #10] FATAL -- : [553c4cce-7ab5-40cd-bb49-dc2ea6df6474] app/models/user.rb:50:in `send_activation_email'
2018-03-13T03:32:39.930485+00:00 app[web.1]: [553c4cce-7ab5-40cd-bb49-dc2ea6df6474] app/controllers/users_controller.rb:21:in `create'

Production.rb

   Rails.application.configure do
      # Settings specified here will take precedence over those in config/application.rb.

      # Code is not reloaded between requests.
      config.cache_classes = true

      # Eager load code on boot. This eager loads most of Rails and
      # your application in memory, allowing both threaded web servers
      # and those relying on copy on write to perform better.
      # Rake tasks automatically ignore this option for performance.
      config.eager_load = true

      # Full error reports are disabled and caching is turned on.
      config.consider_all_requests_local       = false
      config.action_controller.perform_caching = true

      # Attempt to read encrypted secrets from `config/secrets.yml.enc`.
      # Requires an encryption key in `ENV["RAILS_MASTER_KEY"]` or
      # `config/secrets.yml.key`.
      config.read_encrypted_secrets = true

      # Disable serving static files from the `/public` folder by default since
      # Apache or NGINX already handles this.
      config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present?

      # Compress JavaScripts and CSS.
      config.assets.js_compressor = :uglifier
      # config.assets.css_compressor = :sass

      # Do not fallback to assets pipeline if a precompiled asset is missed.
      config.assets.compile = false

      # `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb

      # Enable serving of images, stylesheets, and JavaScripts from an asset server.
      # config.action_controller.asset_host = 'http://assets.example.com'

      # Specifies the header that your server uses for sending files.
      # config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache
      # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX

      # Mount Action Cable outside main process or domain
      # config.action_cable.mount_path = nil
      # config.action_cable.url = 'wss://example.com/cable'
      # config.action_cable.allowed_request_origins = [ 'http://example.com', /http:\/\/example.*/ ]

      # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
      config.force_ssl = true

      # Use the lowest log level to ensure availability of diagnostic information
      # when problems arise.
      config.log_level = :debug

      # Prepend all log lines with the following tags.
      config.log_tags = [ :request_id ]

      # Use a different cache store in production.
      # config.cache_store = :mem_cache_store

      # Use a real queuing backend for Active Job (and separate queues per environment)
      # config.active_job.queue_adapter     = :resque
      # config.active_job.queue_name_prefix = "sample_app_#{Rails.env}"
      config.action_mailer.perform_caching = false

      # Ignore bad email addresses and do not raise email delivery errors.
      # Set this to true and configure the email server for immediate delivery to raise delivery errors.
      config.action_mailer.raise_delivery_errors = true
      config.action_mailer.delivery_method = :smtp
      host = 'https://evening-river-42952.herokuapp.com'
      config.action_mailer.default_url_options = { host: host }
      ActionMailer::Base.smtp_settings = {
        :address        => 'smtp.sendgrid.net',
        :port           => '587',
        :authentication => :plain,
        :user_name      => ENV['SENDGRID_USERNAME'],
        :password       => ENV['SENDGRID_PASSWORD'],
        :domain         => 'heroku.com',
        :enable_starttls_auto => true
      }

      # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
      # the I18n.default_locale when a translation cannot be found).
      config.i18n.fallbacks = true

      # Send deprecation notices to registered listeners.
      config.active_support.deprecation = :notify

      # Use default logging formatter so that PID and timestamp are not suppressed.
      config.log_formatter = ::Logger::Formatter.new

      # Use a different logger for distributed setups.
      # require 'syslog/logger'
      # config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new 'app-name')

      if ENV["RAILS_LOG_TO_STDOUT"].present?
        logger           = ActiveSupport::Logger.new(STDOUT)
        logger.formatter = config.log_formatter
        config.logger    = ActiveSupport::TaggedLogging.new(logger)
      end

      # Do not dump schema after migrations.
      config.active_record.dump_schema_after_migration = false
  end

Development.rb

Rails.application.configure do
  # Settings specified here will take precedence over those in config/application.rb.

  # In the development environment your application's code is reloaded on
  # every request. This slows down response time but is perfect for development
  # since you don't have to restart the web server when you make code changes.
  config.cache_classes = false

  # Do not eager load code on boot.
  config.eager_load = false

  # Show full error reports.
  config.consider_all_requests_local = true

  # Enable/disable caching. By default caching is disabled.
  if Rails.root.join('tmp/caching-dev.txt').exist?
    config.action_controller.perform_caching = true

    config.cache_store = :memory_store
    config.public_file_server.headers = {
      'Cache-Control' => "public, max-age=#{2.days.seconds.to_i}"
    }
  else
    config.action_controller.perform_caching = false

    config.cache_store = :null_store
  end

  # Do care if the mailer can't send.
  config.action_mailer.raise_delivery_errors = true
  config.action_mailer.delivery_method = :test
  host = 'http://sample_app-c9-miagenovese.c9users.io'
  config.action_mailer.default_url_options = { host: host, protocol: 'https' }

  config.action_mailer.perform_caching = false

  # Print deprecation notices to the Rails logger.
  config.active_support.deprecation = :log

  # Raise an error on page load if there are pending migrations.
  config.active_record.migration_error = :page_load

  # Debug mode disables concatenation and preprocessing of assets.
  # This option may cause significant delays in view rendering with a large
  # number of complex assets.
  config.assets.debug = false

  # Suppress logger output for asset requests.
  config.assets.quiet = true

  # Raises error for missing translations
  # config.action_view.raise_on_missing_translations = true

  # Use an evented file watcher to asynchronously detect changes in source code,
  # routes, locales, etc. This feature depends on the listen gem.
  config.file_watcher = ActiveSupport::EventedFileUpdateChecker
end

0 个答案:

没有答案
相关问题