Forum: Ruby on Rails simple question

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
E694f7385e797af01c1b67366d5843a0?d=identicon&s=25 Thila Thila (thila)
on 2006-01-17 07:43
How do I pass parameters from one controller to another during
redirect_to command? I want to pass both model and non-model objects.
The solution I use is via session, but I rather pass it as parameters to
the redirect_to

Thanks.
317aad7f9f0b69a440faca74bbe22b20?d=identicon&s=25 Jakob Skjerning (Guest)
on 2006-01-17 08:17
(Received via mailing list)
On Jan 17, 2006, at 7:43, thila thila wrote:

> How do I pass parameters from one controller to another during
> redirect_to command? I want to pass both model and non-model objects.
> The solution I use is via session, but I rather pass it as
> parameters to
> the redirect_to

redirect_to :controller => 'other', :action => 'stuff', :model_id =>
43, :foo => 'bar'

will make params[:model_id] and params[:foo] available in the other
controller/action.


--
Jakob Skjerning - http://mentalized.net
E694f7385e797af01c1b67366d5843a0?d=identicon&s=25 Thila Thila (thila)
on 2006-01-17 09:03
Jakob Skjerning wrote:
> On Jan 17, 2006, at 7:43, thila thila wrote:
>
>> How do I pass parameters from one controller to another during
>> redirect_to command? I want to pass both model and non-model objects.
>> The solution I use is via session, but I rather pass it as
>> parameters to
>> the redirect_to
>
> redirect_to :controller => 'other', :action => 'stuff', :model_id =>
> 43, :foo => 'bar'
>
> will make params[:model_id] and params[:foo] available in the other
> controller/action.
>
>
> --
> Jakob Skjerning - http://mentalized.net

Thanks Jakob for the prompt help.
F6a834b9e424a1e5b199db450462b6cd?d=identicon&s=25 Ron Fox (Guest)
on 2008-03-28 03:18
(Received via mailing list)
More precisely, ruby variables are references to objects, not the object
itself.  You can return a reference to any type of object, including an
Array.

RF
This topic is locked and can not be replied to.