I am trying to do everything on a single page. The page is called users/index.html.erb.
On this page I return a simple data base query in json format.
I would like to also return a seperate query in non json format from the same database.
I'm trying to avoid partials for the moment as they make variable handling a bit more complicated that I want for my beginner level.
This is what I have:
class UsersController < ApplicationController
def index
@users = User.including_relationships
@followas= User.find_by name: params[:name]
respond_to do |format|
format.html # index.html.erb
format.json { render json: @users }
end
end
end
but it doesnt work unsurprisingly. How can I get it to work in one action?