2012-11-17 6 views
3

내 홈페이지에 4 개의 그림을 표시하고 사용자가 그 중 하나를 클릭하면 매개 변수를 변경하려고합니다. 내 db에 요청했습니다. 내보기에서rails link_to 컨트롤러 조치

나는

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 

에 있지만이있는 Static_Pages_Controller에서

<%= link_to image_tag(friends.picture), {:controller => "static_pages", :action => "recomend", :id => friends.user_id} %> 

을 추가 한 난의를 클릭하면 서버 내 집 새로 고침 (왜?!) 및 서버 로그에서 내가 볼 수

Started GET "/auth/failure?action=recomend&controller=static_pages&id=101" for 127.0.0.1 at 2012-11-17 19:59:25 +0100. 
+0

정식 오류가 응용 프로그램에 더 보인다보다이 있음을 알려줍니다 - 타격 무엇을이 인증 컨트롤러를 일으키는? –

답변

6

어쩌면 링크를 인식하지 못할 수도 있습니다. 나는 friends.picture는 이미지에 대한 링크입니다 생각, 그래서 당신이 시도 할 수 있습니다 :

<%= link_to("", :controller => "static_pages", :action => "recomend", :id => friends.user_id) do %> 
    <%= image_path(friends.picture) %> 
<% end %>