Created
August 9, 2012 15:41
-
-
Save jraczak/3305271 to your computer and use it in GitHub Desktop.
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
| #dwellings_controller.rb | |
| def create | |
| @dwelling = current_user.properties.build(params[:dwelling]) | |
| if @dwelling.save | |
| current_user.dwelling = @dwelling | |
| if current_user.save | |
| flash[:success] = "Woohoo! Your dwelling has been created. Welcome home!" | |
| else | |
| flash[:notice] = "You have successfully created a dwelling, but something prevented us from adding you as a roomie. Please email support so we can try to correct this for you." | |
| end | |
| redirect_to current_user | |
| else | |
| render 'new' | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment