bjornmelgaard bjornmelgaard - 2 years ago 148
JSON Question

Missing template (jbuilder)

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


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

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

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

Answer Source

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.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download