Srividya Sharma wrote:
Hello
I am using Rails 2.2.2.
Here is my problem:
I have a controller action which will receive several parameters,
validate them, process them and create a new set of parameters out of
them.
Then, this controller should delegate the task to another controller
action based on some values and pass these processed parameters to it. I
have stored the processed parameters in a hash. (there are many of them)I could only see two options to achieve this:
1. Use redirect_to and pass each parameter as a string.
2. Use render_component and pass the parameters as a hash.I have seen that render_component is not recommended in most cases. Is
it recommended solution for this case? I think render_component slows
down the request also.
Which option is right for me?
Are there any other ways to achieve this? Please guide me.
If you don't want the browser url to change, you can just call
the other action like a method, passing the parameters in either
an instance variable or a method parameter (that's default nil
to allow it to be called externally). Or are you messing with
params directly?
This is assuming the other method is in the same controller.
If it isn't, you'll have to make the other method available
within the first controller, either through inheritance or
mix-ins.