I think you must have something in your code (plugin perhaps?) that is
mucking with the verify. Here's the environment I'm using to try do
duplicate your problem:
About your application's environment
Ruby version 1.8.7 (powerpc-darwin9.7.0)
RubyGems version 1.3.5
Rack version 1.0
Rails version 2.3.2
Active Record version 2.3.2
Action Pack version 2.3.2
Active Resource version 2.3.2
Action Mailer version 2.3.2
Active Support version 2.3.2
Application root /Users/rick/matt
Environment development
Database adapter sqlite3
Database schema version 20091206142727
I did a 'rails matt' followed by 'script/generate scaffold Page
title:string body:text' just to gin things up. I've also added
map.index '/', :controller => 'pages', :action => 'index'
to my routes.rb and removed public/index.html.
To be successful, my verify line must look like:
class PagesController < ApplicationController
verify :method => :post,
:only => [:edit, :destroy, :revert],
:add_flash => { :notice => 'Cannot do that...'},
:redirect_to => :index_path
or
class PagesController < ApplicationController
verify :method => :post,
:only => [:edit, :destroy, :revert],
:add_flash => { :notice => 'Cannot do that...'},
:redirect_to => 'index_path'
If I use
class PagesController < ApplicationController
verify :method => :post,
:only => [:edit, :destroy, :revert],
:add_flash => { :notice => 'Cannot do that...'},
:redirect_to => index_path
My app fails on the verify producing:
undefined local variable or method `index_path' for
PagesController:Class
I would suggest you start a simple test app, like this, and then
incrementally add to it any plugins you need.
Regardless, your use of :redirect_to => root_path (without quotes or
colon) is what is producing the error.
Is your experience the same if you use :redirect_to => 'root_url' ?
How about :redirect_to => {
:controller => 'pages',
:action => 'show',
:name => 'HomePage'
}