Skip to content

Instantly share code, notes, and snippets.

@cfeduke
Created March 23, 2011 16:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cfeduke/883447 to your computer and use it in GitHub Desktop.
Save cfeduke/883447 to your computer and use it in GitHub Desktop.
Sinatra app
# this handles package, node, asset, asset_binary, all recursively
get '/:klass/:id.:format' do |klass, id, format|
klass = klass.classify
options = eval("#{klass}::SERIALIZATION_OPTIONS")
DataFormatter::resolve(-> { eval("#{klass}.where(:id => #{id})")}, format, options)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment