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 <li...@ruby-forum.com> 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.

Reply via email to