Created
May 23, 2011 04:19
-
-
Save sbc/986221 to your computer and use it in GitHub Desktop.
URL when controller renders home page on error
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # - Home page has a subscription form on it. | |
| # - Form is posted to create action of SubscribersController. | |
| # - When error occurs, controller renders home page | |
| # - URL in browser is http://app.example.com/subscribers | |
| # - I want it to be just http://app.example.com | |
| class SubscribersController < ApplicationController | |
| def create | |
| @subscriber = Subscriber.new(params[:subscriber]) | |
| if @subscriber.save | |
| redirect_to thankyou_path | |
| else | |
| @current_action = 'home' | |
| render 'pages/home' | |
| end | |
| end | |
| end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment