rails link_to controller action
action, controller, link-to, ruby-on-rails
Solution
Maybe it's not recognize the link. I suppose `friends.picture` is a link for image, so you can try this:
<%= link_to( "", :controller => "static_pages", :action => "recomend", :id => friends.user_id) do %>
<%= image_path(friends.picture) %>
<% end %>
Problem
I show in my homepage 4 pictures, and when a user click on one of it, I want to change a parameter :asked in my db. In my view I've added ``` <%= link_to image_tag(friends.picture), {:controller => "static_pages", :action => "recomend", :id => friends.user_id} %> ``` In the Static_Pages_Controller I have ``` def recomend a = Friends.find_by_user_id(params[:id]) a.update_attribute(:asked, true) end ``` And in routes.rb ``` resources :static_pages do resources :recomend end ``` but when I click on it, the server refresh my home (why?!) and in the server logs i see ``` Started GET "/auth/failure?action=recomend&controller=static_pages&id=101" for 127.0.0.1 at 2012-11-17 19:59:25 +0100. ```