您的位置:首页 > 产品设计 > UI/UE

access json.jbuilder file in api

2017-01-23 12:59 253 查看
Missing template api/v2/subjects/fetch_subject, api/base/fetch_subject, application/fetch_subject with {:locale=>[:"zh-CN"], :formats=>[:html], :variants=>[], :handlers=>[:raw, :erb, :html, :builder, :ruby, :coffee, :jbuilder]}.

新建的fetch_subject.json.jbuilder在接口访问不到, http://localhost:3000/api/v2/subjects/516?for_fetch=true
两种方法

(方法一) http://localhost:3000/api/v2/subjects/516.json?for_fetch=true
(方法2)

  if params[:for_fetch].present?  
    render :fetch_subject, formats: [:json] 
  else               
    render :show     
  end
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: