Skip to content

Instantly share code, notes, and snippets.

@momolog
Created March 29, 2012 10:06
Show Gist options
  • Save momolog/2235608 to your computer and use it in GitHub Desktop.
Save momolog/2235608 to your computer and use it in GitHub Desktop.
"valid" action - nested
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