Delete method couldn't be invoked in Rails
<p>so I'm implementing delete user method in my view, This is the destroy method in my users_controller</p>

<pre><code>def destroy
@user = User.find(params[:id])
@user.destroy
respond_to do |format|
  format.html { redirect_to users_path, notice: 'This user was successfully destroyed.' }
  format.json { head :no_content }
end
end
</code></pre>

<p>And my view:</p>

<pre><code>&lt;td&gt;&lt;%= link_to 'Delete', users_path(user), method: :delete, data: { confirm: 'Are you sure?' } %&gt;&lt;/td&gt;
</code></pre>

<p>And the application.js</p>

<pre><code>// This is a manifest file that'll be compiled into application.js, which will include all the files
// listed below.
//
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
//
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
// compiled file.
//
// Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details
// about supported directives.
//
//= require jquery
//= require jquery_ujs
//= require bootstrap-sprockets
//= require_tree .
</code></pre>

<p>And in the layouts/application.html.erb I have:</p>

<pre><code>&lt;%= javascript_include_tag 'default' %&gt;
</code></pre>

<p>And everytime I clicked on the destroy link, it just refreshes and doesn't delete. What I should mention is the view is under superadmins and the superadmins_controller is inherited from users_controller where I wrote the destroy method. I think it might be something wrong with route.rb but I can't come up with a solution. My route.rb looks like this:</p>

<pre><code>Rails.application.routes.draw do
root to: 'visitors#index'
devise_for :users, :path =&gt;'u'
devise_scope :user do
    get '/u/sign_out' =&gt; 'devise/sessions#destroy'
  end
  resources :users
  resources :superadmins
end
</code></pre>

<p>Thanks!</p>

<p><strong>UPDATE on console</strong></p>

<pre><code>    ActionController::RoutingError (No route matches [GET] "/javascripts/default.js"):
  actionpack (4.2.5.1) lib/action_dispatch/middleware/debug_exceptions.rb:21:in `call'
  web-console (2.3.0) lib/web_console/middleware.rb:28:in `block in call'
  web-console (2.3.0) lib/web_console/middleware.rb:18:in `catch'
  web-console (2.3.0) lib/web_console/middleware.rb:18:in `call'
  actionpack (4.2.5.1) lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
  railties (4.2.5.1) lib/rails/rack/logger.rb:38:in `call_app'
  railties (4.2.5.1) lib/rails/rack/logger.rb:20:in `block in call'
  activesupport (4.2.5.1) lib/active_support/tagged_logging.rb:68:in `block in tagged'
  activesupport (4.2.5.1) lib/active_support/tagged_logging.rb:26:in `tagged'
  activesupport (4.2.5.1) lib/active_support/tagged_logging.rb:68:in `tagged'
  railties (4.2.5.1) lib/rails/rack/logger.rb:20:in `call'
  quiet_assets (1.1.0) lib/quiet_assets.rb:27:in `call_with_quiet_assets'
  actionpack (4.2.5.1) lib/action_dispatch/middleware/request_id.rb:21:in `call'
  rack (1.6.4) lib/rack/methodoverride.rb:22:in `call'
  rack (1.6.4) lib/rack/runtime.rb:18:in `call'
  activesupport (4.2.5.1) lib/active_support/cache/strategy/local_cache_middleware.rb:28:in `call'
  rack (1.6.4) lib/rack/lock.rb:17:in `call'
  actionpack (4.2.5.1) lib/action_dispatch/middleware/static.rb:116:in `call'
  rack (1.6.4) lib/rack/sendfile.rb:113:in `call'
  railties (4.2.5.1) lib/rails/engine.rb:518:in `call'
  railties (4.2.5.1) lib/rails/application.rb:165:in `call'
  rack (1.6.4) lib/rack/lock.rb:17:in `call'
  rack (1.6.4) lib/rack/content_length.rb:15:in `call'
  rack (1.6.4) lib/rack/handler/webrick.rb:88:in `service'
  /Users/pc/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/webrick/httpserver.rb:138:in `service'
  /Users/pc/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/webrick/httpserver.rb:94:in `run'
  /Users/pc/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/webrick/server.rb:294:in `block in start_thread'
</code></pre>