render json in a controller.
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
# 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