redirect_to previous url?

9 views
Skip to first unread message

Carson

unread,
Mar 17, 2008, 12:39:57 PM3/17/08
to MidWest.rb
I'm building my first custom e-comm application in rails. My catalog
listings are a few directories down from the index page, arrived at
through various sub-category selection. After adding a product to the
cart, I want to redirect to the current url instead of the index. I
don't quite know how to do this. I seems to me that I have to capture
the current url and pass it to the controller action, then redirect to
it. But I could be way off.

Any advice?

Regards,

Carson

Mark Van Holstyn

unread,
Mar 17, 2008, 1:04:58 PM3/17/08
to midw...@googlegroups.com
redirect_to :back if you want to go back to the last url you were at, not sure if that is what you are asking though...

Mark
--
Mark Van Holstyn, Partner / Software Developer
mvanh...@mutuallyhuman.com, (616) 706-6842
Mutually Human Software, http://mutuallyhuman.com

Ed Jones

unread,
Mar 17, 2008, 1:09:08 PM3/17/08
to midw...@googlegroups.com
Carson, I don't know the answer, but I wonder if you might find it in Chpt 2 of the excellent The Rails Way. Ch 2 explains all about the dispatcher, and at p 39 it goes to some depth about redirecting.

Ed

Carson

unread,
Mar 18, 2008, 10:02:17 AM3/18/08
to MidWest.rb
Thanks Mark:

Boy! That was a fast answer.

Carson

On Mar 17, 11:04 am, "Mark Van Holstyn" <mvanhols...@gmail.com> wrote:
> redirect_to :back if you want to go back to the last url you were at, not
> sure if that is what you are asking though...
>
> Mark
>
>
>
>
>
> On Mon, Mar 17, 2008 at 12:39 PM, Carson <E.CarsonCampb...@gmail.com> wrote:
>
> > I'm building my first custom e-comm application in rails. My catalog
> > listings are a few directories down from the index page, arrived at
> > through various sub-category selection. After adding a product to the
> > cart, I want to redirect to the current url instead of the index. I
> > don't quite know how to do this. I seems to me that I have to capture
> > the current url and pass it to the controller action, then redirect to
> > it. But I could be way off.
>
> > Any advice?
>
> > Regards,
>
> > Carson
>
> --
> Mark Van Holstyn, Partner / Software Developer
> mvanhols...@mutuallyhuman.com, (616) 706-6842
> Mutually Human Software,http://mutuallyhuman.com- Hide quoted text -
>
> - Show quoted text -

Carson

unread,
Mar 18, 2008, 10:11:36 AM3/18/08
to MidWest.rb
Hey Ed:

Thanks for the input. I haven't seen "The Rails Way". I've been
through AWDWR and the Pickaxe. I've found the Apress RoR E-Comm book
useful in gaining some production techniques. I need a mid-level how
to book. Let me know if "The Rails Way" is at the top of your list at
this juncture. I have plenty of experience in programming but I'm new
to Rails.

If anyone else has a suggestion, I'd be pleased to hear it.

Regards,

Carson

On Mar 17, 11:09 am, Ed Jones <ed.jo...@gmail.com> wrote:
> Carson, I don't know the answer, but I wonder if you might find it in Chpt 2 of the excellentThe Rails Way. Ch 2 explains all about the dispatcher, and at p 39 it goes to some depth about redirecting.

Zach Dennis

unread,
Mar 18, 2008, 10:35:30 AM3/18/08
to midw...@googlegroups.com
Mark's like Jimmy John's but for Rails programming. ;)

Freaky Fast. Freaky Good.

Zach

--
Zach Dennis
http://www.continuousthinking.com

Reply all
Reply to author
Forward
0 new messages