On Mon, Jun 8, 2009 at 5:05 AM, Vikas
Gholap<[email protected]> wrote:
>
> Hello all,
>
> I have following problem,
>
> I have a view called "new_sub_type.html.haml" and controller
> "SubscriptionTypes". In this view i'm showing a dropdown list of
> subscription types.
>
> When user submit form, I show another view "new_credit_card.html.haml"
> which is in controller "CreditCards". This form is submitted to
> "SubscriptionTypes" controller.
>
> Then i validate credit card information in "SubscriptionTypes"
> controller.
>
> if credit card info is not valid then i redirect to again credit cards
> "new.html".

Redirecting will lose state.

I think instead of redirecting you want to render the new template,
normally this is done within the same controller but if you really
have to render a view from a different controller then

  render :action => 'new', :controller => :credit_cards

should do the trick, assuming you set up the controller instance
variables which the view (and any partials) expects.

but really your description sounds a bit complex, I'd look at trying
to get away from jumping between controllers.


-- 
Rick DeNatale

Blog: http://talklikeaduck.denhaven2.com/
Twitter: http://twitter.com/RickDeNatale
WWR: http://www.workingwithrails.com/person/9021-rick-denatale
LinkedIn: http://www.linkedin.com/in/rickdenatale

--~--~---------~--~----~------------~-------~--~----~
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 [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to