access json.jbuilder file in api

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
 
 
posted @ 2017-01-23 12:59  冰凌花花~  阅读(147)  评论(0编辑  收藏  举报