ruby on rails - Checking JSON response from browser -
i want render response in json , then, check json document generated rails browser. can't because templatenotfound
exception raised. it's weird me because, it's seen, json sample text , shouldn't need template.
def who_bought @product = product.find(params[:id]) @lastest_order = @product.orders.order(:updated).last if stale?(@lastest_order) respond_to |format| format.atom format.xml { render :xml => @product.to_xml(:include => :orders)} format.json { render json: @product } end end end
anyone knows missing?
to json response, request type must json. append .json
url. e.g. localhost:3000/posts.json
return json data.
Comments
Post a Comment