首页 > 数据库技术 > 详细

access json.jbuilder file in api

时间:2017-01-23 15:00:11      阅读:306      评论:0      收藏:0      [点我收藏+]
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
 
 

access json.jbuilder file in api

原文:http://www.cnblogs.com/iwangzheng/p/6343851.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!