user1573016
user1573016

Reputation: 51

Adding :class to link_to that has :controller and :method

The below works, but I'd lie to add a class to it.

<%= link_to "Cancel My Subscription", {:controller => :charges, :action => :cancel}, {:method => :post } %>

This is not working:

<%= link_to "Cancel My Subscription", {:controller => :charges, :action => :cancel}, {:method => :post }, :class => "btn" %>

Upvotes: 1

Views: 182

Answers (1)

Joel
Joel

Reputation: 4593

The way to add a class to a link is as follows:

<%= link_to "Cancel My Subscription", { URL_FOR PARAMS HERE }, :controller => 
        :charges, :action => :cancel, :method => :post, :class => "btn" %>

Hope this helps.

Upvotes: 2

Related Questions