开发者

error when using link_to to create a like

开发者 https://www.devze.com 2023-03-21 05:41 出处:网络
when i\'m clicking on the link i\'m getting this error: No route matches {:action=>\"show\", :controller=>\"likes\",

when i'm clicking on the link i'm getting this error:

 No route matches {:action=>"show", :controller=>"likes",
 :doweet_id=>2}

this is the link_to code:

 link_to image_tag("/images/friends/thumbs-up.jpg"),  like_path(:doweet_id => doweet.id), :method => :post

in the routes:

  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 =开发者_Go百科> !request.xhr? )
  end

end


link_to image_tag("/images/friends/thumbs-up.jpg"),  likes_path(:doweet_id => doweet.id), :method => :post, :remote => true
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号