I am unable to delete a record in ruby on rails for some reason. I have tried many solutions unfortunately to no avail. (such as How to delete / destroy a record in rails?)
The contents of my application.erb
are:
<!DOCTYPE html>
<html>
<head>
<title></title>
<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %>
<%= javascript_include_tag %>
<%= csrf_meta_tags %>
</head>
<body>
<%= yield %>
</body>
</html>
when i open in html it only displays the following css it does not display js as in the tags above.
<link data-turbolinks-track="true" href="/assets/scaffolds.css?body=1" media="all" rel="stylesheet" />
<link data-turbolinks-track="true" href="/assets/statuses.css?body=1" media="all" rel="stylesheet" />
<link data-turbolinks-track="true" href="/assets/application.css?body=1" media="all" rel="stylesheet" />
for my index.html.erb
<h1>Listing statuses</h1>
<table>
<thead>
<tr>
<th>Name</th>
<th>Content</th>
<th colspan="3"></th>
</tr>
</thead>
<tbody>
<% @statuses.each do |status| %>
<tr>
<td><%= status.name %></td>
<td><%= status.content %></td>
<td><%= status.id %></td>
<td><%= link_to 'Show', status %></td>
<td><%= link_to 'Edit', edit_status_path(status) %></td>
<td><%= link_to 'Destroy', status , method: :delete, data: { confirm: 'Are you sure?' } %></td>
</tr>
<% end %>
</tbody>
</table>
<br>
<%= link_to 'New Status', new_status_path %>
i am troubleshooting this currently to no avail, if someone can pick any faults in this code, i would greatly appreciate. :) the js files are not showing in the head section of the page and the destroy function is not working, let alone the confirm tag.
Update: Now I am getting this error:
TypeError: Object doesn't support this property or method Rails.root: [location]
if i remove the '<%= javascript_include_tag %>
' it functions, although not fully (ie. does not delete like in the first instance)
update 2 when i click on destroy button, it simply redirects me to view that particular status only, it does not destroy
update 3 inside the application.js
i have the following:
// 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 any plugin's vendor/assets/javascripts directory 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/rails/sprockets#sprockets-directives) for details
// about supported directives.
//
//= require jquery
//= require jquery_ujs
//= require turbolinks
//= require_tree .
update 4 I have changed the <%= javascript_include_tag %>
to <%= javascript_include_tag 'default', 'data-turbolinks-track' => true %>
and it loads the js file however when i click on that js file from the sourcecode i get a routing error.
Any possible way i can solve that?