0

The problem is that the scaffolding-generated User Delete link discussed in Chapter 2 section 2.2.1 does not do a delete. Instead, it does the same as the Show link.

I have searched for this issue and found a couple of reports ( Why Delete link doesn't work in this Ruby on Rails project? and Rails 3 :method=> :delete doesn't work in Internet Explorer ) but they were 4 and 5 years ago and suggested solutions referenced rails and gem versions considerably older than what's current.

Furthermore, one of the suggested solutions that seemed to work for some people was to modify application.html.erb to use <%= javascript_include_tag 'application', 'data-turbolinks-track' => true %> instead of <%= javascript_include_tag 'defaults', 'data-turbolinks-track' => true %> but that would undo the fix to a problem I posted a few days ago (Michael Hartl's Ruby on Rails Tutorial, toy_app user tour).

I am using Firefox on Windows 7, and my gem file is below. I have verified that Javascript is enabled in the browser. What would be an appropriate fix for current versions of rails, etc?

source 'https://rubygems.org'

gem 'rails', '4.2.0'
gem 'sass-rails', '~>5.0'
gem 'uglifier', '2.5.3'
gem 'coffee-rails', '4.1.0'
gem 'jquery-rails', '4.0.3'
gem 'turbolinks',       '2.3.0'
gem 'jbuilder', '2.2.3'
gem 'sdoc', '~> 0.4.0', group: :doc

group :development, :test do
  gem 'sqlite3'
  gem 'byebug', '3.4.0'
  gem 'web-console', '~> 2.0'
  gem 'spring', '1.1.3'
end

group :production do
  # Gems for Heroku deployment
  gem 'pg'
  gem 'rails_12factor'
end

# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
Community
  • 1
  • 1
Dan F
  • 33
  • 4
  • Can you show us your index view? – Jason Oct 21 '15 at 01:08
  • Also, what do you see in your logs? Is it calling the right controller action with the right http verb? Is there something like `Started DELETE "/users/2"...Processing by UsersController#destroy as HTML` – elements Oct 21 '15 at 01:57
  • Sorry, I'm pretty new at RoR. What file is the index view? For the log, I do not see any reference at all to DELETE. It starts with "Started GET ...", and there is a routing error for the DEFAULTS javascript_include_tag. – Dan F Oct 21 '15 at 02:12

1 Answers1

0

In Windows, if you perform rails new Project, that was the common problem. You need to alter applications to default and this solution, delete method is not working. If you tried to rails new Project in Linux, and transfer it to Windows, this issue will not happen.

Try to use Linux because Windows is not an ideal for RoR development.