Created
December 4, 2009 03:52
-
-
Save dmix/248808 to your computer and use it in GitHub Desktop.
This file contains 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
#live_validations_controller.rb | |
class LiveValidationsController < ApplicationController | |
def validate_username | |
if params[:username].length > 3 | |
@user = User.find_by_username(params[:username]) | |
if @user.nil? | |
@message = "<img src='/images/accept.png' alt='Valid Username'/>" | |
else | |
@message = "<img src='/images/cross.png' alt='Invalid Username' /> Name taken" | |
end | |
else | |
@message = "" | |
end | |
render :partial => "message" | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment