1

One of my pages keeps hitting this error:

ActionView::Template::Error (undefined method `+' for nil:NilClass):
    15:   <div class="look_list">
    16:     <% collection.each do |look| %>
    17:       <div class="look_book" id="<%= look.content_id %>">
    18:         <% thumbnail_image = (look.processing? ? "/assets/processing_placeholder.gif" : (look.image.url(:thumb) + "?#{look.updated_at.to_i}")) %>
    19:         <%= image_tag thumbnail_image || "/assets/processing_placeholder.gif",:class=> "look_image", :size => "118x118" %>
    20:         <script type="text/javascript">
    21:
  app/views/looks/index.html.erb:18:in `block in _app_views_looks_index_html_erb__3409922204803071014_68666020'
  app/views/looks/index.html.erb:16:in `_app_views_looks_index_html_erb__3409922204803071014_68666020'

Some background, my site hit into 502 bad gateway 2 days ago. We managed to restart the site. However, it caused some connection issue with mongodb. This was resolved after we restart the DB. However, this one page keep hitting the error above. This has never happened before. Any one can help?

2 Answers 2

2

what is the value of look.image.url(:thumb) before line 18 executes? That is where the error is thrown, and it is the only place I am seeing a +

I'd check your data, to see if the crash caused data loss somewhere, in particular, on the data needed for that method

Sign up to request clarification or add additional context in comments.

Comments

0

Try out something like this .....

<div class="look_list">
        <% collection.each do |look| %>
         <div class="look_book" id="<%= look.content_id %>">
            <% thumbnail_image = look.image.url(:thumb) unless look.processing? %>
                  <% thumbnail_image.nil? ? "/assets/processing_placeholder.gif" : (look.image.url(:thumb) + "?#{look.updated_at.to_i}") %>
            <%= image_tag thumbnail_image ,:class=> "look_image", :size => "118x118" %>
        </div>
        <% end %>
</div>

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.