Skip to content

Instantly share code, notes, and snippets.

@jraczak
Created August 9, 2012 15:41
Show Gist options
  • Select an option

  • Save jraczak/3305271 to your computer and use it in GitHub Desktop.

Select an option

Save jraczak/3305271 to your computer and use it in GitHub Desktop.
#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