【发布时间】:2012-11-17 19:10:26
【问题描述】:
我在我的主页上显示了 4 张图片,当用户点击其中一张时,我想更改一个参数 :asked in my db.
在我看来我已经添加了
<%= 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.
【问题讨论】:
-
身份验证失败告诉我应用程序比看起来的要多 - 是什么导致身份验证控制器被击中?
标签: ruby-on-rails controller action link-to