title: Ruby in Rails, destroy does not work in edit. routing to show
body: <p>I have a problem with the destroy action.
  It works in the index.html.erb very fine.
  But I can't get it work in the edit.html.erb
  It routes to the show even without asking for a permission.</p>
  
  <p>Many solutions here say it has something to do with jQuery. Well as you can see, I tried all I could find.   </p>
  
  <pre><code>&lt;%= stylesheet_link_tag    "application" %&gt;
      &lt;!--Delete Problem in Edit--&gt;
      &lt;%#= javascript_include_tag :all %&gt;
      &lt;%#= javascript_include_tag :application %&gt;
      &lt;%#= javascript_include_tag :default %&gt;
  &lt;%= javascript_include_tag "application" %&gt;
  &lt;%= csrf_meta_tags %&gt;
  </code></pre>
  
  <p>Is there a solution that works for my situation?</p>
  
  <p>This is my delete button in edit:</p>
  
  <pre><code>&lt;%= content_tag(:a, :href =&gt; contact_path(@contact), :class =&gt; "btn btn-warning pull-right", :style =&gt; "margin:0; margin-right:15px;", confirm: 'Are you sure?', method: :delete) do %&gt;
  &lt;%= t "list.button_delete" %&gt;
          &lt;%#= link_to I18n.t(".list.delete"), contact, confirm: 'Are you sure?', method: :delete %&gt;
          &lt;%#= link_to 'delete', contact_path(@contact), :method =&gt; :delete %&gt;
  &lt;% end %&gt;
  </code></pre>
  
  <p>I tried many things, as well.</p>
  
  <p>The following is the action:</p>
  
  <pre><code>def destroy
      #@contact = Contact.find(params[:id])
      @contact = current_user.contacts.find(params[:id])
      @contact.destroy
      redirect_to contacts_url,
                              alert: 'Successfully deleted the contact'
  end
  </code></pre>