undefined method `redirect_to'

Hi all. I'm getting the following error in my app:

undefined method `redirect_to' for ActionController::Base:Class

I'm using Windows 2000, Rails 2.0.2 and resource_controller (from James Golick).

My controller:

class CommentsController < ApplicationController    include ResourceController::Controller

   belongs_to :post, :article, :photo

   create do      ActionController::Base.redirect_to :back    end end

I've been also trying to use the following:

class CommentsController < ResourceController::Base    belongs_to :post, :article, :photo

   create do      ActionController::Base.redirect_to :back    end end

and

class CommentsController < ApplicationController    resource_controller

   belongs_to :post, :article, :photo

   create do      ActionController::Base.redirect_to :back    end end

and getting:

undefined method `redirect_to' for #<ResourceController::FailableActionOptions:0x4b05b90>

What am I doing wrong? According to api.rubyonrails.com, redirect_to belongs to ActionController::Base [1]

Any guess?

Thanks,

davi vidal

[1] - http://api.rubyonrails.com/classes/ActionController/Base.html#M000456

Hi all. I'm getting the following error in my app:

undefined method `redirect_to' for ActionController::Base:Class   create do     ActionController::Base.redirect_to :back   end and getting:

undefined method `redirect_to' for #<ResourceController::FailableActionOptions:0x4b05b90>

What am I doing wrong? According to api.rubyonrails.com, redirect_to belongs to ActionController::Base [1]

It is, but it's an instance method, and you're calling it as if it was
a class method. Just redirect_to :back should do the trick.

Fred

Quoting Frederick Cheung <frederick.cheung@gmail.com>:

Hi all. I'm getting the following error in my app:

undefined method `redirect_to' for ActionController::Base:Class   create do     ActionController::Base.redirect_to :back   end and getting:

undefined method `redirect_to' for #<ResourceController::FailableActionOptions:0x4b05b90>

What am I doing wrong? According to api.rubyonrails.com, redirect_to belongs to ActionController::Base [1]

It is, but it's an instance method, and you're calling it as if it was a class method. Just redirect_to :back should do the trick.

I get the same error if I try just redirect_to :back. I was thinking that could be anything to do with plugin, but it inherits from ApplicationController.

Any other tip?

My controller:

[code] class CommentsController < ResourceController::Base    belongs_to :post, :article, :photo

   create do      redirect_to :back    end end [/code]

[output] undefined method `redirect_to' for #<ResourceController::FailableActionOptions:0x4b680d8> [/output]

Thank you a lot,

davi vidal

Quoting davividal@siscompar.com.br:

Quoting Frederick Cheung <frederick.cheung@gmail.com>:

Hi all. I'm getting the following error in my app:

undefined method `redirect_to' for ActionController::Base:Class   create do     ActionController::Base.redirect_to :back   end and getting:

undefined method `redirect_to' for #<ResourceController::FailableActionOptions:0x4b05b90>

What am I doing wrong? According to api.rubyonrails.com, redirect_to belongs to ActionController::Base [1]

It is, but it's an instance method, and you're calling it as if it was a class method. Just redirect_to :back should do the trick.

I get the same error if I try just redirect_to :back. I was thinking that could be anything to do with plugin, but it inherits from ApplicationController.

Any other tip?

[...]

Googling for "redirect_to resource_controller" (instead "undefined bla-bla-bla"), I was sent to this thread:

http://groups.google.com/group/resource_controller/browse_thread/thread/b4657a4109d6eccd

And solved my problem using:

[code] create do    wants.html { redirect_to :back } end [/code]

Thank you for your attention.

Davi Vidal