rabl

    0热度

    2回答

    如何skip_before_filter为index和show控制器仅在格式__json__而不是HTML? 喜欢的东西 skip_before_filter :authenticate_user!, :only => [:index, :show, :format => :json] 我使用轨3.2。谢谢。

    1热度

    1回答

    我最近遇到一个条件是我想在RABL中发送两个对象作为响应。 [ { id: "1", name: "XYZ" }, { id: "1", name: "XYZ" }, { total: "2" } ] 我能管理的只是这个,这是不正确的。 [ { id: "1", name: "XYZ", total

    0热度

    1回答

    我有经由一个查询,然后使用Rabl的格式化接收数据的数据表的表。 这一切都很好,直到我的搜索找不到行。 然后我只是得到....处理消息,没有更新。 我很困惑于RABL。有没有办法看到它在做什么? 这是我data.rabl文件 object false node(:iTotalRecords){@iTotalRecords} node(:iTotalDisplayRecords){@iTota

    0热度

    2回答

    编辑:解决。解决方案: 包括在你的Gemfile gem 'rabl'和gem 'oj'与gem rabl-rails 出于某种原因一起,我的实例变量没有被传递到视图(我使用Rabl的)。 下面是相关代码: articles_controller.rb class ArticlesController < ApplicationController respond_to :json, :

    0热度

    1回答

    试图让用户模型打印到JSON,试图使文件具有json.rabl扩展如下: file.json.rabl object @users attributes :id, :name 当我尝试查看,我得到了以下错误消息: Missing template users/autocomplete, application/autocomplete with {:locale=>[:en], :form

    1热度

    3回答

    我传递一个简单的对象到我Rabl的视图格式化的Rabl的看法基本上是两条线: object @invitations attributes :email, :active, :invitation_sent_at, :invitation_accepted_at 我如何格式化日期:invitation_sent_at?另外 object @invitations attributes :e

    3热度

    3回答

    我一直在试图找出如何使Rabl的字符串呈现一个非常简单的JSON数组,如:["my,"array","of","strings"] 控制器将 class StringsController < ApplicationController responds_to :json def index @string = ['my','array','of','string

    0热度

    1回答

    我有一个Rabl的: collection @posts.sort_by { |p| p["title"] } attributes :id, :name, :title ,给了我一个JSON结果是这样的: [{ "id":9, "name":"whatever", "title":"whatever" }] 现在我也想补充我收集相关帖子的“子集”,具有相同属性中的每个项目 - 这样的:

    0热度

    1回答

    我试图用RABL生成JSON的子节点,我index.rabl看法是这样的: collection @products => :products attributes :id, :name, :price, :category_id node(:total) {@products.count} 这将生成JSON结构如下: {"products":[{"id":1,"name":"p

    1热度

    1回答

    我正在构建一个rails 3.2.14 web应用程序和API。我希望API部分的响应速度比它更快。 我的问题是这样的: 我目前使用Rabl的宝石 。使用Model序列化器是否更好(性能明智)? 有什么我可以做的,以加快请求(也许与中间件)? 我如何测量API的性能?有没有工具或服务? 感谢所有输入!