开发者

Link_to doesn't work when using acts-as-taggable-on with custom method

开发者 https://www.devze.com 2022-12-17 01:49 出处:网络
Or rather I don\'t know how to specify the route for it. I have my controller setup us: def tags @clients = current_user.clients.find_tagged_with(params[:开发者_StackOverflowtag])

Or rather I don't know how to specify the route for it.

I have my controller setup us:

def tags
  @clients = current_user.clients.find_tagged_with(params[:开发者_StackOverflowtag])
end

and my views

Tags:

<% for tag in @client.tags %>
  <%= link_to tag.name, clients_path(:view =>'tag', :tag => tag.name) %>
<% end %>

Only problem is that the link (clients_path) goes back to index and not 'all.' I know it has to do with changing the clients_path to somehow tell it to use 'all'. But I don't know how.

Any help?

Thanks


You can check your routes using rake routes.

I'm not sure what you mean by 'all' but if this is a custom method added to routes, then you should be able to use all_clients_path instead of clients_path.

0

精彩评论

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