Forum: Ruby on Rails if controller is rebuilt each time when we uses redirect_to?

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.
14b7344777a56ac9a1fad849f5d6da2a?d=identicon&s=25 sayoyo (Guest)
on 2005-12-09 15:48
(Received via mailing list)
Hi,

Does anyone know, if a controller is built each time,
when we use "redirect_to" ????

Thanks you very much.

Saiho


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
3dd4b52a0946bd698b1d1635a46ea3a3?d=identicon&s=25 francois.beausoleil (Guest)
on 2005-12-09 16:37
(Received via mailing list)
Hi !

2005/12/9, Saiho Yuen <sayoyo@yahoo.com>:
> Does anyone know, if a controller is built each time,
> when we use "redirect_to" ????

What do you mean by 'rebuilt' ?
14b7344777a56ac9a1fad849f5d6da2a?d=identicon&s=25 sayoyo (Guest)
on 2005-12-09 17:13
(Received via mailing list)
Hi,

As I understanded (I could be worng), when a request
is sent to Rails, Rails will create a controller
object to answer that request, after that the
controller object will be destroyed by Rails. There is
no object pool inside of Rails.

if we use "redirect_to" from page A(controller A) to
page B (controller B), I think the controller A is
destroyed, then Rails creates controller B. (Am I
correct?) I wonder if we redirect page A/f1 to A/f2
(same controller), is the controller is destroyed and
then recreate?????

Thanks you very much!!!

Saiho



--- Francois Beausoleil
<francois.beausoleil@gmail.com> wrote:

> Fran├žois Beausoleil
> http://blog.teksol.info/
> > _______________________________________________
> Rails mailing list
> Rails@lists.rubyonrails.org
> http://lists.rubyonrails.org/mailman/listinfo/rails
>


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
3ccecc71b9fb0a3d7f00a0bef6f0a63a?d=identicon&s=25 ksruby (Guest)
on 2005-12-09 17:54
(Received via mailing list)
redirect_to from action A to B is no different from if you type in the
URL for
action B in your browser and submit it. A new controller instance is
created
for every request.

Kent.
14b7344777a56ac9a1fad849f5d6da2a?d=identicon&s=25 sayoyo (Guest)
on 2005-12-09 19:44
(Received via mailing list)
Hi,

Thanks you very much for the information, but I wonder
if each time rails receives a request and recreate an
instance of controller, is it too heavy?  for a simple
controller, it is quit correct, but if we a "huge"
one, it may not be the best solution... is there
someway, we can optimize this...?

thanks you very much

Saiho



--- Kent Sibilev <ksruby@gmail.com> wrote:

> >
> > page B (controller B), I think the controller A is
> >
> > >
> > > >
> protection around
>
If God really exists, I would like to
know what the dinosaurs have done to
deserve their extinction.

Water is unknown to fishes,
until they discover air.

http://www.geocities.com/sayoyo/

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
821395fe70906c8290df7f18ac4ac6cf?d=identicon&s=25 technoweenie (Guest)
on 2005-12-09 19:48
(Received via mailing list)
On 12/9/05, Saiho Yuen <sayoyo@yahoo.com> wrote:
>
> Saiho

I wouldn't worry about it.  Chances are if your page is slow, you're
pulling too much data from the database or something.  If your
controller is really that big, I'd also consider splitting it up into
multiple controllers.

--
rick
http://techno-weenie.net
6993d6b4b6d882f421e1b45ac147f3e0?d=identicon&s=25 scott (Guest)
on 2005-12-09 22:05
(Received via mailing list)
On Dec 9, 2005, at 1:43 PM, Saiho Yuen wrote:

>
> Saiho

Relative to the rest of the processing happening on each request,
the time it takes to instantiate your controller object would be
the least of your worries.  It's negligible in the grand scheme
of things.

Your controllers should not be "huge" anyway.

Are you having some specific performance problems?

--
Scott Barron
Lunchbox Software
http://lunchboxsoftware.com
http://lunchroom.lunchboxsoftware.com
http://rubyi.st
38a8230ed3d5c685558b4f0aad3fc74b?d=identicon&s=25 joevandyk (Guest)
on 2005-12-09 22:09
(Received via mailing list)
On 12/9/05, Saiho Yuen <sayoyo@yahoo.com> wrote:
> Hi,
>
> Thanks you very much for the information, but I wonder
> if each time rails receives a request and recreate an
> instance of controller, is it too heavy?  for a simple
> controller, it is quit correct, but if we a "huge"
> one, it may not be the best solution... is there
> someway, we can optimize this...?

Hint: Don't try to optimize anything until you can prove that it's
your application's bottleneck.
This topic is locked and can not be replied to.