I’ve got
<%= link_to 'Destroy', project, :method => :delete, :data => { :confirm => 'Are you sure?' } %>
but when I click on “Destroy” in view, it shows me the project (routes me to /project/:id)
# routes.rb
resources :users
resources :projects do
resources :issues
end
resources :issues
resources :sessions
root :to => "users#index"
match "/auth/:provider/callback" => "sessions#create"
match "/signout" => "sessions#destroy", :as => :signout
# projects_controller.rb
def destroy
@project = Project.find(params[:id])
@project.destroy
respond_to do |format|
format.html { redirect_to projects_url }
format.json { head :no_content }
end
end
But “Edit” works well.
Do you know, where is the problem?
and there is an aplication.html.erb
#aplication.html.erb
<!DOCTYPE html>
<html>
<head>
<title>Project manager</title>
<%= stylesheet_link_tag "application", :media => "all" %>
<%= javascript_include_tag "application" %>
<%= csrf_meta_tags %>
</head>
<body>
<% if current_user %>
Welcome <%= current_user.username %>
<%= link_to "Signout", signout_path %>
<% else %>
<%= link_to "Sign in with twitter", "/auth/twitter" %>
<% end %>
<%= yield %>
</body>
</html>
and finally aplication.js
#aplication.js
= require jquery
//
= require jquery_ujs
//
= require_tree .
//
= require prototype_nested_form
//
= require jquery_nested_form
= require bootstrap
PS: server restart doesnt help
I’ve solved it. I don’t know why, but when I deleted these two lines
everything works fine.