Skip to content

Instantly share code, notes, and snippets.

Created November 15, 2013 12:25
Show Gist options
  • Save anonymous/7483564 to your computer and use it in GitHub Desktop.
Save anonymous/7483564 to your computer and use it in GitHub Desktop.
class UserSerializer < ActiveModel::Serializer
attributes :id, :name, :phone, :email, :balance, :children, :balance
def children # i need to add :children = true to JSON responce for each subuser who have @subuser.subordinates.any?
end
end
if request.format.json? && params[:id] != nil && have_permissions?(User.find(params[:id]))
render json: @subusers, root: false
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment