rabl

    2热度

    1回答

    我有一个包含父类和子类对象的源,我使用RABL渲染成json。我将根对象包含在json中。 事情是这样的=>根据什么先来,JSON中的根节点将与相应的类生成。 我需要它是所有的父类。 举例如下: Class Klass ... Class SubclassOfKlass < Klass ... k = Klass.create s = SubclassOfKlass.create

    6热度

    1回答

    子节点,我想我有当我使用Rabl的返回JSON标准的RESTful控制器方法非常简单的情况下... 首先,让我们说我有一个典型的与许多关系父母和孩子(假设客户和帐户): class Customer < ActiveRecord::Base has_many :accounts end 在我的控制器为客户我已经索引和编辑 - 指数在这里我只是想回到所有客户(没有帐户),并编辑,我想

    0热度

    1回答

    我有一个问题,同时增加了新的方法到控制器 ,下面是详细信息: matches_controller.rb def index @matches = Match.all render rabl: @matches end def current @matches = Match.find_by_sql("SELECT * FROM `TEST`.`matches

    1热度

    1回答

    我从我的分贝JSON格式使用Rabl的解析在Android系统显示数据... 的json看起来像这样: [ { "bank":{ "central_office_address":"ololo", "license":"12312312", "location_id":3, "name":"Pbank", "tax_

    0热度

    1回答

    如何在rabl模板中的子元素中添加父属性?要做到这样的事情: parent: { attr_1: 'asd', attr_2: 'dfg', child: { attr_3: 6, attr_from_parent: 'cvb' } }

    0热度

    1回答

    我需要渲染一些json数据。我用Rabl的这个目的.... 我在index.rabl这样的代码: collection @banks, :root => "bank", :object_root => false attributes :id, :central_office_address, :location_id, :name, :year_of_foundation 它的产生我的js

    -1热度

    1回答

    我正在使用rabl在Sinatra中构建和API。 object @user attributes :profile_photo => :profile_photo, :name => :first_name, :last_name => :last_name child :addresses do attributes :id child :countr

    5热度

    2回答

    我在Rails应用程序中使用RABL来通过REST访问数据。除了if语句之外,它正在工作。 我得到这个错误: undefined local variable or method `matitem_id' 这是我的show.json.rabl代码: object @expense attributes :id, :unitcost, :quantity, :markup, :exp_date

    2热度

    1回答

    在控制器我有这样的代码: @bank_exchangers = ExchangerList.find(:all, :conditions => {:bank_id => params[:id]}) @currency_list = CurrencyList.all @currencies = [] @currency_list.each do |c| @c

    -1热度

    1回答

    我想以另一种格式返回updated_at属性的日期时间,但是在集合中。 如果它是一个对象,我会做这样的事情 object @person attributes :name, :phone node(:updated_at){|person|(person.created_on.strftime(%d,%m,%Y)} end 但是,我怎么能做到这一点的人收藏? 在此先感谢。