Search code examples
ruby-on-railstwitter-bootstrapslim-lang

Can't migrate link_to after adding Bootstrap button


This td link works with Slim. After this paste, I'll show what doesn't work.

td=(link_to 'Destroy', article_path(article),
                        method: :delete,
                        data: { confirm: 'Are you sure?' })

I've added Bootstrap buttons to these links.

td 
  a class="btn btn-info" href=(article_path(article)) Show

This is my attempt at replacing the link with a button.

td
   a class="btn-danger" href=(article_path(article),
                                        method: :delete,
                                        data: { confirm: 'Are you sure?' }) Destroy

Can someone show me what I'm doing wrong or fix the syntax?


Solution

  • Try nesting on a link_to block:

    td
      = link_to article_path(article), method: :delete, data: { confirm: 'Are you sure?' }, :class => 'btn btn-danger' do
        span
          | Destroy