Created
September 29, 2008 17:55
-
-
Save dyoder/13640 to your computer and use it in GitHub Desktop.
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
# 'html' is the default when there is no extension or Accept header | |
# we will actually default to json, though ... | |
Formats = [ :json, :html ] | |
on( :get, [ :resource ] ) do | |
# ... do something to get results | |
format = File.extname( path ); format = 'json' if format.empty? | |
results.send( "to_#{ format }" ) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment