class UsersController
def index
@users = User.all
respond_to do |format|
format.html
format.json { render json: @users.as_json }
end
end
end
Last active
February 1, 2022 14:52
-
-
Save stevepolitodesign/74e38761f895a90f19dba02af15a01eb to your computer and use it in GitHub Desktop.
Rails as_json API Example
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment