I’m trying to include a tooltip for a POST link.
Making a regular GET link with a tooltip works fine:
%a{"href" => "#", "data-original-title" => "#{pluralize poem.score, 'vote'}", "data-placement" => "right", :rel => "tooltip"}
However, I’m pretty sure it’s not possible to specify the POST method for the above link.
Can I attach a tooltip to a link using the Rails link builder? Is this possible? The following example doesn’t work- no tooltip.
=link_to "^", votes_path(vote: {poem_id: poem.id}), method: :post, "data-original-title" => "Vote up. Current score: #{poem.score}", "data-placement" => "right", :rel => "tooltip"
If that’s not possible, what’s the javascript solution?
SOLVED
I wasn’t specifying the POST method in the right way. Here’s a solution:
%a{"href" => "#{votes_url(vote: {poem_id: poem.id})}", "data-method" => "post", "data-original-title" => "#{pluralize poem.score, 'vote'}; click to vote.", "data-placement" => "right", :rel => "tooltip"}
I wasn’t specifying the POST method in the right way. Here’s a solution:
%a{"href" => "#{votes_url(vote: {poem_id: poem.id})}", "data-method" => "post", "data-original-title" => "#{pluralize poem.score, 'vote'}; click to vote.", "data-placement" => "right", :rel => "tooltip"}