def jsontest @users = User.all.limit(10) render json: @users end
yields
{ ... \"id\": 7, \"name\": \"Sage Smith\", \"email\"
@girishso's gem is great, but my project is in Rails 3. It doesn't work.
This article is helpful to me, or install pluck_all gem to achieve this.
Usage:
User.limit(10).pluck_all(:id, :name, :email, :created_at)