I use *redirect_to root_url*

Thanks & Regards,
Dhruva Sagar.




On Sun, Dec 6, 2009 at 10:05 PM, Matt Harrison <[email protected]
> wrote:

> On Sun, Dec 06, 2009 at 08:05:22AM -0800, Rick wrote:
> > 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'
> >   }
>
> Rick, many thanks for your reply. I believe I have sorted it now. If I use
>
> :redirect_to => :root_url
>
> it does appear to work as I expect. I realise that I wasn't using verify in
> my last project, and it seems to take slighly different arguments than
> redirect_to.
>
> So for verify I will use the symbol :root_url but for redirect_to I will
> use
> the method root_url().
>
> Many thanks for the help with this one, my head hasn't been clear enough to
> work it out for myself, I might have to lay off the morphine for a while :D
>
> Thanks
>
> Matt
>
> --
>
> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Talk" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected]<rubyonrails-talk%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/rubyonrails-talk?hl=en.
>
>
>

--

You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.


Reply via email to