0

I have a Rails 5.2.4.3 app that has been working well until yesterday morning. I made a minor text change and attempted to upload the change to Heroku without testing. DON'T DO THAT. The assets didn't compile. When I executed this is localhost I got the following error.

ActionView::Template::Error (Can't resolve image into URL: undefined method `+' for nil:NilClass):
    2:  <p class="text-center text-cat"><%= "#{t :home01}" %><br><%= "#{t :home02}#{t :space}:" %></p>
    3:  <div class="row">
    4:      <div class="col-12 col-sm-8 offset-sm-2 col-md-6 offset-md-3 col-lg-6 offset-lg-3 col-xl-6 offset-xl-3" align="center">
    5:          <p class="py-2"><%= link_to image_tag("youtubevideo.jpg", class: "img-fluid", alt: "#{t :about_us}"), "https://www.youtube.com/watch?v=PrAcKje2MS0", target: "_blank" %></p>
    6:      </div>
    7:  </div>
    8:  <p class="text-center text-cat"><%= "#{t :home03} #{t :home04}" %></p>

app/views/pages/home.html.erb:5:in `_app_views_pages_home_html_erb__2887808543043751872_20140'
Started GET "/" for ::1 at 2020-06-05 11:05:33 -0500
Processing by PagesController#home as HTML
  Rendering pages/home.html.erb within layouts/application
  Rendered pages/home.html.erb within layouts/application (5055.4ms)
Completed 500 Internal Server Error in 5208ms (ActiveRecord: 0.0ms)

I didn't find much about this error that didn't include gems that I'm not using in my app or using earlier versions of Rails. This is the only one I found but the solution didn't work. This is the error I got when I precompiled the assets.

rails aborted!
NoMethodError: undefined method `+' for nil:NilClass

I thought I would rename the images on this view and try to run my application. I got the same error on my stylesheet.

ActionView::Template::Error (undefined method `+' for nil:NilClass):
    15:       <meta content="IE=edge,chrome=1" http-equiv="X-UA-Compatible">
    16:       <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=0">
    17:         <meta name="wot-verification" content="3402293318de5ef4db02"/>
    18:       <%= stylesheet_link_tag    "application", media: "all" %>
    19:       <%= csrf_meta_tags %>
    20:         <%= favicon_link_tag "/favicon.ico" %>
    21:       <%= render 'layouts/shim' %>

app/views/layouts/application.html.erb:18:in `_app_views_layouts_application_html_erb___3180930056003916447_19580'

I replaced my assets folder and the view from a backup before I made my changes and I still get this error.

I have looked at the security of my assets folder on my computer and it looks fine.

What else can cause this error?

1 Answers1

0

I renamed all my images and recreated new files from scratch in the other asset folders. My application works as expected.

I still don't know why Rails from time to time stops can't find an asset file. Renaming it usually fixes the problem. This is the first time this has happened to every file in my assets folder.