Created
October 15, 2014 17:34
-
-
Save jaake/c5b7ac69fcfc242e4386 to your computer and use it in GitHub Desktop.
weird no method error
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Started GET "/news" for 127.0.0.1 at 2014-10-15 12:31:14 -0500 | |
| Processing by HomeController#news as HTML | |
| Rendered home/news.html.erb within layouts/application (1.5ms) | |
| Completed 500 Internal Server Error in 278ms | |
| ActionView::Template::Error (undefined method `[]' for nil:NilClass): | |
| 5: <% @photos.each do |photo| %> | |
| 6: <div class="instagram_image"> | |
| 7: <div> | |
| 8: <span><%= photo['caption']['text'] %></span> | |
| 9: </div> | |
| 10: <%= link_to(image_tag(photo['images']['standard_resolution']['url'], alt: photo['caption']['text']), photo['link']) %> | |
| 11: </div> | |
| app/views/home/news.html.erb:8:in `block in _app_views_home_news_html_erb___533854884488423857_43890020' | |
| app/views/home/news.html.erb:5:in `each' | |
| app/views/home/news.html.erb:5:in `_app_views_home_news_html_erb___533854884488423857_43890020' | |
| Rendered /home/jaake/.rvm/gems/ruby-2.1.1/gems/actionpack-4.1.6/lib/action_dispatch/middleware/templates/rescues/_trace.html.erb (1.2ms) | |
| Rendered /home/jaake/.rvm/gems/ruby-2.1.1/gems/actionpack-4.1.6/lib/action_dispatch/middleware/templates/rescues/_request_and_response.html.erb (0.8ms) | |
| Rendered /home/jaake/.rvm/gems/ruby-2.1.1/gems/actionpack-4.1.6/lib/action_dispatch/middleware/templates/rescues/template_error.html.erb within rescues/layout (10.2ms) | |
| ^ From Rails application | |
| But as you can see below, the same exact code works flawlessly in rails c ... | |
| 2.1.1 :012 > @photos[0] | |
| => {attribution=>nil, tags=>[], location=>nil, comments=>{count=>0, data=>[]}, filter=>Earlybird, created_time=>1413390810, link=>http://instagram.com/p/uLhRIlln-Q/, likes=>{count=>5, data=>[{username=>hnewy, profile_picture=>http://photos-a.ak.instagram.com/hphotos-ak-xap1/923799_1472925856329040_1850463660_a.jpg, id=>228377904, full_name=>Hannah Garber}, {username=>kqwilson, profile_picture=>http://images.ak.instagram.com/profiles/profile_19433883_75sq_1369960395.jpg, id=>19433883, full_name=>Quinn}, {username=>saramcloud, profile_picture=>http://images.ak.instagram.com/profiles/profile_34259068_75sq_1333744593.jpg, id=>34259068, full_name=>The M.C. Loud}, {username=>kellybrockman, profile_picture=>http://photos-a.ak.instagram.com/hphotos-ak-xfa1/914465_285048491699192_1640866109_a.jpg, id=>253597958, full_name=>Kelly McNeely Brockman}]}, images=>{low_resolution=>{url=>http://scontent-b.cdninstagram.com/hphotos-xaf1/t51.2885-15/10723834_367364053439419_1073249387_a.jpg, width=>306, height=>306}, thumbnail=>{url=>http://scontent-b.cdninstagram.com/hphotos-xaf1/t51.2885-15/10723834_367364053439419_1073249387_s.jpg, width=>150, height=>150}, standard_resolution=>{url=>http://scontent-b.cdninstagram.com/hphotos-xaf1/t51.2885-15/10723834_367364053439419_1073249387_n.jpg, width=>640, height=>640}}, users_in_photo=>[], caption=>nil, type=>image, id=>831904869166514064_351691438, user=>{username=>zollikoffee, website=>, profile_picture=>http://images.ak.instagram.com/profiles/profile_351691438_75sq_1385853025.jpg, full_name=>ZolliKoffee, bio=>, id=>351691438}} | |
| 2.1.1 :013 > |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment