[Rails] Re: Is there a way to redirect from one controller action to another without a server trip?
Without thinking too much about it, how about if you create another class that both your controllers can use? # This class processes your actions class YourActionClass def your_action(params) # here you process your request end end # This is the controller you want to process the "redirect". class ControllerA < ApplicationController def your_action your_action_instance = YourActionClass.new your_action_instance.your_action(your_parameters) end end # This is the controller you want to recognize your special cases and redirect them. class ControllerB < ApplicationController def action if special_case your_action_instance = YourActionClass.new your_action_instance.your_action(your_parameters) # maybe you can render something here? else # your regular stuff goes here. end end end On Mar 8, 6:47 am, Pieter Hugo wrote: > Hi > > I want one controller action to invoke another action in another > controller, but I don't want the overhead of a redirect_to response > which then generates another request to the correct action and > controller. Any suggestions? > > Pieter > > -- > Posted viahttp://www.ruby-forum.com/. -- 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@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Re: [Rails] Re: Is there a way to redirect from one controller action to another without a server trip?
On Thu, Mar 8, 2012 at 5:25 PM, Pieter Hugo wrote: > something like > > render :controller => othercontroller, :action => :otheraction, :params > => params > * Nope, I hope you cant call another controller action like this.* > > ? > > (preserving the params would be a sweet bonus :) > > -- > Posted via http://www.ruby-forum.com/. > > -- > 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@googlegroups.com. > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscr...@googlegroups.com. > 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 rubyonrails-talk@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: Is there a way to redirect from one controller action to another without a server trip?
something like render :controller => othercontroller, :action => :otheraction, :params => params ? (preserving the params would be a sweet bonus :) -- Posted via http://www.ruby-forum.com/. -- 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@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.