Last active
December 21, 2015 01:08
-
-
Save flarnie/6225165 to your computer and use it in GitHub Desktop.
Testing the behavior of 'Flash' in a userscontroller for Ruby on Rails 3.2.0.
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
class UsersController < ApplicationController | |
def new | |
end | |
def create | |
@user = User.new(params[:user]) | |
if @user.save | |
flash[:notice] ="OLD VALUE assigned in 'create'" | |
redirect_to user_url(@user) | |
else | |
flash[:notice] = "Failed to save user!" | |
redirect_to new_user_url | |
end | |
end | |
def index | |
@users = User.all | |
end | |
def show | |
flash[:notice] = "NEW VALUE assigned in 'show'" | |
@user = User.find(params[:id]) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment