ruby on rails - ROR delete action not working -


i beginner ror , following tutorial http://guides.rubyonrails.org/getting_started.html.

so according tutorial want delete 1 post. not working showing error the action 'destroy' not found postscontroller

my post controller delete method looks

 def destroy   @post = post.find(params[:id])   logger.debug "***********************: #{@post.id}"   @post.destroy    redirect_to posts_path end 

in routes mentioned resource resources :posts still giving error destroy action. doing wrong. need help.

did mention method delete in views?

if using rails 4, should do:

<%=link_to 'destroy', post_path(post), method: :delete, data: { confirm: 'are sure?' } %> 

in rails 3:

<%=link_to 'destroy', post_path(post), method: :delete, confirm: 'are sure?' %> 

Comments

Popular posts from this blog

Unable to remove the www from url on https using .htaccess -