Created
March 29, 2012 10:06
-
-
Save momolog/2235608 to your computer and use it in GitHub Desktop.
"valid" action - nested
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
def valid | |
if code = Code.find_by_value(params[:id]) | |
unless code.used? | |
respond_with :valid => true | |
else | |
respond_with :valid => false, :reason => 'used' | |
end | |
else | |
respond_with :valid => false, :reason => 'unknown' | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment