I have what I believe to be a very simple app, with Rails 5 (API only) but for some reason it is returning an empty response while it should be returning a json object (using RABL)
class ExercisesController < ApplicationController
before_action :set_exercise, only: [:show, :update, :destroy]
def index
@exercises = Exercise.all
# Works
# render json: @exercises
# Blank response
render :index
end
end
# app/views/exercises/index.json.rabl
collection @exercises
attributes :id, :name
If I use a direct render (commented) it works properly, but with the rabl template it is blank... any thoughts?
尝试将config.view_paths = ['/app/views']
到您的配置中。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.