I'm new to ROR, I'm trying to create an action from which I am able to delete a file from database. I have written a code for the same but giving error to url. View for the delete action:-
= link_to raw('<span>Delete</span>'), :method=> :delete,  destroy_attachment_path(attachment.descendants.last),
                              :data => { :confirm => 'Are you sure? This will permanently delete this file!' },
                              :remote => true,
                              :class => 'deleteShow deleteFile'
Controller for the same:-
enter code here
def destroy
  @attachment = Attachment.find(params[:id])
  @attachment.destroy
  respond_to do |format|
    format.html { redirect_to attachments_url }
    format.json { head :no_content }
  end
end
When I'm trying to run this code error is showing like invalid method Destroy_attachment path. Can any one help me to figure out the problem? Thanks in advance.