3
我在我的主页上显示4张图片,当用户点击其中一个图片时,我想更改一个参数:在我的数据库中询问。rails link_to控制器动作
在我看来,我已经添加
<%= link_to image_tag(friends.picture), {:controller => "static_pages", :action => "recomend", :id => friends.user_id} %>
在Static_Pages_Controller我
def recomend
a = Friends.find_by_user_id(params[:id])
a.update_attribute(:asked, true)
end
而且在routes.rb中
resources :static_pages do
resources :recomend
end
但是当我点击它时,服务器刷新我的家(为什么?!),并在我看到的服务器日志
Started GET "/auth/failure?action=recomend&controller=static_pages&id=101" for 127.0.0.1 at 2012-11-17 19:59:25 +0100.
中的验证失败告诉我,有更多的应用程序似乎比 - 是什么原因造成的AUTH控制器被打? –