I am unable to load a Rails 5 app on Heroku due to the following as per Heroku
ActionView::Template::Error (undefined methodfind_asset' for nil:NilClass)
I am using a theme called Inspinia
I believe I have located the code that is causing the issue, the theme precompiles the assets and when in production heroku is having issues and produces errors. I can't find any clear solution to this issue, heroku won't be able to assist me any further and suggested Stack and not sure there is another way to get the desired effects on the app. I tried remove the find_assets method and it works locally, but causes an H10 error on heroku.
application.html.erb
<!DOCTYPE html>
<html>
<head>
<title>Get Leased Up!</title>
<%= csrf_meta_tags %>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- Include style per-controller - vendor plugins -->
<!-- this is where the error comes from -->
<%= stylesheet_link_tag params[:controller] if ::Rails.application.assets.find_asset("#{params[:controller]}.css") %>
<!-- Main css styles -->
<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %>
<!-- Main javascript files -->
<%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
</head>
<body>
...
</body>
assets.rb
Rails.application.config.assets.precompile += %w{ ... }
heroku message and logs
Thanks for reaching out. A 200 status response indicates the request has succeeded, so the log you shared isn't the error. That said, I went ahead and monitored your app while loading the root page and found the following:
2017-08-10T17:27:02.482836+00:00 app[web.1]: I, [2017-08-10T17:27:02.482635 #4] INFO -- : [3c945419-e22f-428f-9212-bebdad98f929] Started GET "/" for 71.198.136.218 at 2017-08-10 17:27:02 +0000
2017-08-10T17:27:02.533224+00:00 app[web.1]: I, [2017-08-10T17:27:02.533084 #4] INFO -- : [3c945419-e22f-428f-9212-bebdad98f929] Processing by LandingController#index as HTML
2017-08-10T17:27:02.596368+00:00 app[web.1]: I, [2017-08-10T17:27:02.596232 #4] INFO -- : [3c945419-e22f-428f-9212-bebdad98f929] Rendering landing/index.html.erb within layouts/application
2017-08-10T17:27:02.645104+00:00 app[web.1]: I, [2017-08-10T17:27:02.644968 #4] INFO -- : [3c945419-e22f-428f-9212-bebdad98f929] Rendered landing/index.html.erb within layouts/application (48.5ms)
2017-08-10T17:27:02.675935+00:00 app[web.1]: I, [2017-08-10T17:27:02.675800 #4] INFO -- : [3c945419-e22f-428f-9212-bebdad98f929] Completed 500 Internal Server Error in 142ms
2017-08-10T17:27:02.677803+00:00 app[web.1]: F, [2017-08-10T17:27:02.677709 #4] FATAL -- : [3c945419-e22f-428f-9212-bebdad98f929]
2017-08-10T17:27:02.677879+00:00 app[web.1]: F, [2017-08-10T17:27:02.677804 #4] FATAL -- : [3c945419-e22f-428f-9212-bebdad98f929] ActionView::Template::Error (undefined method `find_asset' for nil:NilClass):
The issue is ActionView::Template::Error (undefined methodfind_asset' for nil:NilClass)`, so you will need to fix that in order to resolve the issue.