bjornmelgaard bjornmelgaard - 6 months ago 35
JSON Question

Missing template (jbuilder)

Rails trying to find users folder with jbuilder files, which exist, but can't

Application

Missing template users/index, application/index with {:locale=>[:en], :formats=>[:html], :variants=>[], :handlers=>[:erb, :builder, :raw, :ruby, :slim, :coffee, :jbuilder]}. Searched in:
* "/home/bjorn/Documents/poller/app/views"
* "/usr/lib/ruby/gems/2.3.0/gems/devise_token_auth-0.1.37/app/views"
* "/usr/lib/ruby/gems/2.3.0/gems/devise-4.0.3/app/views"


full error stack

# controllers/users_controller.rb
class UsersController < ApplicationController
def index
@users = User.all
end

def show
@user = User.find(params[:id])
end
end

# routes.rb
resources :users, only: [ :index, :show ]

Answer

I cloned your repo and I don't get this exception at /api/users.

However you need to rename your layout file application.slim to application.html.slim. Otherwise jbuilder will render the layout too.