rabl

    1热度

    2回答

    我有一个提交模型 belongs_to :report has_many :answers 报表模型 has_many :questions 问题型号 has_many :answers # answer has submission_id 现在Rabl的模板,我需要这样的 输出 object @submission attributes :status, :submi

    0热度

    1回答

    只要rabl模板中的渲染失败,它就会显示错误。它不显示行号。有没有人遇到过这个问题呢? 例跟踪: Rendered campaigns/show.json.rabl (1377.9ms) undefined method `[]' for nil:NilClass (eval):21:in `block (2 levels) in render' /Users/pkhadloya/.rben

    0热度

    1回答

    我正在基于angularjs和rails的单页应用程序。我使用RABL来呈现JSON文件。 很多JSON响应需要这样的 child :tags do attributes :id, :name end child webapp.comments do |t| // with other nested attributs like user fo

    0热度

    1回答

    我们的业务要求是所有JSON响应看起来像这样一致的JSON对象: { "status": "ok" "page": "1", "perPage: "20", "totalPages": "3", "totalRecords": "54", "records": [ { "id": 1234, "name": "Lorem ipsum } ] } 换句话说,响应的肉一组“记录”,但它需

    1热度

    1回答

    我有这样的index.rabl: collection @exchangers, :root => "bank", :object_root => false extends "exchanger_lists/show" 和这样show.rabl: object @exchanger attributes :id, :name, :address, :location_id, :lati

    0热度

    1回答

    发送对象我有这样的index.rabl: collection @exchangers, :root => "bank", :object_root => false extends "exchanger_lists/show" 和这样show.rabl: object @exchanger attributes :id, :name, :address, :location_id, :

    0热度

    2回答

    使用Rspec,我试图为我的API创建一个控制器规范,以及请求规范。问题是我不明白在每个规范中测试的部分内容。 为简单起见,假设我的控制器看起来像如下: class Api::V1::ItemsController < ApplicationController def index if params[:user_id] user = User.find(param

    3热度

    2回答

    我的Rails应用程序用于生产JSON是这个样子: {"paintings": [ {"id":1,"name":"a"}, {"id":2,"name":"b"} ] } 我加Rabl的JSON格式,而现在的JSON看起来是这样的: [ {"id":1,"name":"a"}, {"id":2,"name":"b"} ] 灰

    2热度

    1回答

    我正在构建一个Rails 3.2应用程序,我正在使用Rabl模板。 我想添加一个显示记录总数的“根节点”。 下面的解决方案将总节点添加到每条记录。我希望它在所有记录之上。 collection @projects extends "projects/_base" node(:total_entries) { @projects.total_count } 我希望它是这样的: - tot

    1热度

    1回答

    另一种模式我有3种型号: class City < ActiveRecord::Base has_many :buildings end class Company < ActiveRecord::Base has_many :buildings end class Building < ActiveRecord::Base belongs_to :city