Recent item - Routing error

ぃ、小莉子 提交于 2019-12-31 05:13:11

问题


I'm encountering a really strange behaviour in my rails app. Basicaly, user is able to upload photo. The model for those photos is called user_photo. The thing is that allways, when i'll try to access the most recently added item (using the URL generated by user_photo_path(@user_photo), let's say it's http://localhost:3000/user_photos/20), i'm getting this error:

No route matches {:action=>"show", :controller=>"user_photos", :id=>nil}

This happens just to most recently added item which means that if i have a recently added user_photo with :id => 20 it will cause the routing error; however, if i'll create the new one (with :id => 21), the previous user_photo which id is 20 will start to work.

Have you any idea what can be causing this strange behaviour? I'm running my rails app in dev env using apache2 + passenger

来源:https://stackoverflow.com/questions/12982083/recent-item-routing-error

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!