Skip to content

Instantly share code, notes, and snippets.

@rojotek
Created November 29, 2011 07:12
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 rojotek/1403824 to your computer and use it in GitHub Desktop.
Save rojotek/1403824 to your computer and use it in GitHub Desktop.
render json in a controller.
# code to retrieve the collection - the to_json filtering works on a collection, or a single model record
render :json => collection.to_json(:only => [ :id, :name, :another_attribute])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment