Getting an undefined method `each' for nil:NilClass error for
<% for movie in trailers %>
<li>
<article>
<div class="photo">
<a href="<%= movie['links'] %>"><img src="<%= movie['thumbnail'] %>" alt="Photo" class="wrap_me_white"/></a>
</div>
<div class="details">
<h4 class="title"><a href="<%= movie['title'] %>"></a></h4>
</div>
</article>
</li>
<% end %>
This is using an API from rotten tomatoes which is defined and working properly for all the other areas using different APIs.
def trailers
config = Rails.application.config
resp = HTTParty.get("#{config.rotten_tomatoes_api_url}movies/770672122/clips.json?apikey=#{config.rotten_tomatoes_api_key}")
movies = JSON.parse(resp.body)['movies']
end
I have checked to make sure all the fields are correct according to rotten tomatoes. I am not sure what to do next as I've I've gone through all the problems and fixes that I have used previously. I really appreciate your time, and if there is more data needed let me know and I'd be more than happy to supply it. Thanks!