davividal-UiHwsRqXctc1RhZgQKG/ig@public.gmane.org
2008-Mar-16 19:20 UTC
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 --~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On 16 Mar 2008, at 19:20, davividal-UiHwsRqXctc1RhZgQKG/ig@public.gmane.org wrote:> > > > 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> Any guess? > > Thanks, > > davi vidal > > > [1] - http://api.rubyonrails.com/classes/ActionController/Base.html#M000456 > > >--~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
davividal-UiHwsRqXctc1RhZgQKG/ig@public.gmane.org
2008-Mar-16 19:37 UTC
Re: undefined method `redirect_to''
Quoting Frederick Cheung <frederick.cheung-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>:> On 16 Mar 2008, at 19:20, davividal-UiHwsRqXctc1RhZgQKG/ig@public.gmane.org wrote: > >> >> >> >> 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 --~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
davividal-UiHwsRqXctc1RhZgQKG/ig@public.gmane.org
2008-Mar-16 20:55 UTC
Re: undefined method `redirect_to'' [SOLVED]
Quoting davividal-UiHwsRqXctc1RhZgQKG/ig@public.gmane.org:> > Quoting Frederick Cheung <frederick.cheung-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>: >> On 16 Mar 2008, at 19:20, davividal-UiHwsRqXctc1RhZgQKG/ig@public.gmane.org wrote: >> >>> >>> >>> >>> 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 --~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---