缺少模板 (jbuilder)

Missing template (jbuilder)

Rails 试图找到包含 jbuilder 文件的用户文件夹,这些文件存在,但找不到

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 ]

我克隆了你的存储库,但在 /api/users 没有得到这个异常。

但是您需要将布局文件 application.slim 重命名为 application.html.slim。否则 jbuilder 也会渲染布局。