why won't rails find rabl templates?

懵懂的女人 提交于 2019-12-11 03:08:17

问题


working on an api, using the rails-api and rabl gems, basing understanding off railscasts 348 and 322

currently getting

Missing template activities/index, application/index with {:locale=>[:en], :formats=>[:html], :handlers=>[:erb, :builder, :raw, :ruby, :rabl]}. Searched in:
  * "/Users/jd/Dropbox/honeybadgerconsulting/activitiesapi/app/views"

but best I can tell, my setup mirrors the screencasts, is there a detail i'm overlooking ?

controller is

class ActivitiesController < ApplicationController
  include ActionController::ImplicitRender

  def index
    @activities = Activity.all
  end

end

and path to rabl template is /app/views/activities/index.json.rabl

context of json.rabl

collection @activities

attributes :title, :vendor, :date, :start_time, :price


回答1:


Your request URL has to end in ".json", rails thinks it's an HTML request.



来源:https://stackoverflow.com/questions/21368905/why-wont-rails-find-rabl-templates

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!