当我点击链接时,我收到此错误:
No route matches {:action=>"show", :controller=>"likes",
:doweet_id=>2}
这是link_to代码:
link_to image_tag("/images/friends/thumbs-up.jpg"), like_path(:doweet_id => doweet.id), :method => :post
在路线中:
resources :likes
in likes controller:
class LikesController < ApplicationController
respond_to :html, :js
def create
@like = Like.new(:doweet_id => params[:doweet_id])
#push(comment)
flash[:notice] = "Like successfully created" if @like.save
respond_with( @like, :layout => !request.xhr? )
end
end
答案 0 :(得分:1)
link_to image_tag("/images/friends/thumbs-up.jpg"), likes_path(:doweet_id => doweet.id), :method => :post, :remote => true